1
0
mirror of https://github.com/golang/go synced 2024-11-23 08:30:05 -07:00

cmd/asm: fix and test CALL, JMP aliases on arm, arm64, ppc64

Fixes #11900.

Change-Id: Idfc54e1fac833c8d646266128efe46214a82dfed
Reviewed-on: https://go-review.googlesource.com/12741
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Russ Cox 2015-07-27 23:26:26 -04:00
parent 0229317d76
commit ce23729af2
11 changed files with 43 additions and 4 deletions

View File

@ -79,6 +79,7 @@ var armJump = map[string]bool{
"BGT": true,
"BLE": true,
"CALL": true,
"JMP": true,
}
func jumpArm(word string) bool {

View File

@ -42,6 +42,7 @@ var arm64Jump = map[string]bool{
"CBZW": true,
"CBNZ": true,
"CBNZW": true,
"JMP": true,
}
func jumpArm64(word string) bool {

View File

@ -12,7 +12,7 @@ import "cmd/internal/obj/ppc64"
func jumpPPC64(word string) bool {
switch word {
case "BC", "BCL", "BEQ", "BGE", "BGT", "BL", "BLE", "BLT", "BNE", "BR", "BVC", "BVS", "CALL":
case "BC", "BCL", "BEQ", "BGE", "BGT", "BL", "BLE", "BLT", "BNE", "BR", "BVC", "BVS", "CALL", "JMP":
return true
}
return false

View File

@ -52,4 +52,8 @@
266 00052 (testdata/arm.s:266) PLD (R1)
267 00053 (testdata/arm.s:267) PLD 4(R1)
276 00054 (testdata/arm.s:276) RET
285 00055 (testdata/arm.s:285) END
280 00055 (testdata/arm.s:280) JMP foo(SB)
281 00056 (testdata/arm.s:281) CALL foo(SB)
282 00057 (testdata/arm.s:282) JMP foo(SB)
283 00058 (testdata/arm.s:283) CALL foo(SB)
292 00059 (testdata/arm.s:292) END

View File

@ -275,6 +275,13 @@ TEXT foo(SB), 0, $0
// }
RET
// More B/BL cases, and canonical names JMP, CALL.
B foo(SB)
BL foo(SB)
JMP foo(SB)
CALL foo(SB)
//
// END
//

View File

@ -48,4 +48,8 @@
242 00048 (testdata/arm64.s:242) LDAXRW (R0), R2
243 00049 (testdata/arm64.s:243) STLXRW R1, (R0), R3
251 00050 (testdata/arm64.s:251) RET
259 00051 (testdata/arm64.s:259) END
255 00051 (testdata/arm64.s:255) JMP foo(SB)
256 00052 (testdata/arm64.s:256) CALL foo(SB)
257 00053 (testdata/arm64.s:257) JMP foo(SB)
258 00054 (testdata/arm64.s:258) CALL foo(SB)
266 00055 (testdata/arm64.s:266) END

View File

@ -250,6 +250,13 @@ again:
// }
RET
// More B/BL cases, and canonical names JMP, CALL.
B foo(SB)
BL foo(SB)
JMP foo(SB)
CALL foo(SB)
// END
//
// LTYPEE comma

View File

@ -107,4 +107,8 @@
691 00107 (testdata/ppc64.s:691) NOP F2
697 00108 (testdata/ppc64.s:697) NOP $4
705 00109 (testdata/ppc64.s:705) RET
713 00110 (testdata/ppc64.s:713) END
709 00110 (testdata/ppc64.s:709) JMP foo(SB)
710 00111 (testdata/ppc64.s:710) CALL foo(SB)
711 00112 (testdata/ppc64.s:711) JMP foo(SB)
712 00113 (testdata/ppc64.s:712) CALL foo(SB)
720 00114 (testdata/ppc64.s:720) END

View File

@ -704,6 +704,13 @@ label1:
// }
RET
// More BR/BL cases, and canonical names JMP, CALL.
BR foo(SB)
BL foo(SB)
JMP foo(SB)
CALL foo(SB)
// END
//
// LEND comma // asm doesn't support the trailing comma.

View File

@ -249,7 +249,9 @@ var lexinit = []asm.Lextab{
{"DIVF", LTYPEK, arm.ADIVF},
{"DIVD", LTYPEK, arm.ADIVD},
{"B", LTYPE4, arm.AB},
{"JMP", LTYPE4, arm.AB},
{"BL", LTYPE4, arm.ABL},
{"CALL", LTYPE4, arm.ABL},
{"BX", LTYPEBX, arm.ABX},
{"BEQ", LTYPE5, arm.ABEQ},
{"BNE", LTYPE5, arm.ABNE},

View File

@ -256,9 +256,11 @@ var lexinit = []asm.Lextab{
{"SRAW", LSHW, ppc64.ASRAW},
{"SRAWCC", LSHW, ppc64.ASRAWCC},
{"BR", LBRA, ppc64.ABR},
{"JMP", LBRA, ppc64.ABR},
{"BC", LBRA, ppc64.ABC},
{"BCL", LBRA, ppc64.ABC},
{"BL", LBRA, ppc64.ABL},
{"CALL", LBRA, ppc64.ABL},
{"BEQ", LBRA, ppc64.ABEQ},
{"BNE", LBRA, ppc64.ABNE},
{"BGT", LBRA, ppc64.ABGT},