mirror of
https://github.com/golang/go
synced 2024-10-01 16:08:33 -06:00
cmd/asm: LOOP is a branch instruction on x86
Just a missed case in in the handling of branches. Fixes #10065 Change-Id: I6be054d30bf1f383c12b4c7626abd5f8ae22b22e Reviewed-on: https://go-review.googlesource.com/6631 Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
parent
cd277e28f2
commit
9a420f4cf3
@ -11,6 +11,7 @@ import (
|
||||
"cmd/internal/obj/ppc64"
|
||||
"cmd/internal/obj/x86" // == amd64
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Pseudo-registers whose names are the constant name without the leading R.
|
||||
@ -77,7 +78,7 @@ func Set(GOARCH string) *Arch {
|
||||
}
|
||||
|
||||
func jump386(word string) bool {
|
||||
return word[0] == 'J' || word == "CALL"
|
||||
return word[0] == 'J' || word == "CALL" || strings.HasPrefix(word, "LOOP")
|
||||
}
|
||||
|
||||
func arch386() *Arch {
|
||||
|
3
src/cmd/asm/internal/asm/testdata/386.out
vendored
3
src/cmd/asm/internal/asm/testdata/386.out
vendored
@ -45,4 +45,5 @@
|
||||
75 00045 (testdata/386.s:75) CMPPD X0,foo+4(SB)
|
||||
78 00046 (testdata/386.s:78) PINSRD (AX),$1,X0
|
||||
79 00047 (testdata/386.s:79) PINSRD foo+4(FP),$2,X0
|
||||
82 00048 (testdata/386.s:82) RET ,
|
||||
83 00048 (testdata/386.s:83) LOOP ,
|
||||
86 00049 (testdata/386.s:86) RET ,
|
||||
|
4
src/cmd/asm/internal/asm/testdata/386.s
vendored
4
src/cmd/asm/internal/asm/testdata/386.s
vendored
@ -78,5 +78,9 @@ label:
|
||||
PINSRD $1, (AX), X0
|
||||
PINSRD $2, foo+4(FP), X0
|
||||
|
||||
// Was bug: LOOP is a branch instruction.
|
||||
loop:
|
||||
LOOP loop
|
||||
|
||||
// LTYPE0 nonnon { outcode(int($1), &$2); }
|
||||
RET
|
||||
|
3
src/cmd/asm/internal/asm/testdata/amd64.out
vendored
3
src/cmd/asm/internal/asm/testdata/amd64.out
vendored
@ -53,4 +53,5 @@
|
||||
86 00053 (testdata/amd64.s:86) PINSRW R11,$4,AX
|
||||
87 00054 (testdata/amd64.s:87) PINSRW foo+4(SB),$4,AX
|
||||
90 00055 (testdata/amd64.s:90) RETFL $4,
|
||||
93 00056 (testdata/amd64.s:93) RET ,
|
||||
94 00056 (testdata/amd64.s:94) LOOP ,
|
||||
97 00057 (testdata/amd64.s:97) RET ,
|
||||
|
4
src/cmd/asm/internal/asm/testdata/amd64.s
vendored
4
src/cmd/asm/internal/asm/testdata/amd64.s
vendored
@ -89,5 +89,9 @@ label:
|
||||
// LTYPERT spec10 { outcode($1, &$2); }
|
||||
RETFL $4
|
||||
|
||||
// Was bug: LOOP is a branch instruction.
|
||||
loop:
|
||||
LOOP loop
|
||||
|
||||
// LTYPE0 nonnon { outcode($1, &$2); }
|
||||
RET
|
||||
|
Loading…
Reference in New Issue
Block a user