Commit 9a420f4c authored by Rob Pike's avatar Rob Pike

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/6631Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent cd277e28
......@@ -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 {
......
......@@ -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 ,
......@@ -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
......@@ -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 ,
......@@ -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
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