diff options
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/arithmetic.go | 6 | ||||
| -rw-r--r-- | test/codegen/bits.go | 11 | ||||
| -rw-r--r-- | test/codegen/comparisons.go | 8 | ||||
| -rw-r--r-- | test/codegen/switch.go | 8 |
4 files changed, 22 insertions, 11 deletions
diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go index 3fb9ce646b..327be24db8 100644 --- a/test/codegen/arithmetic.go +++ b/test/codegen/arithmetic.go @@ -319,7 +319,7 @@ func ConstMods(n1 uint, n2 int) (uint, int) { func Divisible(n1 uint, n2 int) (bool, bool, bool, bool) { // amd64:"MOVQ\t[$]-6148914691236517205","IMULQ","ROLQ\t[$]63",-"DIVQ" // 386:"IMUL3L\t[$]-1431655765","ROLL\t[$]31",-"DIVQ" - // arm64:"MOVD\t[$]-6148914691236517205","MUL","ROR",-"DIV" + // arm64:"MOVD\t[$]-6148914691236517205","MOVD\t[$]3074457345618258602","MUL","ROR",-"DIV" // arm:"MUL","CMP\t[$]715827882",-".*udiv" // ppc64:"MULLD","ROTL\t[$]63" // ppc64le:"MULLD","ROTL\t[$]63" @@ -335,7 +335,7 @@ func Divisible(n1 uint, n2 int) (bool, bool, bool, bool) { // amd64:"IMULQ","ADD","ROLQ\t[$]63",-"DIVQ" // 386:"IMUL3L\t[$]-1431655765","ADDL\t[$]715827882","ROLL\t[$]31",-"DIVQ" - // arm64:"MUL","ADD\t[$]3074457345618258602","ROR",-"DIV" + // arm64:"MUL","ADD\tR","ROR",-"DIV" // arm:"MUL","ADD\t[$]715827882",-".*udiv" // ppc64/power8:"MULLD","ADD","ROTL\t[$]63" // ppc64le/power8:"MULLD","ADD","ROTL\t[$]63" @@ -345,7 +345,7 @@ func Divisible(n1 uint, n2 int) (bool, bool, bool, bool) { // amd64:"IMULQ","ADD",-"ROLQ",-"DIVQ" // 386:"IMUL3L\t[$]678152731","ADDL\t[$]113025455",-"ROLL",-"DIVQ" - // arm64:"MUL","ADD\t[$]485440633518672410",-"ROR",-"DIV" + // arm64:"MUL","MOVD\t[$]485440633518672410","ADD",-"ROR",-"DIV" // arm:"MUL","ADD\t[$]113025455",-".*udiv" // ppc64/power8:"MULLD","ADD",-"ROTL" // ppc64/power9:"MADDLD",-"ROTL" diff --git a/test/codegen/bits.go b/test/codegen/bits.go index e7826b8e65..4f70627c25 100644 --- a/test/codegen/bits.go +++ b/test/codegen/bits.go @@ -363,3 +363,14 @@ func issue48467(x, y uint64) uint64 { d, borrow := bits.Sub64(x, y, 0) return x - d&(-borrow) } + +func foldConst(x, y uint64) uint64 { + // arm64: "ADDS\t[$]7",-"MOVD\t[$]7" + d, b := bits.Add64(x, 7, 0) + return b & d +} + +func foldConstOutOfRange(a uint64) uint64 { + // arm64: "MOVD\t[$]19088744",-"ADD\t[$]19088744" + return a + 0x1234568 +} diff --git a/test/codegen/comparisons.go b/test/codegen/comparisons.go index 4b66044804..5a54a960bc 100644 --- a/test/codegen/comparisons.go +++ b/test/codegen/comparisons.go @@ -19,7 +19,7 @@ import "unsafe" func CompareString1(s string) bool { // amd64:`CMPW\t\(.*\), [$]` - // arm64:`MOVHU\t\(.*\), [R]`,`CMPW\t[$]` + // arm64:`MOVHU\t\(.*\), [R]`,`MOVD\t[$]`,`CMPW\tR` // ppc64le:`MOVHZ\t\(.*\), [R]`,`CMPW\t.*, [$]` // s390x:`MOVHBR\t\(.*\), [R]`,`CMPW\t.*, [$]` return s == "xx" @@ -327,12 +327,12 @@ func CmpToZero_ex1(a int64, e int32) int { return 3 } - // arm64:`CMP|CMN`,-`(ADD|SUB)`,`(BMI|BPL)` + // arm64:`SUB`,`TBZ` if a-11 >= 0 { return 4 } - // arm64:`CMP|CMN`,-`(ADD|SUB)`,`BEQ`,`(BMI|BPL)` + // arm64:`SUB`,`CMP`,`BGT` if a-19 > 0 { return 4 } @@ -355,7 +355,7 @@ func CmpToZero_ex1(a int64, e int32) int { return 7 } - // arm64:`CMPW|CMNW`,`(BMI|BPL)` + // arm64:`SUB`,`TBNZ` // arm:`CMP|CMN`, -`(ADD|SUB)`, `(BMI|BPL)` if e-11 >= 0 { return 8 diff --git a/test/codegen/switch.go b/test/codegen/switch.go index c3c24e2e11..603e0befbb 100644 --- a/test/codegen/switch.go +++ b/test/codegen/switch.go @@ -80,19 +80,19 @@ func mimetype(ext string) string { // arm64: `MOVB\s1\(R.*\), R.*$`, `CMPW\s\$104, R.*$`, -`cmpstring` switch ext { // amd64: `CMPL\s\(.*\), \$1836345390$` - // arm64: `CMPW\s\$1836345390, R.*$` + // arm64: `MOVD\s\$1836345390`, `CMPW\sR.*, R.*$` case ".htm": return "A" // amd64: `CMPL\s\(.*\), \$1953457454$` - // arm64: `CMPW\s\$1953457454, R.*$` + // arm64: `MOVD\s\$1953457454`, `CMPW\sR.*, R.*$` case ".eot": return "B" // amd64: `CMPL\s\(.*\), \$1735815982$` - // arm64: `CMPW\s\$1735815982, R.*$` + // arm64: `MOVD\s\$1735815982`, `CMPW\sR.*, R.*$` case ".svg": return "C" // amd64: `CMPL\s\(.*\), \$1718907950$` - // arm64: `CMPW\s\$1718907950, R.*$` + // arm64: `MOVD\s\$1718907950`, `CMPW\sR.*, R.*$` case ".ttf": return "D" default: |
