Commit f05f2735 authored by Rob Pike's avatar Rob Pike

cmd/internal/obj: print g for the g register on arm and ppc64

The name g is an alias for R10 and R30, respectively. Have Rconv
print the alias, for consistency with the input language.

Change-Id: Ic3f40037884a0c8de5089d8c8a8efbcdc38c0d56
Reviewed-on: https://go-review.googlesource.com/6630Reviewed-by: default avatarMinux Ma <minux@golang.org>
Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent d5f69060
......@@ -289,7 +289,7 @@ var armOperandTests = []operandTest{
{"$256", "$256"},
{"(R0)", "(R0)"},
{"(R11)", "(R11)"},
{"(g)", "(R10)"}, // TODO: Should print 0(g).
{"(g)", "(g)"},
{"-12(R4)", "-12(R4)"},
{"0(PC)", "0(PC)"},
{"1024", "1024"},
......@@ -324,7 +324,7 @@ var armOperandTests = []operandTest{
{"armCAS64(SB)", "armCAS64(SB)"},
{"asmcgocall<>(SB)", "asmcgocall<>(SB)"},
{"c+28(FP)", "c+28(FP)"},
{"g", "R10"}, // TODO: Should print g.
{"g", "g"},
{"gosave<>(SB)", "gosave<>(SB)"},
{"retlo+12(FP)", "retlo+12(FP)"},
{"runtime·_sfloat2(SB)", "runtime._sfloat2(SB)"},
......@@ -349,7 +349,7 @@ var ppc64OperandTests = []operandTest{
{"$~3", "$-4"},
{"(-288-3*8)(R1)", "-312(R1)"},
{"(16)(R7)", "16(R7)"},
{"(8)(g)", "8(R30)"}, // TODO: Should print 8(g)
{"(8)(g)", "8(g)"},
{"(CTR)", "(CTR)"},
{"(R0)", "(R0)"},
{"(R3)", "(R3)"},
......@@ -411,7 +411,7 @@ var ppc64OperandTests = []operandTest{
{"R9", "R9"},
{"SPR(269)", "SPR(269)"},
{"a(FP)", "a(FP)"},
{"g", "R30"}, // TODO: Should print g.
{"g", "g"},
{"ret+8(FP)", "ret+8(FP)"},
{"runtime·abort(SB)", "runtime.abort(SB)"},
{"·AddUint32(SB)", "\"\".AddUint32(SB)"},
......
......@@ -105,6 +105,10 @@ func Rconv(r int) string {
if r == 0 {
return "NONE"
}
if r == REGG {
// Special case.
return "g"
}
if REG_R0 <= r && r <= REG_R15 {
return fmt.Sprintf("R%d", r-REG_R0)
}
......
......@@ -122,6 +122,10 @@ func Rconv(r int) string {
if r == 0 {
return "NONE"
}
if r == REGG {
// Special case.
return "g"
}
if REG_R0 <= r && r <= REG_R31 {
return fmt.Sprintf("R%d", r-REG_R0)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment