test/codegen: simplify asmcheck pattern matching

Separate patterns in asmcheck by spaces instead of commas.
Many patterns end in comma (like "MOV [$]123,") so separating
patterns by comma is not great; they're already quoted, so spaces are fine.

Also replace all tabs in the assembly lines with spaces before matching.
Finally, replace \$ or \\$ with [$] as the matching idiom.
The effect of all these is to make the patterns look like:

  	   // amd64:"BSFQ" "ORQ [$]256"

instead of the old:

  	   // amd64:"BSFQ","ORQ\t\\$256"

Update all tests as well.

Change-Id: Ia39febe5d7f67ba115846422789e11b185d5c807
Reviewed-on: https://go-review.googlesource.com/c/go/+/716060
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
This commit is contained in:
Russ Cox 2025-10-26 22:51:14 -04:00
parent 32ee3f3f73
commit 915c1839fe
48 changed files with 2035 additions and 2032 deletions

View file

@ -1488,7 +1488,7 @@ var (
// "\s*,\s*` matches " , " // "\s*,\s*` matches " , "
// second reMatchCheck matches "`SUB`" // second reMatchCheck matches "`SUB`"
// ")*)" closes started groups; "*" means that there might be other elements in the comma-separated list // ")*)" closes started groups; "*" means that there might be other elements in the comma-separated list
rxAsmPlatform = regexp.MustCompile(`(\w+)(/[\w.]+)?(/\w*)?\s*:\s*(` + reMatchCheck + `(?:\s*,\s*` + reMatchCheck + `)*)`) rxAsmPlatform = regexp.MustCompile(`(\w+)(/[\w.]+)?(/\w*)?\s*:\s*(` + reMatchCheck + `(?:\s+` + reMatchCheck + `)*)`)
// Regexp to extract a single opcoded check // Regexp to extract a single opcoded check
rxAsmCheck = regexp.MustCompile(reMatchCheck) rxAsmCheck = regexp.MustCompile(reMatchCheck)
@ -1701,6 +1701,9 @@ func (t test) asmCheck(outStr string, fn string, env buildEnv, fullops map[strin
} }
srcFileLine, asm := matches[1], matches[2] srcFileLine, asm := matches[1], matches[2]
// Replace tabs with single spaces to make matches easier to write.
asm = strings.ReplaceAll(asm, "\t", " ")
// Associate the original file/line information to the current // Associate the original file/line information to the current
// function in the output; it will be useful to dump it in case // function in the output; it will be useful to dump it in case
// of error. // of error.
@ -1752,11 +1755,11 @@ func (t test) asmCheck(outStr string, fn string, env buildEnv, fullops map[strin
} }
if o.negative { if o.negative {
fmt.Fprintf(&errbuf, "%s:%d: %s: wrong opcode found: %q\n", t.goFileName(), o.line, env, o.opcode.String()) fmt.Fprintf(&errbuf, "%s:%d: %s: wrong opcode found: %#q\n", t.goFileName(), o.line, env, o.opcode.String())
} else if o.expected > 0 { } else if o.expected > 0 {
fmt.Fprintf(&errbuf, "%s:%d: %s: wrong number of opcodes: %q\n", t.goFileName(), o.line, env, o.opcode.String()) fmt.Fprintf(&errbuf, "%s:%d: %s: wrong number of opcodes: %#q\n", t.goFileName(), o.line, env, o.opcode.String())
} else { } else {
fmt.Fprintf(&errbuf, "%s:%d: %s: opcode not found: %q\n", t.goFileName(), o.line, env, o.opcode.String()) fmt.Fprintf(&errbuf, "%s:%d: %s: opcode not found: %#q\n", t.goFileName(), o.line, env, o.opcode.String())
} }
} }
return errors.New(errbuf.String()) return errors.New(errbuf.String())

View file

@ -9,6 +9,6 @@ package codegen
// Make sure we use ADDQ instead of LEAQ when we can. // Make sure we use ADDQ instead of LEAQ when we can.
func f(p *[4][2]int, x int) *int { func f(p *[4][2]int, x int) *int {
// amd64:"ADDQ",-"LEAQ" // amd64:"ADDQ" -"LEAQ"
return &p[x][0] return &p[x][0]
} }

View file

@ -10,28 +10,28 @@
package codegen package codegen
func zeroAllocNew1() *struct{} { func zeroAllocNew1() *struct{} {
// 386:-`CALL\truntime\.newobject`, `LEAL\truntime.zerobase` // 386:-`CALL runtime\.newobject`, `LEAL runtime.zerobase`
// amd64:-`CALL\truntime\.newobject`, `LEAQ\truntime.zerobase` // amd64:-`CALL runtime\.newobject`, `LEAQ runtime.zerobase`
// arm:-`CALL\truntime\.newobject`, `MOVW\t[$]runtime.zerobase` // arm:-`CALL runtime\.newobject`, `MOVW [$]runtime.zerobase`
// arm64:-`CALL\truntime\.newobject`, `MOVD\t[$]runtime.zerobase` // arm64:-`CALL runtime\.newobject`, `MOVD [$]runtime.zerobase`
// riscv64:-`CALL\truntime\.newobject`, `MOV\t[$]runtime.zerobase` // riscv64:-`CALL runtime\.newobject`, `MOV [$]runtime.zerobase`
return new(struct{}) return new(struct{})
} }
func zeroAllocNew2() *[0]int { func zeroAllocNew2() *[0]int {
// 386:-`CALL\truntime\.newobject`, `LEAL\truntime.zerobase` // 386:-`CALL runtime\.newobject`, `LEAL runtime.zerobase`
// amd64:-`CALL\truntime\.newobject`, `LEAQ\truntime.zerobase` // amd64:-`CALL runtime\.newobject`, `LEAQ runtime.zerobase`
// arm:-`CALL\truntime\.newobject`, `MOVW\t[$]runtime.zerobase` // arm:-`CALL runtime\.newobject`, `MOVW [$]runtime.zerobase`
// arm64:-`CALL\truntime\.newobject`, `MOVD\t[$]runtime.zerobase` // arm64:-`CALL runtime\.newobject`, `MOVD [$]runtime.zerobase`
// riscv64:-`CALL\truntime\.newobject`, `MOV\t[$]runtime.zerobase` // riscv64:-`CALL runtime\.newobject`, `MOV [$]runtime.zerobase`
return new([0]int) return new([0]int)
} }
func zeroAllocSliceLit() []int { func zeroAllocSliceLit() []int {
// 386:-`CALL\truntime\.newobject`, `LEAL\truntime.zerobase` // 386:-`CALL runtime\.newobject`, `LEAL runtime.zerobase`
// amd64:-`CALL\truntime\.newobject`, `LEAQ\truntime.zerobase` // amd64:-`CALL runtime\.newobject`, `LEAQ runtime.zerobase`
// arm:-`CALL\truntime\.newobject`, `MOVW\t[$]runtime.zerobase` // arm:-`CALL runtime\.newobject`, `MOVW [$]runtime.zerobase`
// arm64:-`CALL\truntime\.newobject`, `MOVD\t[$]runtime.zerobase` // arm64:-`CALL runtime\.newobject`, `MOVD [$]runtime.zerobase`
// riscv64:-`CALL\truntime\.newobject`, `MOV\t[$]runtime.zerobase` // riscv64:-`CALL runtime\.newobject`, `MOV [$]runtime.zerobase`
return []int{} return []int{}
} }

View file

@ -15,44 +15,44 @@ package codegen
// ----------------- // // ----------------- //
func AddLargeConst(a uint64, out []uint64) { func AddLargeConst(a uint64, out []uint64) {
// ppc64x/power10:"ADD\t[$]4294967296," // ppc64x/power10:"ADD [$]4294967296,"
// ppc64x/power9:"MOVD\t[$]1", "SLD\t[$]32" "ADD\tR[0-9]*" // ppc64x/power9:"MOVD [$]1", "SLD [$]32" "ADD R[0-9]*"
// ppc64x/power8:"MOVD\t[$]1", "SLD\t[$]32" "ADD\tR[0-9]*" // ppc64x/power8:"MOVD [$]1", "SLD [$]32" "ADD R[0-9]*"
out[0] = a + 0x100000000 out[0] = a + 0x100000000
// ppc64x/power10:"ADD\t[$]-8589934592," // ppc64x/power10:"ADD [$]-8589934592,"
// ppc64x/power9:"MOVD\t[$]-1", "SLD\t[$]33" "ADD\tR[0-9]*" // ppc64x/power9:"MOVD [$]-1", "SLD [$]33" "ADD R[0-9]*"
// ppc64x/power8:"MOVD\t[$]-1", "SLD\t[$]33" "ADD\tR[0-9]*" // ppc64x/power8:"MOVD [$]-1", "SLD [$]33" "ADD R[0-9]*"
out[1] = a + 0xFFFFFFFE00000000 out[1] = a + 0xFFFFFFFE00000000
// ppc64x/power10:"ADD\t[$]1234567," // ppc64x/power10:"ADD [$]1234567,"
// ppc64x/power9:"ADDIS\t[$]19,", "ADD\t[$]-10617," // ppc64x/power9:"ADDIS [$]19,", "ADD [$]-10617,"
// ppc64x/power8:"ADDIS\t[$]19,", "ADD\t[$]-10617," // ppc64x/power8:"ADDIS [$]19,", "ADD [$]-10617,"
out[2] = a + 1234567 out[2] = a + 1234567
// ppc64x/power10:"ADD\t[$]-1234567," // ppc64x/power10:"ADD [$]-1234567,"
// ppc64x/power9:"ADDIS\t[$]-19,", "ADD\t[$]10617," // ppc64x/power9:"ADDIS [$]-19,", "ADD [$]10617,"
// ppc64x/power8:"ADDIS\t[$]-19,", "ADD\t[$]10617," // ppc64x/power8:"ADDIS [$]-19,", "ADD [$]10617,"
out[3] = a - 1234567 out[3] = a - 1234567
// ppc64x/power10:"ADD\t[$]2147450879," // ppc64x/power10:"ADD [$]2147450879,"
// ppc64x/power9:"ADDIS\t[$]32767,", "ADD\t[$]32767," // ppc64x/power9:"ADDIS [$]32767,", "ADD [$]32767,"
// ppc64x/power8:"ADDIS\t[$]32767,", "ADD\t[$]32767," // ppc64x/power8:"ADDIS [$]32767,", "ADD [$]32767,"
out[4] = a + 0x7FFF7FFF out[4] = a + 0x7FFF7FFF
// ppc64x/power10:"ADD\t[$]-2147483647," // ppc64x/power10:"ADD [$]-2147483647,"
// ppc64x/power9:"ADDIS\t[$]-32768,", "ADD\t[$]1," // ppc64x/power9:"ADDIS [$]-32768,", "ADD [$]1,"
// ppc64x/power8:"ADDIS\t[$]-32768,", "ADD\t[$]1," // ppc64x/power8:"ADDIS [$]-32768,", "ADD [$]1,"
out[5] = a - 2147483647 out[5] = a - 2147483647
// ppc64x:"ADDIS\t[$]-32768,", ^"ADD\t" // ppc64x:"ADDIS [$]-32768,", ^"ADD "
out[6] = a - 2147483648 out[6] = a - 2147483648
// ppc64x:"ADD\t[$]2147450880,", ^"ADDIS\t" // ppc64x:"ADD [$]2147450880,", ^"ADDIS "
out[7] = a + 0x7FFF8000 out[7] = a + 0x7FFF8000
// ppc64x:"ADD\t[$]-32768,", ^"ADDIS\t" // ppc64x:"ADD [$]-32768,", ^"ADDIS "
out[8] = a - 32768 out[8] = a - 32768
// ppc64x/power10:"ADD\t[$]-32769," // ppc64x/power10:"ADD [$]-32769,"
// ppc64x/power9:"ADDIS\t[$]-1,", "ADD\t[$]32767," // ppc64x/power9:"ADDIS [$]-1,", "ADD [$]32767,"
// ppc64x/power8:"ADDIS\t[$]-1,", "ADD\t[$]32767," // ppc64x/power8:"ADDIS [$]-1,", "ADD [$]32767,"
out[9] = a - 32769 out[9] = a - 32769
} }
func AddLargeConst2(a int, out []int) { func AddLargeConst2(a int, out []int) {
// loong64: -"ADDVU","ADDV16" // loong64: -"ADDVU" "ADDV16"
out[0] = a + 0x10000 out[0] = a + 0x10000
} }
@ -83,65 +83,65 @@ func SubMem(arr []int, b, c, d int) int {
arr[b]-- arr[b]--
// amd64:`DECQ\s64\([A-Z]+\)` // amd64:`DECQ\s64\([A-Z]+\)`
arr[8]-- arr[8]--
// 386:"SUBL\t4" // 386:"SUBL 4"
// amd64:"SUBQ\t8" // amd64:"SUBQ 8"
return arr[0] - arr[1] return arr[0] - arr[1]
} }
func SubFromConst(a int) int { func SubFromConst(a int) int {
// ppc64x: `SUBC\tR[0-9]+,\s[$]40,\sR` // ppc64x: `SUBC R[0-9]+,\s[$]40,\sR`
// riscv64: "ADDI\t\\$-40","NEG" // riscv64: "ADDI \\$-40" "NEG"
b := 40 - a b := 40 - a
return b return b
} }
func SubFromConstNeg(a int) int { func SubFromConstNeg(a int) int {
// arm64: "ADD\t\\$40" // arm64: "ADD \\$40"
// loong64: "ADDV[U]\t\\$40" // loong64: "ADDV[U] \\$40"
// mips: "ADD[U]\t\\$40" // mips: "ADD[U] \\$40"
// mips64: "ADDV[U]\t\\$40" // mips64: "ADDV[U] \\$40"
// ppc64x: `ADD\t[$]40,\sR[0-9]+,\sR` // ppc64x: `ADD [$]40,\sR[0-9]+,\sR`
// riscv64: "ADDI\t\\$40",-"NEG" // riscv64: "ADDI \\$40" -"NEG"
c := 40 - (-a) c := 40 - (-a)
return c return c
} }
func SubSubFromConst(a int) int { func SubSubFromConst(a int) int {
// arm64: "ADD\t\\$20" // arm64: "ADD \\$20"
// loong64: "ADDV[U]\t\\$20" // loong64: "ADDV[U] \\$20"
// mips: "ADD[U]\t\\$20" // mips: "ADD[U] \\$20"
// mips64: "ADDV[U]\t\\$20" // mips64: "ADDV[U] \\$20"
// ppc64x: `ADD\t[$]20,\sR[0-9]+,\sR` // ppc64x: `ADD [$]20,\sR[0-9]+,\sR`
// riscv64: "ADDI\t\\$20",-"NEG" // riscv64: "ADDI \\$20" -"NEG"
c := 40 - (20 - a) c := 40 - (20 - a)
return c return c
} }
func AddSubFromConst(a int) int { func AddSubFromConst(a int) int {
// ppc64x: `SUBC\tR[0-9]+,\s[$]60,\sR` // ppc64x: `SUBC R[0-9]+,\s[$]60,\sR`
// riscv64: "ADDI\t\\$-60","NEG" // riscv64: "ADDI \\$-60" "NEG"
c := 40 + (20 - a) c := 40 + (20 - a)
return c return c
} }
func NegSubFromConst(a int) int { func NegSubFromConst(a int) int {
// arm64: "SUB\t\\$20" // arm64: "SUB \\$20"
// loong64: "ADDV[U]\t\\$-20" // loong64: "ADDV[U] \\$-20"
// mips: "ADD[U]\t\\$-20" // mips: "ADD[U] \\$-20"
// mips64: "ADDV[U]\t\\$-20" // mips64: "ADDV[U] \\$-20"
// ppc64x: `ADD\t[$]-20,\sR[0-9]+,\sR` // ppc64x: `ADD [$]-20,\sR[0-9]+,\sR`
// riscv64: "ADDI\t\\$-20" // riscv64: "ADDI \\$-20"
c := -(20 - a) c := -(20 - a)
return c return c
} }
func NegAddFromConstNeg(a int) int { func NegAddFromConstNeg(a int) int {
// arm64: "SUB\t\\$40","NEG" // arm64: "SUB \\$40" "NEG"
// loong64: "ADDV[U]\t\\$-40","SUBV" // loong64: "ADDV[U] \\$-40" "SUBV"
// mips: "ADD[U]\t\\$-40","SUB" // mips: "ADD[U] \\$-40" "SUB"
// mips64: "ADDV[U]\t\\$-40","SUBV" // mips64: "ADDV[U] \\$-40" "SUBV"
// ppc64x: `SUBC\tR[0-9]+,\s[$]40,\sR` // ppc64x: `SUBC R[0-9]+,\s[$]40,\sR`
// riscv64: "ADDI\t\\$-40","NEG" // riscv64: "ADDI \\$-40" "NEG"
c := -(-40 + a) c := -(-40 + a)
return c return c
} }
@ -153,19 +153,19 @@ func SubSubNegSimplify(a, b int) int {
// mips:"SUB" // mips:"SUB"
// mips64:"SUBV" // mips64:"SUBV"
// ppc64x:"NEG" // ppc64x:"NEG"
// riscv64:"NEG",-"SUB" // riscv64:"NEG" -"SUB"
r := (a - b) - a r := (a - b) - a
return r return r
} }
func SubAddSimplify(a, b int) int { func SubAddSimplify(a, b int) int {
// amd64:-"SUBQ",-"ADDQ" // amd64:-"SUBQ" -"ADDQ"
// arm64:-"SUB",-"ADD" // arm64:-"SUB" -"ADD"
// loong64:-"SUBV",-"ADDV" // loong64:-"SUBV" -"ADDV"
// mips:-"SUB",-"ADD" // mips:-"SUB" -"ADD"
// mips64:-"SUBV",-"ADDV" // mips64:-"SUBV" -"ADDV"
// ppc64x:-"SUB",-"ADD" // ppc64x:-"SUB" -"ADD"
// riscv64:-"SUB",-"ADD" // riscv64:-"SUB" -"ADD"
r := a + (b - a) r := a + (b - a)
return r return r
} }
@ -173,9 +173,9 @@ func SubAddSimplify(a, b int) int {
func SubAddSimplify2(a, b, c int) (int, int, int, int, int, int) { func SubAddSimplify2(a, b, c int) (int, int, int, int, int, int) {
// amd64:-"ADDQ" // amd64:-"ADDQ"
// arm64:-"ADD" // arm64:-"ADD"
// mips:"SUB",-"ADD" // mips:"SUB" -"ADD"
// mips64:"SUBV",-"ADDV" // mips64:"SUBV" -"ADDV"
// loong64:"SUBV",-"ADDV" // loong64:"SUBV" -"ADDV"
r := (a + b) - (a + c) r := (a + b) - (a + c)
// amd64:-"ADDQ" // amd64:-"ADDQ"
r1 := (a + b) - (c + a) r1 := (a + b) - (c + a)
@ -185,9 +185,9 @@ func SubAddSimplify2(a, b, c int) (int, int, int, int, int, int) {
r3 := (b + a) - (c + a) r3 := (b + a) - (c + a)
// amd64:-"SUBQ" // amd64:-"SUBQ"
// arm64:-"SUB" // arm64:-"SUB"
// mips:"ADD",-"SUB" // mips:"ADD" -"SUB"
// mips64:"ADDV",-"SUBV" // mips64:"ADDV" -"SUBV"
// loong64:"ADDV",-"SUBV" // loong64:"ADDV" -"SUBV"
r4 := (a - c) + (c + b) r4 := (a - c) + (c + b)
// amd64:-"SUBQ" // amd64:-"SUBQ"
r5 := (a - c) + (b + c) r5 := (a - c) + (b + c)
@ -195,31 +195,31 @@ func SubAddSimplify2(a, b, c int) (int, int, int, int, int, int) {
} }
func SubAddNegSimplify(a, b int) int { func SubAddNegSimplify(a, b int) int {
// amd64:"NEGQ",-"ADDQ",-"SUBQ" // amd64:"NEGQ" -"ADDQ" -"SUBQ"
// arm64:"NEG",-"ADD",-"SUB" // arm64:"NEG" -"ADD" -"SUB"
// loong64:"SUBV",-"ADDV" // loong64:"SUBV" -"ADDV"
// mips:"SUB",-"ADD" // mips:"SUB" -"ADD"
// mips64:"SUBV",-"ADDV" // mips64:"SUBV" -"ADDV"
// ppc64x:"NEG",-"ADD",-"SUB" // ppc64x:"NEG" -"ADD" -"SUB"
// riscv64:"NEG",-"ADD",-"SUB" // riscv64:"NEG" -"ADD" -"SUB"
r := a - (b + a) r := a - (b + a)
return r return r
} }
func AddAddSubSimplify(a, b, c int) int { func AddAddSubSimplify(a, b, c int) int {
// amd64:-"SUBQ" // amd64:-"SUBQ"
// arm64:"ADD",-"SUB" // arm64:"ADD" -"SUB"
// loong64:"ADDV",-"SUBV" // loong64:"ADDV" -"SUBV"
// mips:"ADD",-"SUB" // mips:"ADD" -"SUB"
// mips64:"ADDV",-"SUBV" // mips64:"ADDV" -"SUBV"
// ppc64x:-"SUB" // ppc64x:-"SUB"
// riscv64:"ADD","ADD",-"SUB" // riscv64:"ADD" "ADD" -"SUB"
r := a + (b + (c - a)) r := a + (b + (c - a))
return r return r
} }
func NegToInt32(a int) int { func NegToInt32(a int) int {
// riscv64: "NEGW",-"MOVW" // riscv64: "NEGW" -"MOVW"
r := int(int32(-a)) r := int(int32(-a))
return r return r
} }
@ -229,20 +229,20 @@ func NegToInt32(a int) int {
// -------------------- // // -------------------- //
func Pow2Muls(n1, n2 int) (int, int) { func Pow2Muls(n1, n2 int) (int, int) {
// amd64:"SHLQ\t[$]5",-"IMULQ" // amd64:"SHLQ [$]5" -"IMULQ"
// 386:"SHLL\t[$]5",-"IMULL" // 386:"SHLL [$]5" -"IMULL"
// arm:"SLL\t[$]5",-"MUL" // arm:"SLL [$]5" -"MUL"
// arm64:"LSL\t[$]5",-"MUL" // arm64:"LSL [$]5" -"MUL"
// loong64:"SLLV\t[$]5",-"MULV" // loong64:"SLLV [$]5" -"MULV"
// ppc64x:"SLD\t[$]5",-"MUL" // ppc64x:"SLD [$]5" -"MUL"
a := n1 * 32 a := n1 * 32
// amd64:"SHLQ\t[$]6",-"IMULQ" // amd64:"SHLQ [$]6" -"IMULQ"
// 386:"SHLL\t[$]6",-"IMULL" // 386:"SHLL [$]6" -"IMULL"
// arm:"SLL\t[$]6",-"MUL" // arm:"SLL [$]6" -"MUL"
// arm64:`NEG\sR[0-9]+<<6,\sR[0-9]+`,-`LSL`,-`MUL` // arm64:`NEG\sR[0-9]+<<6,\sR[0-9]+`,-`LSL`,-`MUL`
// loong64:"SLLV\t[$]6",-"MULV" // loong64:"SLLV [$]6" -"MULV"
// ppc64x:"SLD\t[$]6","NEG\\sR[0-9]+,\\sR[0-9]+",-"MUL" // ppc64x:"SLD [$]6" "NEG\\sR[0-9]+,\\sR[0-9]+" -"MUL"
b := -64 * n2 b := -64 * n2
return a, b return a, b
@ -258,18 +258,18 @@ func Mul_2(n1 int32, n2 int64) (int32, int64) {
} }
func Mul_96(n int) int { func Mul_96(n int) int {
// amd64:`SHLQ\t[$]5`,`LEAQ\t\(.*\)\(.*\*2\),`,-`IMULQ` // amd64:`SHLQ [$]5`,`LEAQ \(.*\)\(.*\*2\),`,-`IMULQ`
// 386:`SHLL\t[$]5`,`LEAL\t\(.*\)\(.*\*2\),`,-`IMULL` // 386:`SHLL [$]5`,`LEAL \(.*\)\(.*\*2\),`,-`IMULL`
// arm64:`LSL\t[$]5`,`ADD\sR[0-9]+<<1,\sR[0-9]+`,-`MUL` // arm64:`LSL [$]5`,`ADD\sR[0-9]+<<1,\sR[0-9]+`,-`MUL`
// arm:`SLL\t[$]5`,`ADD\sR[0-9]+<<1,\sR[0-9]+`,-`MUL` // arm:`SLL [$]5`,`ADD\sR[0-9]+<<1,\sR[0-9]+`,-`MUL`
// loong64:"SLLV\t[$]5","ALSLV\t[$]1," // loong64:"SLLV [$]5" "ALSLV [$]1,"
// s390x:`SLD\t[$]5`,`SLD\t[$]6`,-`MULLD` // s390x:`SLD [$]5`,`SLD [$]6`,-`MULLD`
return n * 96 return n * 96
} }
func Mul_n120(n int) int { func Mul_n120(n int) int {
// loong64:"SLLV\t[$]3","SLLV\t[$]7","SUBVU",-"MULV" // loong64:"SLLV [$]3" "SLLV [$]7" "SUBVU" -"MULV"
// s390x:`SLD\t[$]3`,`SLD\t[$]7`,-`MULLD` // s390x:`SLD [$]3`,`SLD [$]7`,-`MULLD`
return n * -120 return n * -120
} }
@ -284,50 +284,50 @@ func MulMemSrc(a []uint32, b []float32) {
// Multiplications merging tests // Multiplications merging tests
func MergeMuls1(n int) int { func MergeMuls1(n int) int {
// amd64:"IMUL3Q\t[$]46" // amd64:"IMUL3Q [$]46"
// 386:"IMUL3L\t[$]46" // 386:"IMUL3L [$]46"
// ppc64x:"MULLD\t[$]46" // ppc64x:"MULLD [$]46"
return 15*n + 31*n // 46n return 15*n + 31*n // 46n
} }
func MergeMuls2(n int) int { func MergeMuls2(n int) int {
// amd64:"IMUL3Q\t[$]23","(ADDQ\t[$]29)|(LEAQ\t29)" // amd64:"IMUL3Q [$]23" "(ADDQ [$]29)|(LEAQ 29)"
// 386:"IMUL3L\t[$]23","ADDL\t[$]29" // 386:"IMUL3L [$]23" "ADDL [$]29"
// ppc64x/power9:"MADDLD",-"MULLD\t[$]23",-"ADD\t[$]29" // ppc64x/power9:"MADDLD" -"MULLD [$]23" -"ADD [$]29"
// ppc64x/power8:"MULLD\t[$]23","ADD\t[$]29" // ppc64x/power8:"MULLD [$]23" "ADD [$]29"
return 5*n + 7*(n+1) + 11*(n+2) // 23n + 29 return 5*n + 7*(n+1) + 11*(n+2) // 23n + 29
} }
func MergeMuls3(a, n int) int { func MergeMuls3(a, n int) int {
// amd64:"ADDQ\t[$]19",-"IMULQ\t[$]19" // amd64:"ADDQ [$]19" -"IMULQ [$]19"
// 386:"ADDL\t[$]19",-"IMULL\t[$]19" // 386:"ADDL [$]19" -"IMULL [$]19"
// ppc64x:"ADD\t[$]19",-"MULLD\t[$]19" // ppc64x:"ADD [$]19" -"MULLD [$]19"
return a*n + 19*n // (a+19)n return a*n + 19*n // (a+19)n
} }
func MergeMuls4(n int) int { func MergeMuls4(n int) int {
// amd64:"IMUL3Q\t[$]14" // amd64:"IMUL3Q [$]14"
// 386:"IMUL3L\t[$]14" // 386:"IMUL3L [$]14"
// ppc64x:"MULLD\t[$]14" // ppc64x:"MULLD [$]14"
return 23*n - 9*n // 14n return 23*n - 9*n // 14n
} }
func MergeMuls5(a, n int) int { func MergeMuls5(a, n int) int {
// amd64:"ADDQ\t[$]-19",-"IMULQ\t[$]19" // amd64:"ADDQ [$]-19" -"IMULQ [$]19"
// 386:"ADDL\t[$]-19",-"IMULL\t[$]19" // 386:"ADDL [$]-19" -"IMULL [$]19"
// ppc64x:"ADD\t[$]-19",-"MULLD\t[$]19" // ppc64x:"ADD [$]-19" -"MULLD [$]19"
return a*n - 19*n // (a-19)n return a*n - 19*n // (a-19)n
} }
// Multiplications folded negation // Multiplications folded negation
func FoldNegMul(a int) int { func FoldNegMul(a int) int {
// loong64:"SUBVU","ALSLV\t[$]2","ALSLV\t[$]1" // loong64:"SUBVU" "ALSLV [$]2" "ALSLV [$]1"
return (-a) * 11 return (-a) * 11
} }
func Fold2NegMul(a, b int) int { func Fold2NegMul(a, b int) int {
// loong64:"MULV",-"SUBVU\tR[0-9], R0," // loong64:"MULV" -"SUBVU R[0-9], R0,"
return (-a) * (-b) return (-a) * (-b)
} }
@ -342,17 +342,17 @@ func DivMemSrc(a []float64) {
} }
func Pow2Divs(n1 uint, n2 int) (uint, int) { func Pow2Divs(n1 uint, n2 int) (uint, int) {
// 386:"SHRL\t[$]5",-"DIVL" // 386:"SHRL [$]5" -"DIVL"
// amd64:"SHRQ\t[$]5",-"DIVQ" // amd64:"SHRQ [$]5" -"DIVQ"
// arm:"SRL\t[$]5",-".*udiv" // arm:"SRL [$]5" -".*udiv"
// arm64:"LSR\t[$]5",-"UDIV" // arm64:"LSR [$]5" -"UDIV"
// ppc64x:"SRD" // ppc64x:"SRD"
a := n1 / 32 // unsigned a := n1 / 32 // unsigned
// amd64:"SARQ\t[$]6",-"IDIVQ" // amd64:"SARQ [$]6" -"IDIVQ"
// 386:"SARL\t[$]6",-"IDIVL" // 386:"SARL [$]6" -"IDIVL"
// arm:"SRA\t[$]6",-".*udiv" // arm:"SRA [$]6" -".*udiv"
// arm64:"ASR\t[$]6",-"SDIV" // arm64:"ASR [$]6" -"SDIV"
// ppc64x:"SRAD" // ppc64x:"SRAD"
b := n2 / 64 // signed b := n2 / 64 // signed
@ -361,14 +361,14 @@ func Pow2Divs(n1 uint, n2 int) (uint, int) {
// Check that constant divisions get turned into MULs // Check that constant divisions get turned into MULs
func ConstDivs(n1 uint, n2 int) (uint, int) { func ConstDivs(n1 uint, n2 int) (uint, int) {
// amd64:"MOVQ\t[$]-1085102592571150095","MULQ",-"DIVQ" // amd64:"MOVQ [$]-1085102592571150095" "MULQ" -"DIVQ"
// 386:"MOVL\t[$]-252645135","MULL",-"DIVL" // 386:"MOVL [$]-252645135" "MULL" -"DIVL"
// arm64:`MOVD`,`UMULH`,-`DIV` // arm64:`MOVD`,`UMULH`,-`DIV`
// arm:`MOVW`,`MUL`,-`.*udiv` // arm:`MOVW`,`MUL`,-`.*udiv`
a := n1 / 17 // unsigned a := n1 / 17 // unsigned
// amd64:"MOVQ\t[$]-1085102592571150095","IMULQ",-"IDIVQ" // amd64:"MOVQ [$]-1085102592571150095" "IMULQ" -"IDIVQ"
// 386:"MOVL\t[$]-252645135","IMULL",-"IDIVL" // 386:"IMULL" -"IDIVL"
// arm64:`SMULH`,-`DIV` // arm64:`SMULH`,-`DIV`
// arm:`MOVW`,`MUL`,-`.*udiv` // arm:`MOVW`,`MUL`,-`.*udiv`
b := n2 / 17 // signed b := n2 / 17 // signed
@ -383,17 +383,17 @@ func FloatDivs(a []float32) float32 {
} }
func Pow2Mods(n1 uint, n2 int) (uint, int) { func Pow2Mods(n1 uint, n2 int) (uint, int) {
// 386:"ANDL\t[$]31",-"DIVL" // 386:"ANDL [$]31" -"DIVL"
// amd64:"ANDL\t[$]31",-"DIVQ" // amd64:"ANDL [$]31" -"DIVQ"
// arm:"AND\t[$]31",-".*udiv" // arm:"AND [$]31" -".*udiv"
// arm64:"AND\t[$]31",-"UDIV" // arm64:"AND [$]31" -"UDIV"
// ppc64x:"RLDICL" // ppc64x:"RLDICL"
a := n1 % 32 // unsigned a := n1 % 32 // unsigned
// 386:"SHRL",-"IDIVL" // 386:"SHRL" -"IDIVL"
// amd64:"SHRQ",-"IDIVQ" // amd64:"SHRQ" -"IDIVQ"
// arm:"SRA",-".*udiv" // arm:"SRA" -".*udiv"
// arm64:"ASR",-"REM" // arm64:"ASR" -"REM"
// ppc64x:"SRAD" // ppc64x:"SRAD"
b := n2 % 64 // signed b := n2 % 64 // signed
@ -402,18 +402,18 @@ func Pow2Mods(n1 uint, n2 int) (uint, int) {
// Check that signed divisibility checks get converted to AND on low bits // Check that signed divisibility checks get converted to AND on low bits
func Pow2DivisibleSigned(n1, n2 int) (bool, bool) { func Pow2DivisibleSigned(n1, n2 int) (bool, bool) {
// 386:"TESTL\t[$]63",-"DIVL",-"SHRL" // 386:"TESTL [$]63" -"DIVL" -"SHRL"
// amd64:"TESTQ\t[$]63",-"DIVQ",-"SHRQ" // amd64:"TESTQ [$]63" -"DIVQ" -"SHRQ"
// arm:"AND\t[$]63",-".*udiv",-"SRA" // arm:"AND [$]63" -".*udiv" -"SRA"
// arm64:"TST\t[$]63",-"UDIV",-"ASR",-"AND" // arm64:"TST [$]63" -"UDIV" -"ASR" -"AND"
// ppc64x:"ANDCC",-"RLDICL",-"SRAD",-"CMP" // ppc64x:"ANDCC" -"RLDICL" -"SRAD" -"CMP"
a := n1%64 == 0 // signed divisible a := n1%64 == 0 // signed divisible
// 386:"TESTL\t[$]63",-"DIVL",-"SHRL" // 386:"TESTL [$]63" -"DIVL" -"SHRL"
// amd64:"TESTQ\t[$]63",-"DIVQ",-"SHRQ" // amd64:"TESTQ [$]63" -"DIVQ" -"SHRQ"
// arm:"AND\t[$]63",-".*udiv",-"SRA" // arm:"AND [$]63" -".*udiv" -"SRA"
// arm64:"TST\t[$]63",-"UDIV",-"ASR",-"AND" // arm64:"TST [$]63" -"UDIV" -"ASR" -"AND"
// ppc64x:"ANDCC",-"RLDICL",-"SRAD",-"CMP" // ppc64x:"ANDCC" -"RLDICL" -"SRAD" -"CMP"
b := n2%64 != 0 // signed indivisible b := n2%64 != 0 // signed indivisible
return a, b return a, b
@ -421,14 +421,14 @@ func Pow2DivisibleSigned(n1, n2 int) (bool, bool) {
// Check that constant modulo divs get turned into MULs // Check that constant modulo divs get turned into MULs
func ConstMods(n1 uint, n2 int) (uint, int) { func ConstMods(n1 uint, n2 int) (uint, int) {
// amd64:"MOVQ\t[$]-1085102592571150095","MULQ",-"DIVQ" // amd64:"MOVQ [$]-1085102592571150095" "MULQ" -"DIVQ"
// 386:"MOVL\t[$]-252645135","MULL",-"DIVL" // 386:"MOVL [$]-252645135" "MULL" -"DIVL"
// arm64:`MOVD`,`UMULH`,-`DIV` // arm64:`MOVD`,`UMULH`,-`DIV`
// arm:`MOVW`,`MUL`,-`.*udiv` // arm:`MOVW`,`MUL`,-`.*udiv`
a := n1 % 17 // unsigned a := n1 % 17 // unsigned
// amd64:"MOVQ\t[$]-1085102592571150095","IMULQ",-"IDIVQ" // amd64:"MOVQ [$]-1085102592571150095" "IMULQ" -"IDIVQ"
// 386:"MOVL\t[$]-252645135","IMULL",-"IDIVL" // 386: "IMULL" -"IDIVL"
// arm64:`SMULH`,-`DIV` // arm64:`SMULH`,-`DIV`
// arm:`MOVW`,`MUL`,-`.*udiv` // arm:`MOVW`,`MUL`,-`.*udiv`
b := n2 % 17 // signed b := n2 % 17 // signed
@ -438,38 +438,38 @@ func ConstMods(n1 uint, n2 int) (uint, int) {
// Check that divisibility checks x%c==0 are converted to MULs and rotates // Check that divisibility checks x%c==0 are converted to MULs and rotates
func DivisibleU(n uint) (bool, bool) { func DivisibleU(n uint) (bool, bool) {
// amd64:"MOVQ\t[$]-6148914691236517205","IMULQ","ROLQ\t[$]63",-"DIVQ" // amd64:"MOVQ [$]-6148914691236517205" "IMULQ" "ROLQ [$]63" -"DIVQ"
// 386:"IMUL3L\t[$]-1431655765","ROLL\t[$]31",-"DIVQ" // 386:"IMUL3L [$]-1431655765" "ROLL [$]31" -"DIVQ"
// arm64:"MOVD\t[$]-6148914691236517205","MOVD\t[$]3074457345618258602","MUL","ROR",-"DIV" // arm64:"MOVD [$]-6148914691236517205" "MOVD [$]3074457345618258602" "MUL" "ROR" -"DIV"
// arm:"MUL","CMP\t[$]715827882",-".*udiv" // arm:"MUL" "CMP [$]715827882" -".*udiv"
// ppc64x:"MULLD","ROTL\t[$]63" // ppc64x:"MULLD" "ROTL [$]63"
even := n%6 == 0 even := n%6 == 0
// amd64:"MOVQ\t[$]-8737931403336103397","IMULQ",-"ROLQ",-"DIVQ" // amd64:"MOVQ [$]-8737931403336103397" "IMULQ" -"ROLQ" -"DIVQ"
// 386:"IMUL3L\t[$]678152731",-"ROLL",-"DIVQ" // 386:"IMUL3L [$]678152731" -"ROLL" -"DIVQ"
// arm64:"MOVD\t[$]-8737931403336103397","MUL",-"ROR",-"DIV" // arm64:"MOVD [$]-8737931403336103397" "MUL" -"ROR" -"DIV"
// arm:"MUL","CMP\t[$]226050910",-".*udiv" // arm:"MUL" "CMP [$]226050910" -".*udiv"
// ppc64x:"MULLD",-"ROTL" // ppc64x:"MULLD" -"ROTL"
odd := n%19 == 0 odd := n%19 == 0
return even, odd return even, odd
} }
func Divisible(n int) (bool, bool) { func Divisible(n int) (bool, bool) {
// amd64:"IMULQ","ADD","ROLQ\t[$]63",-"DIVQ" // amd64:"IMULQ" "ADD" "ROLQ [$]63" -"DIVQ"
// 386:"IMUL3L\t[$]-1431655765","ADDL\t[$]715827882","ROLL\t[$]31",-"DIVQ" // 386:"IMUL3L [$]-1431655765" "ADDL [$]715827882" "ROLL [$]31" -"DIVQ"
// arm64:"MOVD\t[$]-6148914691236517205","MOVD\t[$]3074457345618258602","MUL","ADD\tR","ROR",-"DIV" // arm64:"MOVD [$]-6148914691236517205" "MOVD [$]3074457345618258602" "MUL" "ADD R" "ROR" -"DIV"
// arm:"MUL","ADD\t[$]715827882",-".*udiv" // arm:"MUL" "ADD [$]715827882" -".*udiv"
// ppc64x/power8:"MULLD","ADD","ROTL\t[$]63" // ppc64x/power8:"MULLD" "ADD" "ROTL [$]63"
// ppc64x/power9:"MADDLD","ROTL\t[$]63" // ppc64x/power9:"MADDLD" "ROTL [$]63"
even := n%6 == 0 even := n%6 == 0
// amd64:"IMULQ","ADD",-"ROLQ",-"DIVQ" // amd64:"IMULQ" "ADD" -"ROLQ" -"DIVQ"
// 386:"IMUL3L\t[$]678152731","ADDL\t[$]113025455",-"ROLL",-"DIVQ" // 386:"IMUL3L [$]678152731" "ADDL [$]113025455" -"ROLL" -"DIVQ"
// arm64:"MUL","MOVD\t[$]485440633518672410","ADD",-"ROR",-"DIV" // arm64:"MUL" "MOVD [$]485440633518672410" "ADD" -"ROR" -"DIV"
// arm:"MUL","ADD\t[$]113025455",-".*udiv" // arm:"MUL" "ADD [$]113025455" -".*udiv"
// ppc64x/power8:"MULLD","ADD",-"ROTL" // ppc64x/power8:"MULLD" "ADD" -"ROTL"
// ppc64x/power9:"MADDLD",-"ROTL" // ppc64x/power9:"MADDLD" -"ROTL"
odd := n%19 == 0 odd := n%19 == 0
return even, odd return even, odd
@ -568,64 +568,64 @@ func NoFix16B(divd int16) (int16, int16) {
// optimized into shifts and ands // optimized into shifts and ands
func LenDiv1(a []int) int { func LenDiv1(a []int) int {
// 386:"SHRL\t[$]10" // 386:"SHRL [$]10"
// amd64:"SHRQ\t[$]10" // amd64:"SHRQ [$]10"
// arm64:"LSR\t[$]10",-"SDIV" // arm64:"LSR [$]10" -"SDIV"
// arm:"SRL\t[$]10",-".*udiv" // arm:"SRL [$]10" -".*udiv"
// ppc64x:"SRD"\t[$]10" // ppc64x:"SRD" [$]10"
return len(a) / 1024 return len(a) / 1024
} }
func LenDiv2(s string) int { func LenDiv2(s string) int {
// 386:"SHRL\t[$]11" // 386:"SHRL [$]11"
// amd64:"SHRQ\t[$]11" // amd64:"SHRQ [$]11"
// arm64:"LSR\t[$]11",-"SDIV" // arm64:"LSR [$]11" -"SDIV"
// arm:"SRL\t[$]11",-".*udiv" // arm:"SRL [$]11" -".*udiv"
// ppc64x:"SRD\t[$]11" // ppc64x:"SRD [$]11"
return len(s) / (4097 >> 1) return len(s) / (4097 >> 1)
} }
func LenMod1(a []int) int { func LenMod1(a []int) int {
// 386:"ANDL\t[$]1023" // 386:"ANDL [$]1023"
// amd64:"ANDL\t[$]1023" // amd64:"ANDL [$]1023"
// arm64:"AND\t[$]1023",-"SDIV" // arm64:"AND [$]1023" -"SDIV"
// arm/6:"AND",-".*udiv" // arm/6:"AND" -".*udiv"
// arm/7:"BFC",-".*udiv",-"AND" // arm/7:"BFC" -".*udiv" -"AND"
// ppc64x:"RLDICL" // ppc64x:"RLDICL"
return len(a) % 1024 return len(a) % 1024
} }
func LenMod2(s string) int { func LenMod2(s string) int {
// 386:"ANDL\t[$]2047" // 386:"ANDL [$]2047"
// amd64:"ANDL\t[$]2047" // amd64:"ANDL [$]2047"
// arm64:"AND\t[$]2047",-"SDIV" // arm64:"AND [$]2047" -"SDIV"
// arm/6:"AND",-".*udiv" // arm/6:"AND" -".*udiv"
// arm/7:"BFC",-".*udiv",-"AND" // arm/7:"BFC" -".*udiv" -"AND"
// ppc64x:"RLDICL" // ppc64x:"RLDICL"
return len(s) % (4097 >> 1) return len(s) % (4097 >> 1)
} }
func CapDiv(a []int) int { func CapDiv(a []int) int {
// 386:"SHRL\t[$]12" // 386:"SHRL [$]12"
// amd64:"SHRQ\t[$]12" // amd64:"SHRQ [$]12"
// arm64:"LSR\t[$]12",-"SDIV" // arm64:"LSR [$]12" -"SDIV"
// arm:"SRL\t[$]12",-".*udiv" // arm:"SRL [$]12" -".*udiv"
// ppc64x:"SRD\t[$]12" // ppc64x:"SRD [$]12"
return cap(a) / ((1 << 11) + 2048) return cap(a) / ((1 << 11) + 2048)
} }
func CapMod(a []int) int { func CapMod(a []int) int {
// 386:"ANDL\t[$]4095" // 386:"ANDL [$]4095"
// amd64:"ANDL\t[$]4095" // amd64:"ANDL [$]4095"
// arm64:"AND\t[$]4095",-"SDIV" // arm64:"AND [$]4095" -"SDIV"
// arm/6:"AND",-".*udiv" // arm/6:"AND" -".*udiv"
// arm/7:"BFC",-".*udiv",-"AND" // arm/7:"BFC" -".*udiv" -"AND"
// ppc64x:"RLDICL" // ppc64x:"RLDICL"
return cap(a) % ((1 << 11) + 2048) return cap(a) % ((1 << 11) + 2048)
} }
func AddMul(x int) int { func AddMul(x int) int {
// amd64:"LEAQ\t1" // amd64:"LEAQ 1"
return 2*x + 1 return 2*x + 1
} }
@ -687,17 +687,17 @@ func divInt(v int64) int64 {
// The reassociate rules "x - (z + C) -> (x - z) - C" and // The reassociate rules "x - (z + C) -> (x - z) - C" and
// "(z + C) -x -> C + (z - x)" can optimize the following cases. // "(z + C) -x -> C + (z - x)" can optimize the following cases.
func constantFold1(i0, j0, i1, j1, i2, j2, i3, j3 int) (int, int, int, int) { func constantFold1(i0, j0, i1, j1, i2, j2, i3, j3 int) (int, int, int, int) {
// arm64:"SUB","ADD\t[$]2" // arm64:"SUB" "ADD [$]2"
// ppc64x:"SUB","ADD\t[$]2" // ppc64x:"SUB" "ADD [$]2"
r0 := (i0 + 3) - (j0 + 1) r0 := (i0 + 3) - (j0 + 1)
// arm64:"SUB","SUB\t[$]4" // arm64:"SUB" "SUB [$]4"
// ppc64x:"SUB","ADD\t[$]-4" // ppc64x:"SUB" "ADD [$]-4"
r1 := (i1 - 3) - (j1 + 1) r1 := (i1 - 3) - (j1 + 1)
// arm64:"SUB","ADD\t[$]4" // arm64:"SUB" "ADD [$]4"
// ppc64x:"SUB","ADD\t[$]4" // ppc64x:"SUB" "ADD [$]4"
r2 := (i2 + 3) - (j2 - 1) r2 := (i2 + 3) - (j2 - 1)
// arm64:"SUB","SUB\t[$]2" // arm64:"SUB" "SUB [$]2"
// ppc64x:"SUB","ADD\t[$]-2" // ppc64x:"SUB" "ADD [$]-2"
r3 := (i3 - 3) - (j3 - 1) r3 := (i3 - 3) - (j3 - 1)
return r0, r1, r2, r3 return r0, r1, r2, r3
} }
@ -705,18 +705,18 @@ func constantFold1(i0, j0, i1, j1, i2, j2, i3, j3 int) (int, int, int, int) {
// The reassociate rules "x - (z + C) -> (x - z) - C" and // The reassociate rules "x - (z + C) -> (x - z) - C" and
// "(C - z) - x -> C - (z + x)" can optimize the following cases. // "(C - z) - x -> C - (z + x)" can optimize the following cases.
func constantFold2(i0, j0, i1, j1 int) (int, int) { func constantFold2(i0, j0, i1, j1 int) (int, int) {
// arm64:"ADD","MOVD\t[$]2","SUB" // arm64:"ADD" "MOVD [$]2" "SUB"
// ppc64x: `SUBC\tR[0-9]+,\s[$]2,\sR` // ppc64x: `SUBC R[0-9]+,\s[$]2,\sR`
r0 := (3 - i0) - (j0 + 1) r0 := (3 - i0) - (j0 + 1)
// arm64:"ADD","MOVD\t[$]4","SUB" // arm64:"ADD" "MOVD [$]4" "SUB"
// ppc64x: `SUBC\tR[0-9]+,\s[$]4,\sR` // ppc64x: `SUBC R[0-9]+,\s[$]4,\sR`
r1 := (3 - i1) - (j1 - 1) r1 := (3 - i1) - (j1 - 1)
return r0, r1 return r0, r1
} }
func constantFold3(i, j int) int { func constantFold3(i, j int) int {
// arm64: "LSL\t[$]5,","SUB\tR[0-9]+<<1,",-"ADD" // arm64: "LSL [$]5," "SUB R[0-9]+<<1," -"ADD"
// ppc64x:"MULLD\t[$]30","MULLD" // ppc64x:"MULLD [$]30" "MULLD"
r := (5 * i) * (6 * j) r := (5 * i) * (6 * j)
return r return r
} }
@ -726,32 +726,32 @@ func constantFold3(i, j int) int {
// ----------------- // // ----------------- //
func Int64Min(a, b int64) int64 { func Int64Min(a, b int64) int64 {
// amd64: "CMPQ","CMOVQLT" // amd64: "CMPQ" "CMOVQLT"
// arm64: "CMP","CSEL" // arm64: "CMP" "CSEL"
// riscv64/rva20u64:"BLT\t" // riscv64/rva20u64:"BLT "
// riscv64/rva22u64,riscv64/rva23u64:"MIN\t" // riscv64/rva22u64,riscv64/rva23u64:"MIN "
return min(a, b) return min(a, b)
} }
func Int64Max(a, b int64) int64 { func Int64Max(a, b int64) int64 {
// amd64: "CMPQ","CMOVQGT" // amd64: "CMPQ" "CMOVQGT"
// arm64: "CMP","CSEL" // arm64: "CMP" "CSEL"
// riscv64/rva20u64:"BLT\t" // riscv64/rva20u64:"BLT "
// riscv64/rva22u64,riscv64/rva23u64:"MAX\t" // riscv64/rva22u64,riscv64/rva23u64:"MAX "
return max(a, b) return max(a, b)
} }
func Uint64Min(a, b uint64) uint64 { func Uint64Min(a, b uint64) uint64 {
// amd64: "CMPQ","CMOVQCS" // amd64: "CMPQ" "CMOVQCS"
// arm64: "CMP","CSEL" // arm64: "CMP" "CSEL"
// riscv64/rva20u64:"BLTU" // riscv64/rva20u64:"BLTU"
// riscv64/rva22u64,riscv64/rva23u64:"MINU" // riscv64/rva22u64,riscv64/rva23u64:"MINU"
return min(a, b) return min(a, b)
} }
func Uint64Max(a, b uint64) uint64 { func Uint64Max(a, b uint64) uint64 {
// amd64: "CMPQ","CMOVQHI" // amd64: "CMPQ" "CMOVQHI"
// arm64: "CMP","CSEL" // arm64: "CMP" "CSEL"
// riscv64/rva20u64:"BLTU" // riscv64/rva20u64:"BLTU"
// riscv64/rva22u64,riscv64/rva23u64:"MAXU" // riscv64/rva22u64,riscv64/rva23u64:"MAXU"
return max(a, b) return max(a, b)

View file

@ -22,7 +22,7 @@ func (c *Counter) Increment() {
// arm64/v8.1:"LDADDALW" // arm64/v8.1:"LDADDALW"
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// amd64:"LOCK",-"CMPXCHG" // amd64:"LOCK" -"CMPXCHG"
atomic.AddInt32(&c.count, 1) atomic.AddInt32(&c.count, 1)
} }
@ -34,13 +34,13 @@ func atomicLogical64(x *atomic.Uint64) uint64 {
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// On amd64, make sure we use LOCK+AND instead of CMPXCHG when we don't use the result. // On amd64, make sure we use LOCK+AND instead of CMPXCHG when we don't use the result.
// amd64:"LOCK",-"CMPXCHGQ" // amd64:"LOCK" -"CMPXCHGQ"
x.And(11) x.And(11)
// arm64/v8.0:"LDCLRALD" // arm64/v8.0:"LDCLRALD"
// arm64/v8.1:"LDCLRALD" // arm64/v8.1:"LDCLRALD"
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// amd64:"LOCK","CMPXCHGQ" // amd64:"LOCK" "CMPXCHGQ"
r += x.And(22) r += x.And(22)
// arm64/v8.0:"LDORALD" // arm64/v8.0:"LDORALD"
@ -48,13 +48,13 @@ func atomicLogical64(x *atomic.Uint64) uint64 {
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// On amd64, make sure we use LOCK+OR instead of CMPXCHG when we don't use the result. // On amd64, make sure we use LOCK+OR instead of CMPXCHG when we don't use the result.
// amd64:"LOCK",-"CMPXCHGQ" // amd64:"LOCK" -"CMPXCHGQ"
x.Or(33) x.Or(33)
// arm64/v8.0:"LDORALD" // arm64/v8.0:"LDORALD"
// arm64/v8.1:"LDORALD" // arm64/v8.1:"LDORALD"
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// amd64:"LOCK","CMPXCHGQ" // amd64:"LOCK" "CMPXCHGQ"
r += x.Or(44) r += x.Or(44)
return r return r
@ -68,13 +68,13 @@ func atomicLogical32(x *atomic.Uint32) uint32 {
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// On amd64, make sure we use LOCK+AND instead of CMPXCHG when we don't use the result. // On amd64, make sure we use LOCK+AND instead of CMPXCHG when we don't use the result.
// amd64:"LOCK",-"CMPXCHGL" // amd64:"LOCK" -"CMPXCHGL"
x.And(11) x.And(11)
// arm64/v8.0:"LDCLRALW" // arm64/v8.0:"LDCLRALW"
// arm64/v8.1:"LDCLRALW" // arm64/v8.1:"LDCLRALW"
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// amd64:"LOCK","CMPXCHGL" // amd64:"LOCK" "CMPXCHGL"
r += x.And(22) r += x.And(22)
// arm64/v8.0:"LDORALW" // arm64/v8.0:"LDORALW"
@ -82,13 +82,13 @@ func atomicLogical32(x *atomic.Uint32) uint32 {
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// On amd64, make sure we use LOCK+OR instead of CMPXCHG when we don't use the result. // On amd64, make sure we use LOCK+OR instead of CMPXCHG when we don't use the result.
// amd64:"LOCK",-"CMPXCHGL" // amd64:"LOCK" -"CMPXCHGL"
x.Or(33) x.Or(33)
// arm64/v8.0:"LDORALW" // arm64/v8.0:"LDORALW"
// arm64/v8.1:"LDORALW" // arm64/v8.1:"LDORALW"
// arm64/v8.0:".*arm64HasATOMICS" // arm64/v8.0:".*arm64HasATOMICS"
// arm64/v8.1:-".*arm64HasATOMICS" // arm64/v8.1:-".*arm64HasATOMICS"
// amd64:"LOCK","CMPXCHGL" // amd64:"LOCK" "CMPXCHGL"
r += x.Or(44) r += x.Or(44)
return r return r

View file

@ -10,304 +10,304 @@ package codegen
// insertion/extraction simplifications/optimizations. // insertion/extraction simplifications/optimizations.
func extr1(x, x2 uint64) uint64 { func extr1(x, x2 uint64) uint64 {
return x<<7 + x2>>57 // arm64:"EXTR\t[$]57," return x<<7 + x2>>57 // arm64:"EXTR [$]57,"
} }
func extr2(x, x2 uint64) uint64 { func extr2(x, x2 uint64) uint64 {
return x<<7 | x2>>57 // arm64:"EXTR\t[$]57," return x<<7 | x2>>57 // arm64:"EXTR [$]57,"
} }
func extr3(x, x2 uint64) uint64 { func extr3(x, x2 uint64) uint64 {
return x<<7 ^ x2>>57 // arm64:"EXTR\t[$]57," return x<<7 ^ x2>>57 // arm64:"EXTR [$]57,"
} }
func extr4(x, x2 uint32) uint32 { func extr4(x, x2 uint32) uint32 {
return x<<7 + x2>>25 // arm64:"EXTRW\t[$]25," return x<<7 + x2>>25 // arm64:"EXTRW [$]25,"
} }
func extr5(x, x2 uint32) uint32 { func extr5(x, x2 uint32) uint32 {
return x<<7 | x2>>25 // arm64:"EXTRW\t[$]25," return x<<7 | x2>>25 // arm64:"EXTRW [$]25,"
} }
func extr6(x, x2 uint32) uint32 { func extr6(x, x2 uint32) uint32 {
return x<<7 ^ x2>>25 // arm64:"EXTRW\t[$]25," return x<<7 ^ x2>>25 // arm64:"EXTRW [$]25,"
} }
// check 32-bit shift masking // check 32-bit shift masking
func mask32(x uint32) uint32 { func mask32(x uint32) uint32 {
return (x << 29) >> 29 // arm64:"AND\t[$]7, R[0-9]+",-"LSR",-"LSL" return (x << 29) >> 29 // arm64:"AND [$]7, R[0-9]+" -"LSR" -"LSL"
} }
// check 16-bit shift masking // check 16-bit shift masking
func mask16(x uint16) uint16 { func mask16(x uint16) uint16 {
return (x << 14) >> 14 // arm64:"AND\t[$]3, R[0-9]+",-"LSR",-"LSL" return (x << 14) >> 14 // arm64:"AND [$]3, R[0-9]+" -"LSR" -"LSL"
} }
// check 8-bit shift masking // check 8-bit shift masking
func mask8(x uint8) uint8 { func mask8(x uint8) uint8 {
return (x << 7) >> 7 // arm64:"AND\t[$]1, R[0-9]+",-"LSR",-"LSL" return (x << 7) >> 7 // arm64:"AND [$]1, R[0-9]+" -"LSR" -"LSL"
} }
func maskshift(x uint64) uint64 { func maskshift(x uint64) uint64 {
// arm64:"AND\t[$]4095, R[0-9]+",-"LSL",-"LSR",-"UBFIZ",-"UBFX" // arm64:"AND [$]4095, R[0-9]+" -"LSL" -"LSR" -"UBFIZ" -"UBFX"
return ((x << 5) & (0xfff << 5)) >> 5 return ((x << 5) & (0xfff << 5)) >> 5
} }
// bitfield ops // bitfield ops
// bfi // bfi
func bfi1(x, y uint64) uint64 { func bfi1(x, y uint64) uint64 {
// arm64:"BFI\t[$]4, R[0-9]+, [$]12",-"LSL",-"LSR",-"AND" // arm64:"BFI [$]4, R[0-9]+, [$]12" -"LSL" -"LSR" -"AND"
return ((x & 0xfff) << 4) | (y & 0xffffffffffff000f) return ((x & 0xfff) << 4) | (y & 0xffffffffffff000f)
} }
func bfi2(x, y uint64) uint64 { func bfi2(x, y uint64) uint64 {
// arm64:"BFI\t[$]12, R[0-9]+, [$]40",-"LSL",-"LSR",-"AND" // arm64:"BFI [$]12, R[0-9]+, [$]40" -"LSL" -"LSR" -"AND"
return (x << 24 >> 12) | (y & 0xfff0000000000fff) return (x << 24 >> 12) | (y & 0xfff0000000000fff)
} }
// bfxil // bfxil
func bfxil1(x, y uint64) uint64 { func bfxil1(x, y uint64) uint64 {
// arm64:"BFXIL\t[$]5, R[0-9]+, [$]12",-"LSL",-"LSR",-"AND" // arm64:"BFXIL [$]5, R[0-9]+, [$]12" -"LSL" -"LSR" -"AND"
return ((x >> 5) & 0xfff) | (y & 0xfffffffffffff000) return ((x >> 5) & 0xfff) | (y & 0xfffffffffffff000)
} }
func bfxil2(x, y uint64) uint64 { func bfxil2(x, y uint64) uint64 {
// arm64:"BFXIL\t[$]12, R[0-9]+, [$]40",-"LSL",-"LSR",-"AND" // arm64:"BFXIL [$]12, R[0-9]+, [$]40" -"LSL" -"LSR" -"AND"
return (x << 12 >> 24) | (y & 0xffffff0000000000) return (x << 12 >> 24) | (y & 0xffffff0000000000)
} }
// sbfiz // sbfiz
// merge shifts into sbfiz: (x << lc) >> rc && lc > rc. // merge shifts into sbfiz: (x << lc) >> rc && lc > rc.
func sbfiz1(x int64) int64 { func sbfiz1(x int64) int64 {
// arm64:"SBFIZ\t[$]1, R[0-9]+, [$]60",-"LSL",-"ASR" // arm64:"SBFIZ [$]1, R[0-9]+, [$]60" -"LSL" -"ASR"
return (x << 4) >> 3 return (x << 4) >> 3
} }
// merge shift and sign-extension into sbfiz. // merge shift and sign-extension into sbfiz.
func sbfiz2(x int32) int64 { func sbfiz2(x int32) int64 {
return int64(x << 3) // arm64:"SBFIZ\t[$]3, R[0-9]+, [$]29",-"LSL" return int64(x << 3) // arm64:"SBFIZ [$]3, R[0-9]+, [$]29" -"LSL"
} }
func sbfiz3(x int16) int64 { func sbfiz3(x int16) int64 {
return int64(x << 3) // arm64:"SBFIZ\t[$]3, R[0-9]+, [$]13",-"LSL" return int64(x << 3) // arm64:"SBFIZ [$]3, R[0-9]+, [$]13" -"LSL"
} }
func sbfiz4(x int8) int64 { func sbfiz4(x int8) int64 {
return int64(x << 3) // arm64:"SBFIZ\t[$]3, R[0-9]+, [$]5",-"LSL" return int64(x << 3) // arm64:"SBFIZ [$]3, R[0-9]+, [$]5" -"LSL"
} }
// sbfiz combinations. // sbfiz combinations.
// merge shift with sbfiz into sbfiz. // merge shift with sbfiz into sbfiz.
func sbfiz5(x int32) int32 { func sbfiz5(x int32) int32 {
// arm64:"SBFIZ\t[$]1, R[0-9]+, [$]28",-"LSL",-"ASR" // arm64:"SBFIZ [$]1, R[0-9]+, [$]28" -"LSL" -"ASR"
return (x << 4) >> 3 return (x << 4) >> 3
} }
func sbfiz6(x int16) int64 { func sbfiz6(x int16) int64 {
return int64(x+1) << 3 // arm64:"SBFIZ\t[$]3, R[0-9]+, [$]16",-"LSL" return int64(x+1) << 3 // arm64:"SBFIZ [$]3, R[0-9]+, [$]16" -"LSL"
} }
func sbfiz7(x int8) int64 { func sbfiz7(x int8) int64 {
return int64(x+1) << 62 // arm64:"SBFIZ\t[$]62, R[0-9]+, [$]2",-"LSL" return int64(x+1) << 62 // arm64:"SBFIZ [$]62, R[0-9]+, [$]2" -"LSL"
} }
func sbfiz8(x int32) int64 { func sbfiz8(x int32) int64 {
return int64(x+1) << 40 // arm64:"SBFIZ\t[$]40, R[0-9]+, [$]24",-"LSL" return int64(x+1) << 40 // arm64:"SBFIZ [$]40, R[0-9]+, [$]24" -"LSL"
} }
// sbfx // sbfx
// merge shifts into sbfx: (x << lc) >> rc && lc <= rc. // merge shifts into sbfx: (x << lc) >> rc && lc <= rc.
func sbfx1(x int64) int64 { func sbfx1(x int64) int64 {
return (x << 3) >> 4 // arm64:"SBFX\t[$]1, R[0-9]+, [$]60",-"LSL",-"ASR" return (x << 3) >> 4 // arm64:"SBFX [$]1, R[0-9]+, [$]60" -"LSL" -"ASR"
} }
func sbfx2(x int64) int64 { func sbfx2(x int64) int64 {
return (x << 60) >> 60 // arm64:"SBFX\t[$]0, R[0-9]+, [$]4",-"LSL",-"ASR" return (x << 60) >> 60 // arm64:"SBFX [$]0, R[0-9]+, [$]4" -"LSL" -"ASR"
} }
// merge shift and sign-extension into sbfx. // merge shift and sign-extension into sbfx.
func sbfx3(x int32) int64 { func sbfx3(x int32) int64 {
return int64(x) >> 3 // arm64:"SBFX\t[$]3, R[0-9]+, [$]29",-"ASR" return int64(x) >> 3 // arm64:"SBFX [$]3, R[0-9]+, [$]29" -"ASR"
} }
func sbfx4(x int16) int64 { func sbfx4(x int16) int64 {
return int64(x) >> 3 // arm64:"SBFX\t[$]3, R[0-9]+, [$]13",-"ASR" return int64(x) >> 3 // arm64:"SBFX [$]3, R[0-9]+, [$]13" -"ASR"
} }
func sbfx5(x int8) int64 { func sbfx5(x int8) int64 {
return int64(x) >> 3 // arm64:"SBFX\t[$]3, R[0-9]+, [$]5",-"ASR" return int64(x) >> 3 // arm64:"SBFX [$]3, R[0-9]+, [$]5" -"ASR"
} }
func sbfx6(x int32) int64 { func sbfx6(x int32) int64 {
return int64(x >> 30) // arm64:"SBFX\t[$]30, R[0-9]+, [$]2" return int64(x >> 30) // arm64:"SBFX [$]30, R[0-9]+, [$]2"
} }
func sbfx7(x int16) int64 { func sbfx7(x int16) int64 {
return int64(x >> 10) // arm64:"SBFX\t[$]10, R[0-9]+, [$]6" return int64(x >> 10) // arm64:"SBFX [$]10, R[0-9]+, [$]6"
} }
func sbfx8(x int8) int64 { func sbfx8(x int8) int64 {
return int64(x >> 5) // arm64:"SBFX\t[$]5, R[0-9]+, [$]3" return int64(x >> 5) // arm64:"SBFX [$]5, R[0-9]+, [$]3"
} }
// sbfx combinations. // sbfx combinations.
// merge shifts with sbfiz into sbfx. // merge shifts with sbfiz into sbfx.
func sbfx9(x int32) int32 { func sbfx9(x int32) int32 {
return (x << 3) >> 4 // arm64:"SBFX\t[$]1, R[0-9]+, [$]28",-"LSL",-"ASR" return (x << 3) >> 4 // arm64:"SBFX [$]1, R[0-9]+, [$]28" -"LSL" -"ASR"
} }
// merge sbfx and sign-extension into sbfx. // merge sbfx and sign-extension into sbfx.
func sbfx10(x int32) int64 { func sbfx10(x int32) int64 {
c := x + 5 c := x + 5
return int64(c >> 20) // arm64"SBFX\t[$]20, R[0-9]+, [$]12",-"MOVW\tR[0-9]+, R[0-9]+" return int64(c >> 20) // arm64"SBFX [$]20, R[0-9]+, [$]12" -"MOVW R[0-9]+, R[0-9]+"
} }
// ubfiz // ubfiz
// merge shifts into ubfiz: (x<<lc)>>rc && lc>rc // merge shifts into ubfiz: (x<<lc)>>rc && lc>rc
func ubfiz1(x uint64) uint64 { func ubfiz1(x uint64) uint64 {
// arm64:"UBFIZ\t[$]1, R[0-9]+, [$]60",-"LSL",-"LSR" // arm64:"UBFIZ [$]1, R[0-9]+, [$]60" -"LSL" -"LSR"
// s390x:"RISBGZ\t[$]3, [$]62, [$]1, ",-"SLD",-"SRD" // s390x:"RISBGZ [$]3, [$]62, [$]1, " -"SLD" -"SRD"
return (x << 4) >> 3 return (x << 4) >> 3
} }
// merge shift and zero-extension into ubfiz. // merge shift and zero-extension into ubfiz.
func ubfiz2(x uint32) uint64 { func ubfiz2(x uint32) uint64 {
return uint64(x+1) << 3 // arm64:"UBFIZ\t[$]3, R[0-9]+, [$]32",-"LSL" return uint64(x+1) << 3 // arm64:"UBFIZ [$]3, R[0-9]+, [$]32" -"LSL"
} }
func ubfiz3(x uint16) uint64 { func ubfiz3(x uint16) uint64 {
return uint64(x+1) << 3 // arm64:"UBFIZ\t[$]3, R[0-9]+, [$]16",-"LSL" return uint64(x+1) << 3 // arm64:"UBFIZ [$]3, R[0-9]+, [$]16" -"LSL"
} }
func ubfiz4(x uint8) uint64 { func ubfiz4(x uint8) uint64 {
return uint64(x+1) << 3 // arm64:"UBFIZ\t[$]3, R[0-9]+, [$]8",-"LSL" return uint64(x+1) << 3 // arm64:"UBFIZ [$]3, R[0-9]+, [$]8" -"LSL"
} }
func ubfiz5(x uint8) uint64 { func ubfiz5(x uint8) uint64 {
return uint64(x) << 60 // arm64:"UBFIZ\t[$]60, R[0-9]+, [$]4",-"LSL" return uint64(x) << 60 // arm64:"UBFIZ [$]60, R[0-9]+, [$]4" -"LSL"
} }
func ubfiz6(x uint32) uint64 { func ubfiz6(x uint32) uint64 {
return uint64(x << 30) // arm64:"UBFIZ\t[$]30, R[0-9]+, [$]2", return uint64(x << 30) // arm64:"UBFIZ [$]30, R[0-9]+, [$]2",
} }
func ubfiz7(x uint16) uint64 { func ubfiz7(x uint16) uint64 {
return uint64(x << 10) // arm64:"UBFIZ\t[$]10, R[0-9]+, [$]6", return uint64(x << 10) // arm64:"UBFIZ [$]10, R[0-9]+, [$]6",
} }
func ubfiz8(x uint8) uint64 { func ubfiz8(x uint8) uint64 {
return uint64(x << 7) // arm64:"UBFIZ\t[$]7, R[0-9]+, [$]1", return uint64(x << 7) // arm64:"UBFIZ [$]7, R[0-9]+, [$]1",
} }
// merge ANDconst into ubfiz. // merge ANDconst into ubfiz.
func ubfiz9(x uint64) uint64 { func ubfiz9(x uint64) uint64 {
// arm64:"UBFIZ\t[$]3, R[0-9]+, [$]12",-"LSL",-"AND" // arm64:"UBFIZ [$]3, R[0-9]+, [$]12" -"LSL" -"AND"
// s390x:"RISBGZ\t[$]49, [$]60, [$]3,",-"SLD",-"AND" // s390x:"RISBGZ [$]49, [$]60, [$]3," -"SLD" -"AND"
return (x & 0xfff) << 3 return (x & 0xfff) << 3
} }
func ubfiz10(x uint64) uint64 { func ubfiz10(x uint64) uint64 {
// arm64:"UBFIZ\t[$]4, R[0-9]+, [$]12",-"LSL",-"AND" // arm64:"UBFIZ [$]4, R[0-9]+, [$]12" -"LSL" -"AND"
// s390x:"RISBGZ\t[$]48, [$]59, [$]4,",-"SLD",-"AND" // s390x:"RISBGZ [$]48, [$]59, [$]4," -"SLD" -"AND"
return (x << 4) & 0xfff0 return (x << 4) & 0xfff0
} }
// ubfiz combinations // ubfiz combinations
func ubfiz11(x uint32) uint32 { func ubfiz11(x uint32) uint32 {
// arm64:"UBFIZ\t[$]1, R[0-9]+, [$]28",-"LSL",-"LSR" // arm64:"UBFIZ [$]1, R[0-9]+, [$]28" -"LSL" -"LSR"
return (x << 4) >> 3 return (x << 4) >> 3
} }
func ubfiz12(x uint64) uint64 { func ubfiz12(x uint64) uint64 {
// arm64:"UBFIZ\t[$]1, R[0-9]+, [$]20",-"LSL",-"LSR" // arm64:"UBFIZ [$]1, R[0-9]+, [$]20" -"LSL" -"LSR"
// s390x:"RISBGZ\t[$]43, [$]62, [$]1, ",-"SLD",-"SRD",-"AND" // s390x:"RISBGZ [$]43, [$]62, [$]1, " -"SLD" -"SRD" -"AND"
return ((x & 0xfffff) << 4) >> 3 return ((x & 0xfffff) << 4) >> 3
} }
func ubfiz13(x uint64) uint64 { func ubfiz13(x uint64) uint64 {
// arm64:"UBFIZ\t[$]5, R[0-9]+, [$]13",-"LSL",-"LSR",-"AND" // arm64:"UBFIZ [$]5, R[0-9]+, [$]13" -"LSL" -"LSR" -"AND"
return ((x << 3) & 0xffff) << 2 return ((x << 3) & 0xffff) << 2
} }
func ubfiz14(x uint64) uint64 { func ubfiz14(x uint64) uint64 {
// arm64:"UBFIZ\t[$]7, R[0-9]+, [$]12",-"LSL",-"LSR",-"AND" // arm64:"UBFIZ [$]7, R[0-9]+, [$]12" -"LSL" -"LSR" -"AND"
// s390x:"RISBGZ\t[$]45, [$]56, [$]7, ",-"SLD",-"SRD",-"AND" // s390x:"RISBGZ [$]45, [$]56, [$]7, " -"SLD" -"SRD" -"AND"
return ((x << 5) & (0xfff << 5)) << 2 return ((x << 5) & (0xfff << 5)) << 2
} }
// ubfx // ubfx
// merge shifts into ubfx: (x<<lc)>>rc && lc<rc // merge shifts into ubfx: (x<<lc)>>rc && lc<rc
func ubfx1(x uint64) uint64 { func ubfx1(x uint64) uint64 {
// arm64:"UBFX\t[$]1, R[0-9]+, [$]62",-"LSL",-"LSR" // arm64:"UBFX [$]1, R[0-9]+, [$]62" -"LSL" -"LSR"
// s390x:"RISBGZ\t[$]2, [$]63, [$]63,",-"SLD",-"SRD" // s390x:"RISBGZ [$]2, [$]63, [$]63," -"SLD" -"SRD"
return (x << 1) >> 2 return (x << 1) >> 2
} }
// merge shift and zero-extension into ubfx. // merge shift and zero-extension into ubfx.
func ubfx2(x uint32) uint64 { func ubfx2(x uint32) uint64 {
return uint64(x >> 15) // arm64:"UBFX\t[$]15, R[0-9]+, [$]17",-"LSR" return uint64(x >> 15) // arm64:"UBFX [$]15, R[0-9]+, [$]17" -"LSR"
} }
func ubfx3(x uint16) uint64 { func ubfx3(x uint16) uint64 {
return uint64(x >> 9) // arm64:"UBFX\t[$]9, R[0-9]+, [$]7",-"LSR" return uint64(x >> 9) // arm64:"UBFX [$]9, R[0-9]+, [$]7" -"LSR"
} }
func ubfx4(x uint8) uint64 { func ubfx4(x uint8) uint64 {
return uint64(x >> 3) // arm64:"UBFX\t[$]3, R[0-9]+, [$]5",-"LSR" return uint64(x >> 3) // arm64:"UBFX [$]3, R[0-9]+, [$]5" -"LSR"
} }
func ubfx5(x uint32) uint64 { func ubfx5(x uint32) uint64 {
return uint64(x) >> 30 // arm64:"UBFX\t[$]30, R[0-9]+, [$]2" return uint64(x) >> 30 // arm64:"UBFX [$]30, R[0-9]+, [$]2"
} }
func ubfx6(x uint16) uint64 { func ubfx6(x uint16) uint64 {
return uint64(x) >> 10 // arm64:"UBFX\t[$]10, R[0-9]+, [$]6" return uint64(x) >> 10 // arm64:"UBFX [$]10, R[0-9]+, [$]6"
} }
func ubfx7(x uint8) uint64 { func ubfx7(x uint8) uint64 {
return uint64(x) >> 3 // arm64:"UBFX\t[$]3, R[0-9]+, [$]5" return uint64(x) >> 3 // arm64:"UBFX [$]3, R[0-9]+, [$]5"
} }
// merge ANDconst into ubfx. // merge ANDconst into ubfx.
func ubfx8(x uint64) uint64 { func ubfx8(x uint64) uint64 {
// arm64:"UBFX\t[$]25, R[0-9]+, [$]10",-"LSR",-"AND" // arm64:"UBFX [$]25, R[0-9]+, [$]10" -"LSR" -"AND"
// s390x:"RISBGZ\t[$]54, [$]63, [$]39, ",-"SRD",-"AND" // s390x:"RISBGZ [$]54, [$]63, [$]39, " -"SRD" -"AND"
return (x >> 25) & 1023 return (x >> 25) & 1023
} }
func ubfx9(x uint64) uint64 { func ubfx9(x uint64) uint64 {
// arm64:"UBFX\t[$]4, R[0-9]+, [$]8",-"LSR",-"AND" // arm64:"UBFX [$]4, R[0-9]+, [$]8" -"LSR" -"AND"
// s390x:"RISBGZ\t[$]56, [$]63, [$]60, ",-"SRD",-"AND" // s390x:"RISBGZ [$]56, [$]63, [$]60, " -"SRD" -"AND"
return (x & 0x0ff0) >> 4 return (x & 0x0ff0) >> 4
} }
// ubfx combinations. // ubfx combinations.
func ubfx10(x uint32) uint32 { func ubfx10(x uint32) uint32 {
// arm64:"UBFX\t[$]1, R[0-9]+, [$]30",-"LSL",-"LSR" // arm64:"UBFX [$]1, R[0-9]+, [$]30" -"LSL" -"LSR"
return (x << 1) >> 2 return (x << 1) >> 2
} }
func ubfx11(x uint64) uint64 { func ubfx11(x uint64) uint64 {
// arm64:"UBFX\t[$]1, R[0-9]+, [$]12",-"LSL",-"LSR",-"AND" // arm64:"UBFX [$]1, R[0-9]+, [$]12" -"LSL" -"LSR" -"AND"
// s390x:"RISBGZ\t[$]52, [$]63, [$]63,",-"SLD",-"SRD",-"AND" // s390x:"RISBGZ [$]52, [$]63, [$]63," -"SLD" -"SRD" -"AND"
return ((x << 1) >> 2) & 0xfff return ((x << 1) >> 2) & 0xfff
} }
func ubfx12(x uint64) uint64 { func ubfx12(x uint64) uint64 {
// arm64:"UBFX\t[$]4, R[0-9]+, [$]11",-"LSL",-"LSR",-"AND" // arm64:"UBFX [$]4, R[0-9]+, [$]11" -"LSL" -"LSR" -"AND"
// s390x:"RISBGZ\t[$]53, [$]63, [$]60, ",-"SLD",-"SRD",-"AND" // s390x:"RISBGZ [$]53, [$]63, [$]60, " -"SLD" -"SRD" -"AND"
return ((x >> 3) & 0xfff) >> 1 return ((x >> 3) & 0xfff) >> 1
} }
func ubfx13(x uint64) uint64 { func ubfx13(x uint64) uint64 {
// arm64:"UBFX\t[$]5, R[0-9]+, [$]56",-"LSL",-"LSR" // arm64:"UBFX [$]5, R[0-9]+, [$]56" -"LSL" -"LSR"
// s390x:"RISBGZ\t[$]8, [$]63, [$]59, ",-"SLD",-"SRD" // s390x:"RISBGZ [$]8, [$]63, [$]59, " -"SLD" -"SRD"
return ((x >> 2) << 5) >> 8 return ((x >> 2) << 5) >> 8
} }
func ubfx14(x uint64) uint64 { func ubfx14(x uint64) uint64 {
// arm64:"UBFX\t[$]1, R[0-9]+, [$]19",-"LSL",-"LSR" // arm64:"UBFX [$]1, R[0-9]+, [$]19" -"LSL" -"LSR"
// s390x:"RISBGZ\t[$]45, [$]63, [$]63, ",-"SLD",-"SRD",-"AND" // s390x:"RISBGZ [$]45, [$]63, [$]63, " -"SLD" -"SRD" -"AND"
return ((x & 0xfffff) << 3) >> 4 return ((x & 0xfffff) << 3) >> 4
} }
@ -315,7 +315,7 @@ func ubfx14(x uint64) uint64 {
func ubfx15(x uint64) bool { func ubfx15(x uint64) bool {
midr := x + 10 midr := x + 10
part_num := uint16((midr >> 4) & 0xfff) part_num := uint16((midr >> 4) & 0xfff)
if part_num == 0xd0c { // arm64:"UBFX\t[$]4, R[0-9]+, [$]12",-"MOVHU\tR[0-9]+, R[0-9]+" if part_num == 0xd0c { // arm64:"UBFX [$]4, R[0-9]+, [$]12" -"MOVHU R[0-9]+, R[0-9]+"
return true return true
} }
return false return false
@ -323,7 +323,7 @@ func ubfx15(x uint64) bool {
// merge ANDconst and ubfx into ubfx // merge ANDconst and ubfx into ubfx
func ubfx16(x uint64) uint64 { func ubfx16(x uint64) uint64 {
// arm64:"UBFX\t[$]4, R[0-9]+, [$]6",-"AND\t[$]63" // arm64:"UBFX [$]4, R[0-9]+, [$]6" -"AND [$]63"
return ((x >> 3) & 0xfff) >> 1 & 0x3f return ((x >> 3) & 0xfff) >> 1 & 0x3f
} }
@ -331,48 +331,48 @@ func ubfx16(x uint64) uint64 {
// //
//go:nosplit //go:nosplit
func shift_no_cmp(x int) int { func shift_no_cmp(x int) int {
// arm64:`LSL\t[$]17`,-`CMP` // arm64:`LSL [$]17`,-`CMP`
// mips64:`SLLV\t[$]17`,-`SGT` // mips64:`SLLV [$]17`,-`SGT`
return x << 17 return x << 17
} }
func rev16(c uint64) (uint64, uint64, uint64) { func rev16(c uint64) (uint64, uint64, uint64) {
// arm64:`REV16`,-`AND`,-`LSR`,-`AND`,-`ORR\tR[0-9]+<<8` // arm64:`REV16`,-`AND`,-`LSR`,-`AND`,-`ORR R[0-9]+<<8`
// loong64:`REVB4H`,-`MOVV`,-`AND`,-`SRLV`,-`AND`,-`SLLV`,-`OR` // loong64:`REVB4H`,-`MOVV`,-`AND`,-`SRLV`,-`AND`,-`SLLV`,-`OR`
b1 := ((c & 0xff00ff00ff00ff00) >> 8) | ((c & 0x00ff00ff00ff00ff) << 8) b1 := ((c & 0xff00ff00ff00ff00) >> 8) | ((c & 0x00ff00ff00ff00ff) << 8)
// arm64:-`ADD\tR[0-9]+<<8` // arm64:-`ADD R[0-9]+<<8`
// loong64:-`ADDV` // loong64:-`ADDV`
b2 := ((c & 0xff00ff00ff00ff00) >> 8) + ((c & 0x00ff00ff00ff00ff) << 8) b2 := ((c & 0xff00ff00ff00ff00) >> 8) + ((c & 0x00ff00ff00ff00ff) << 8)
// arm64:-`EOR\tR[0-9]+<<8` // arm64:-`EOR R[0-9]+<<8`
// loong64:-`XOR` // loong64:-`XOR`
b3 := ((c & 0xff00ff00ff00ff00) >> 8) ^ ((c & 0x00ff00ff00ff00ff) << 8) b3 := ((c & 0xff00ff00ff00ff00) >> 8) ^ ((c & 0x00ff00ff00ff00ff) << 8)
return b1, b2, b3 return b1, b2, b3
} }
func rev16w(c uint32) (uint32, uint32, uint32) { func rev16w(c uint32) (uint32, uint32, uint32) {
// arm64:`REV16W`,-`AND`,-`UBFX`,-`AND`,-`ORR\tR[0-9]+<<8` // arm64:`REV16W`,-`AND`,-`UBFX`,-`AND`,-`ORR R[0-9]+<<8`
// loong64:`REVB2H`,-`AND`,-`SRL`,-`AND`,-`SLL`,-`OR` // loong64:`REVB2H`,-`AND`,-`SRL`,-`AND`,-`SLL`,-`OR`
b1 := ((c & 0xff00ff00) >> 8) | ((c & 0x00ff00ff) << 8) b1 := ((c & 0xff00ff00) >> 8) | ((c & 0x00ff00ff) << 8)
// arm64:-`ADD\tR[0-9]+<<8` // arm64:-`ADD R[0-9]+<<8`
// loong64:-`ADDV` // loong64:-`ADDV`
b2 := ((c & 0xff00ff00) >> 8) + ((c & 0x00ff00ff) << 8) b2 := ((c & 0xff00ff00) >> 8) + ((c & 0x00ff00ff) << 8)
// arm64:-`EOR\tR[0-9]+<<8` // arm64:-`EOR R[0-9]+<<8`
// loong64:-`XOR` // loong64:-`XOR`
b3 := ((c & 0xff00ff00) >> 8) ^ ((c & 0x00ff00ff) << 8) b3 := ((c & 0xff00ff00) >> 8) ^ ((c & 0x00ff00ff) << 8)
return b1, b2, b3 return b1, b2, b3
} }
func shift(x uint32, y uint16, z uint8) uint64 { func shift(x uint32, y uint16, z uint8) uint64 {
// arm64:-`MOVWU`,-`LSR\t[$]32` // arm64:-`MOVWU`,-`LSR [$]32`
// loong64:-`MOVWU`,-`SRLV\t[$]32` // loong64:-`MOVWU`,-`SRLV [$]32`
a := uint64(x) >> 32 a := uint64(x) >> 32
// arm64:-`MOVHU // arm64:-`MOVHU
// loong64:-`MOVHU`,-`SRLV\t[$]16` // loong64:-`MOVHU`,-`SRLV [$]16`
b := uint64(y) >> 16 b := uint64(y) >> 16
// arm64:-`MOVBU` // arm64:-`MOVBU`
// loong64:-`MOVBU`,-`SRLV\t[$]8` // loong64:-`MOVBU`,-`SRLV [$]8`
c := uint64(z) >> 8 c := uint64(z) >> 8
// arm64:`MOVD\tZR`,-`ADD\tR[0-9]+>>16`,-`ADD\tR[0-9]+>>8`, // arm64:`MOVD ZR`,-`ADD R[0-9]+>>16`,-`ADD R[0-9]+>>8`,
// loong64:`MOVV\tR0`,-`ADDVU` // loong64:`MOVV R0`,-`ADDVU`
return a + b + c return a + b + c
} }

View file

@ -13,15 +13,15 @@ import "math/bits"
************************************/ ************************************/
func bitcheck64_constleft(a uint64) (n int) { func bitcheck64_constleft(a uint64) (n int) {
// amd64:"BTQ\t[$]63" // amd64:"BTQ [$]63"
if a&(1<<63) != 0 { if a&(1<<63) != 0 {
return 1 return 1
} }
// amd64:"BTQ\t[$]60" // amd64:"BTQ [$]60"
if a&(1<<60) != 0 { if a&(1<<60) != 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]0" // amd64:"BTL [$]0"
if a&(1<<0) != 0 { if a&(1<<0) != 0 {
return 1 return 1
} }
@ -29,31 +29,31 @@ func bitcheck64_constleft(a uint64) (n int) {
} }
func bitcheck64_constright(a [8]uint64) (n int) { func bitcheck64_constright(a [8]uint64) (n int) {
// amd64:"BTQ\t[$]63" // amd64:"BTQ [$]63"
if (a[0]>>63)&1 != 0 { if (a[0]>>63)&1 != 0 {
return 1 return 1
} }
// amd64:"BTQ\t[$]63" // amd64:"BTQ [$]63"
if a[1]>>63 != 0 { if a[1]>>63 != 0 {
return 1 return 1
} }
// amd64:"BTQ\t[$]63" // amd64:"BTQ [$]63"
if a[2]>>63 == 0 { if a[2]>>63 == 0 {
return 1 return 1
} }
// amd64:"BTQ\t[$]60" // amd64:"BTQ [$]60"
if (a[3]>>60)&1 == 0 { if (a[3]>>60)&1 == 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]1" // amd64:"BTL [$]1"
if (a[4]>>1)&1 == 0 { if (a[4]>>1)&1 == 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]0" // amd64:"BTL [$]0"
if (a[5]>>0)&1 == 0 { if (a[5]>>0)&1 == 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]7" // amd64:"BTL [$]7"
if (a[6]>>5)&4 == 0 { if (a[6]>>5)&4 == 0 {
return 1 return 1
} }
@ -65,7 +65,7 @@ func bitcheck64_var(a, b uint64) (n int) {
if a&(1<<(b&63)) != 0 { if a&(1<<(b&63)) != 0 {
return 1 return 1
} }
// amd64:"BTQ",-"BT.\t[$]0" // amd64:"BTQ" -"BT. [$]0"
if (b>>(a&63))&1 != 0 { if (b>>(a&63))&1 != 0 {
return 1 return 1
} }
@ -73,15 +73,15 @@ func bitcheck64_var(a, b uint64) (n int) {
} }
func bitcheck64_mask(a uint64) (n int) { func bitcheck64_mask(a uint64) (n int) {
// amd64:"BTQ\t[$]63" // amd64:"BTQ [$]63"
if a&0x8000000000000000 != 0 { if a&0x8000000000000000 != 0 {
return 1 return 1
} }
// amd64:"BTQ\t[$]59" // amd64:"BTQ [$]59"
if a&0x800000000000000 != 0 { if a&0x800000000000000 != 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]0" // amd64:"BTL [$]0"
if a&0x1 != 0 { if a&0x1 != 0 {
return 1 return 1
} }
@ -92,13 +92,13 @@ func biton64(a, b uint64) (n uint64) {
// amd64:"BTSQ" // amd64:"BTSQ"
n += b | (1 << (a & 63)) n += b | (1 << (a & 63))
// amd64:"BTSQ\t[$]63" // amd64:"BTSQ [$]63"
n += a | (1 << 63) n += a | (1 << 63)
// amd64:"BTSQ\t[$]60" // amd64:"BTSQ [$]60"
n += a | (1 << 60) n += a | (1 << 60)
// amd64:"ORQ\t[$]1" // amd64:"ORQ [$]1"
n += a | (1 << 0) n += a | (1 << 0)
return n return n
@ -108,23 +108,23 @@ func bitoff64(a, b uint64) (n uint64) {
// amd64:"BTRQ" // amd64:"BTRQ"
n += b &^ (1 << (a & 63)) n += b &^ (1 << (a & 63))
// amd64:"BTRQ\t[$]63" // amd64:"BTRQ [$]63"
n += a &^ (1 << 63) n += a &^ (1 << 63)
// amd64:"BTRQ\t[$]60" // amd64:"BTRQ [$]60"
n += a &^ (1 << 60) n += a &^ (1 << 60)
// amd64:"ANDQ\t[$]-2" // amd64:"ANDQ [$]-2"
n += a &^ (1 << 0) n += a &^ (1 << 0)
return n return n
} }
func clearLastBit(x int64, y int32) (int64, int32) { func clearLastBit(x int64, y int32) (int64, int32) {
// amd64:"ANDQ\t[$]-2" // amd64:"ANDQ [$]-2"
a := (x >> 1) << 1 a := (x >> 1) << 1
// amd64:"ANDL\t[$]-2" // amd64:"ANDL [$]-2"
b := (y >> 1) << 1 b := (y >> 1) << 1
return a, b return a, b
@ -134,13 +134,13 @@ func bitcompl64(a, b uint64) (n uint64) {
// amd64:"BTCQ" // amd64:"BTCQ"
n += b ^ (1 << (a & 63)) n += b ^ (1 << (a & 63))
// amd64:"BTCQ\t[$]63" // amd64:"BTCQ [$]63"
n += a ^ (1 << 63) n += a ^ (1 << 63)
// amd64:"BTCQ\t[$]60" // amd64:"BTCQ [$]60"
n += a ^ (1 << 60) n += a ^ (1 << 60)
// amd64:"XORQ\t[$]1" // amd64:"XORQ [$]1"
n += a ^ (1 << 0) n += a ^ (1 << 0)
return n return n
@ -151,15 +151,15 @@ func bitcompl64(a, b uint64) (n uint64) {
************************************/ ************************************/
func bitcheck32_constleft(a uint32) (n int) { func bitcheck32_constleft(a uint32) (n int) {
// amd64:"BTL\t[$]31" // amd64:"BTL [$]31"
if a&(1<<31) != 0 { if a&(1<<31) != 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]28" // amd64:"BTL [$]28"
if a&(1<<28) != 0 { if a&(1<<28) != 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]0" // amd64:"BTL [$]0"
if a&(1<<0) != 0 { if a&(1<<0) != 0 {
return 1 return 1
} }
@ -167,31 +167,31 @@ func bitcheck32_constleft(a uint32) (n int) {
} }
func bitcheck32_constright(a [8]uint32) (n int) { func bitcheck32_constright(a [8]uint32) (n int) {
// amd64:"BTL\t[$]31" // amd64:"BTL [$]31"
if (a[0]>>31)&1 != 0 { if (a[0]>>31)&1 != 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]31" // amd64:"BTL [$]31"
if a[1]>>31 != 0 { if a[1]>>31 != 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]31" // amd64:"BTL [$]31"
if a[2]>>31 == 0 { if a[2]>>31 == 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]28" // amd64:"BTL [$]28"
if (a[3]>>28)&1 == 0 { if (a[3]>>28)&1 == 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]1" // amd64:"BTL [$]1"
if (a[4]>>1)&1 == 0 { if (a[4]>>1)&1 == 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]0" // amd64:"BTL [$]0"
if (a[5]>>0)&1 == 0 { if (a[5]>>0)&1 == 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]7" // amd64:"BTL [$]7"
if (a[6]>>5)&4 == 0 { if (a[6]>>5)&4 == 0 {
return 1 return 1
} }
@ -203,7 +203,7 @@ func bitcheck32_var(a, b uint32) (n int) {
if a&(1<<(b&31)) != 0 { if a&(1<<(b&31)) != 0 {
return 1 return 1
} }
// amd64:"BTL",-"BT.\t[$]0" // amd64:"BTL" -"BT. [$]0"
if (b>>(a&31))&1 != 0 { if (b>>(a&31))&1 != 0 {
return 1 return 1
} }
@ -211,15 +211,15 @@ func bitcheck32_var(a, b uint32) (n int) {
} }
func bitcheck32_mask(a uint32) (n int) { func bitcheck32_mask(a uint32) (n int) {
// amd64:"BTL\t[$]31" // amd64:"BTL [$]31"
if a&0x80000000 != 0 { if a&0x80000000 != 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]27" // amd64:"BTL [$]27"
if a&0x8000000 != 0 { if a&0x8000000 != 0 {
return 1 return 1
} }
// amd64:"BTL\t[$]0" // amd64:"BTL [$]0"
if a&0x1 != 0 { if a&0x1 != 0 {
return 1 return 1
} }
@ -230,13 +230,13 @@ func biton32(a, b uint32) (n uint32) {
// amd64:"BTSL" // amd64:"BTSL"
n += b | (1 << (a & 31)) n += b | (1 << (a & 31))
// amd64:"ORL\t[$]-2147483648" // amd64:"ORL [$]-2147483648"
n += a | (1 << 31) n += a | (1 << 31)
// amd64:"ORL\t[$]268435456" // amd64:"ORL [$]268435456"
n += a | (1 << 28) n += a | (1 << 28)
// amd64:"ORL\t[$]1" // amd64:"ORL [$]1"
n += a | (1 << 0) n += a | (1 << 0)
return n return n
@ -246,13 +246,13 @@ func bitoff32(a, b uint32) (n uint32) {
// amd64:"BTRL" // amd64:"BTRL"
n += b &^ (1 << (a & 31)) n += b &^ (1 << (a & 31))
// amd64:"ANDL\t[$]2147483647" // amd64:"ANDL [$]2147483647"
n += a &^ (1 << 31) n += a &^ (1 << 31)
// amd64:"ANDL\t[$]-268435457" // amd64:"ANDL [$]-268435457"
n += a &^ (1 << 28) n += a &^ (1 << 28)
// amd64:"ANDL\t[$]-2" // amd64:"ANDL [$]-2"
n += a &^ (1 << 0) n += a &^ (1 << 0)
return n return n
@ -262,13 +262,13 @@ func bitcompl32(a, b uint32) (n uint32) {
// amd64:"BTCL" // amd64:"BTCL"
n += b ^ (1 << (a & 31)) n += b ^ (1 << (a & 31))
// amd64:"XORL\t[$]-2147483648" // amd64:"XORL [$]-2147483648"
n += a ^ (1 << 31) n += a ^ (1 << 31)
// amd64:"XORL\t[$]268435456" // amd64:"XORL [$]268435456"
n += a ^ (1 << 28) n += a ^ (1 << 28)
// amd64:"XORL\t[$]1" // amd64:"XORL [$]1"
n += a ^ (1 << 0) n += a ^ (1 << 0)
return n return n
@ -292,12 +292,12 @@ func bitcheckMostNegative(b uint8) bool {
// Check AND masking on arm64 (Issue #19857) // Check AND masking on arm64 (Issue #19857)
func and_mask_1(a uint64) uint64 { func and_mask_1(a uint64) uint64 {
// arm64:`AND\t` // arm64:`AND `
return a & ((1 << 63) - 1) return a & ((1 << 63) - 1)
} }
func and_mask_2(a uint64) uint64 { func and_mask_2(a uint64) uint64 {
// arm64:`AND\t` // arm64:`AND `
return a & (1 << 63) return a & (1 << 63)
} }
@ -312,65 +312,65 @@ func and_mask_3(a, b uint32) (uint32, uint32) {
// Check generation of arm64 BIC/EON/ORN instructions // Check generation of arm64 BIC/EON/ORN instructions
func op_bic(x, y uint32) uint32 { func op_bic(x, y uint32) uint32 {
// arm64:`BIC\t`,-`AND` // arm64:`BIC `,-`AND`
return x &^ y return x &^ y
} }
func op_eon(x, y, z uint32, a []uint32, n, m uint64) uint64 { func op_eon(x, y, z uint32, a []uint32, n, m uint64) uint64 {
// arm64:`EON\t`,-`EOR`,-`MVN` // arm64:`EON `,-`EOR`,-`MVN`
a[0] = x ^ (y ^ 0xffffffff) a[0] = x ^ (y ^ 0xffffffff)
// arm64:`EON\t`,-`EOR`,-`MVN` // arm64:`EON `,-`EOR`,-`MVN`
a[1] = ^(y ^ z) a[1] = ^(y ^ z)
// arm64:`EON\t`,-`XOR` // arm64:`EON `,-`XOR`
a[2] = x ^ ^z a[2] = x ^ ^z
// arm64:`EON\t`,-`EOR`,-`MVN` // arm64:`EON `,-`EOR`,-`MVN`
return n ^ (m ^ 0xffffffffffffffff) return n ^ (m ^ 0xffffffffffffffff)
} }
func op_orn(x, y uint32) uint32 { func op_orn(x, y uint32) uint32 {
// arm64:`ORN\t`,-`ORR` // arm64:`ORN `,-`ORR`
// loong64:"ORN"\t,-"OR\t" // loong64:"ORN" ,-"OR "
return x | ^y return x | ^y
} }
func op_nor(x int64, a []int64) { func op_nor(x int64, a []int64) {
// loong64: "MOVV\t[$]0","NOR\tR" // loong64: "MOVV [$]0" "NOR R"
a[0] = ^(0x1234 | x) a[0] = ^(0x1234 | x)
// loong64:"NOR",-"XOR" // loong64:"NOR" -"XOR"
a[1] = (-1) ^ x a[1] = (-1) ^ x
// loong64: "MOVV\t[$]-55",-"OR",-"NOR" // loong64: "MOVV [$]-55" -"OR" -"NOR"
a[2] = ^(0x12 | 0x34) a[2] = ^(0x12 | 0x34)
} }
func op_andn(x, y uint32) uint32 { func op_andn(x, y uint32) uint32 {
// loong64:"ANDN\t",-"AND\t" // loong64:"ANDN " -"AND "
return x &^ y return x &^ y
} }
// check bitsets // check bitsets
func bitSetPowerOf2Test(x int) bool { func bitSetPowerOf2Test(x int) bool {
// amd64:"BTL\t[$]3" // amd64:"BTL [$]3"
return x&8 == 8 return x&8 == 8
} }
func bitSetTest(x int) bool { func bitSetTest(x int) bool {
// amd64:"ANDL\t[$]9, AX" // amd64:"ANDL [$]9, AX"
// amd64:"CMPQ\tAX, [$]9" // amd64:"CMPQ AX, [$]9"
return x&9 == 9 return x&9 == 9
} }
// mask contiguous one bits // mask contiguous one bits
func cont1Mask64U(x uint64) uint64 { func cont1Mask64U(x uint64) uint64 {
// s390x:"RISBGZ\t[$]16, [$]47, [$]0," // s390x:"RISBGZ [$]16, [$]47, [$]0,"
return x & 0x0000ffffffff0000 return x & 0x0000ffffffff0000
} }
// mask contiguous zero bits // mask contiguous zero bits
func cont0Mask64U(x uint64) uint64 { func cont0Mask64U(x uint64) uint64 {
// s390x:"RISBGZ\t[$]48, [$]15, [$]0," // s390x:"RISBGZ [$]48, [$]15, [$]0,"
return x & 0xffff00000000ffff return x & 0xffff00000000ffff
} }
@ -390,60 +390,60 @@ func issue48467(x, y uint64) uint64 {
} }
func foldConst(x, y uint64) uint64 { func foldConst(x, y uint64) uint64 {
// arm64: "ADDS\t[$]7",-"MOVD\t[$]7" // arm64: "ADDS [$]7" -"MOVD [$]7"
// ppc64x: "ADDC\t[$]7," // ppc64x: "ADDC [$]7,"
d, b := bits.Add64(x, 7, 0) d, b := bits.Add64(x, 7, 0)
return b & d return b & d
} }
func foldConstOutOfRange(a uint64) uint64 { func foldConstOutOfRange(a uint64) uint64 {
// arm64: "MOVD\t[$]19088744",-"ADD\t[$]19088744" // arm64: "MOVD [$]19088744" -"ADD [$]19088744"
return a + 0x1234568 return a + 0x1234568
} }
// Verify sign-extended values are not zero-extended under a bit mask (#61297) // Verify sign-extended values are not zero-extended under a bit mask (#61297)
func signextendAndMask8to64(a int8) (s, z uint64) { func signextendAndMask8to64(a int8) (s, z uint64) {
// ppc64x: "MOVB", "ANDCC\t[$]1015," // ppc64x: "MOVB", "ANDCC [$]1015,"
s = uint64(a) & 0x3F7 s = uint64(a) & 0x3F7
// ppc64x: -"MOVB", "ANDCC\t[$]247," // ppc64x: -"MOVB", "ANDCC [$]247,"
z = uint64(uint8(a)) & 0x3F7 z = uint64(uint8(a)) & 0x3F7
return return
} }
// Verify zero-extended values are not sign-extended under a bit mask (#61297) // Verify zero-extended values are not sign-extended under a bit mask (#61297)
func zeroextendAndMask8to64(a int8, b int16) (x, y uint64) { func zeroextendAndMask8to64(a int8, b int16) (x, y uint64) {
// ppc64x: -"MOVB\t", -"ANDCC", "MOVBZ" // ppc64x: -"MOVB ", -"ANDCC", "MOVBZ"
x = uint64(a) & 0xFF x = uint64(a) & 0xFF
// ppc64x: -"MOVH\t", -"ANDCC", "MOVHZ" // ppc64x: -"MOVH ", -"ANDCC", "MOVHZ"
y = uint64(b) & 0xFFFF y = uint64(b) & 0xFFFF
return return
} }
// Verify rotate and mask instructions, and further simplified instructions for small types // Verify rotate and mask instructions, and further simplified instructions for small types
func bitRotateAndMask(io64 [8]uint64, io32 [4]uint32, io16 [4]uint16, io8 [4]uint8) { func bitRotateAndMask(io64 [8]uint64, io32 [4]uint32, io16 [4]uint16, io8 [4]uint8) {
// ppc64x: "RLDICR\t[$]0, R[0-9]*, [$]47, R" // ppc64x: "RLDICR [$]0, R[0-9]*, [$]47, R"
io64[0] = io64[0] & 0xFFFFFFFFFFFF0000 io64[0] = io64[0] & 0xFFFFFFFFFFFF0000
// ppc64x: "RLDICL\t[$]0, R[0-9]*, [$]16, R" // ppc64x: "RLDICL [$]0, R[0-9]*, [$]16, R"
io64[1] = io64[1] & 0x0000FFFFFFFFFFFF io64[1] = io64[1] & 0x0000FFFFFFFFFFFF
// ppc64x: -"SRD", -"AND", "RLDICL\t[$]60, R[0-9]*, [$]16, R" // ppc64x: -"SRD", -"AND", "RLDICL [$]60, R[0-9]*, [$]16, R"
io64[2] = (io64[2] >> 4) & 0x0000FFFFFFFFFFFF io64[2] = (io64[2] >> 4) & 0x0000FFFFFFFFFFFF
// ppc64x: -"SRD", -"AND", "RLDICL\t[$]36, R[0-9]*, [$]28, R" // ppc64x: -"SRD", -"AND", "RLDICL [$]36, R[0-9]*, [$]28, R"
io64[3] = (io64[3] >> 28) & 0x0000FFFFFFFFFFFF io64[3] = (io64[3] >> 28) & 0x0000FFFFFFFFFFFF
// ppc64x: "MOVWZ", "RLWNM\t[$]1, R[0-9]*, [$]28, [$]3, R" // ppc64x: "MOVWZ", "RLWNM [$]1, R[0-9]*, [$]28, [$]3, R"
io64[4] = uint64(bits.RotateLeft32(io32[0], 1) & 0xF000000F) io64[4] = uint64(bits.RotateLeft32(io32[0], 1) & 0xF000000F)
// ppc64x: "RLWNM\t[$]0, R[0-9]*, [$]4, [$]19, R" // ppc64x: "RLWNM [$]0, R[0-9]*, [$]4, [$]19, R"
io32[0] = io32[0] & 0x0FFFF000 io32[0] = io32[0] & 0x0FFFF000
// ppc64x: "RLWNM\t[$]0, R[0-9]*, [$]20, [$]3, R" // ppc64x: "RLWNM [$]0, R[0-9]*, [$]20, [$]3, R"
io32[1] = io32[1] & 0xF0000FFF io32[1] = io32[1] & 0xF0000FFF
// ppc64x: -"RLWNM", MOVD, AND // ppc64x: -"RLWNM", MOVD, AND
io32[2] = io32[2] & 0xFFFF0002 io32[2] = io32[2] & 0xFFFF0002
var bigc uint32 = 0x12345678 var bigc uint32 = 0x12345678
// ppc64x: "ANDCC\t[$]22136" // ppc64x: "ANDCC [$]22136"
io16[0] = io16[0] & uint16(bigc) io16[0] = io16[0] & uint16(bigc)
// ppc64x: "ANDCC\t[$]120" // ppc64x: "ANDCC [$]120"
io8[0] = io8[0] & uint8(bigc) io8[0] = io8[0] & uint8(bigc)
} }

View file

@ -47,41 +47,41 @@ func blsr32(x int32) int32 {
} }
func isPowerOfTwo64(x int64) bool { func isPowerOfTwo64(x int64) bool {
// amd64/v3:"BLSRQ",-"TESTQ",-"CALL" // amd64/v3:"BLSRQ" -"TESTQ" -"CALL"
return blsr64(x) == 0 return blsr64(x) == 0
} }
func isPowerOfTwo32(x int32) bool { func isPowerOfTwo32(x int32) bool {
// amd64/v3:"BLSRL",-"TESTL",-"CALL" // amd64/v3:"BLSRL" -"TESTL" -"CALL"
return blsr32(x) == 0 return blsr32(x) == 0
} }
func isPowerOfTwoSelect64(x, a, b int64) int64 { func isPowerOfTwoSelect64(x, a, b int64) int64 {
var r int64 var r int64
// amd64/v3:"BLSRQ",-"TESTQ",-"CALL" // amd64/v3:"BLSRQ" -"TESTQ" -"CALL"
if isPowerOfTwo64(x) { if isPowerOfTwo64(x) {
r = a r = a
} else { } else {
r = b r = b
} }
// amd64/v3:"CMOVQEQ",-"TESTQ",-"CALL" // amd64/v3:"CMOVQEQ" -"TESTQ" -"CALL"
return r * 2 // force return blocks joining return r * 2 // force return blocks joining
} }
func isPowerOfTwoSelect32(x, a, b int32) int32 { func isPowerOfTwoSelect32(x, a, b int32) int32 {
var r int32 var r int32
// amd64/v3:"BLSRL",-"TESTL",-"CALL" // amd64/v3:"BLSRL" -"TESTL" -"CALL"
if isPowerOfTwo32(x) { if isPowerOfTwo32(x) {
r = a r = a
} else { } else {
r = b r = b
} }
// amd64/v3:"CMOVLEQ",-"TESTL",-"CALL" // amd64/v3:"CMOVLEQ" -"TESTL" -"CALL"
return r * 2 // force return blocks joining return r * 2 // force return blocks joining
} }
func isPowerOfTwoBranch64(x int64, a func(bool), b func(string)) { func isPowerOfTwoBranch64(x int64, a func(bool), b func(string)) {
// amd64/v3:"BLSRQ",-"TESTQ",-"CALL" // amd64/v3:"BLSRQ" -"TESTQ" -"CALL"
if isPowerOfTwo64(x) { if isPowerOfTwo64(x) {
a(true) a(true)
} else { } else {
@ -90,7 +90,7 @@ func isPowerOfTwoBranch64(x int64, a func(bool), b func(string)) {
} }
func isPowerOfTwoBranch32(x int32, a func(bool), b func(string)) { func isPowerOfTwoBranch32(x int32, a func(bool), b func(string)) {
// amd64/v3:"BLSRL",-"TESTL",-"CALL" // amd64/v3:"BLSRL" -"TESTL" -"CALL"
if isPowerOfTwo32(x) { if isPowerOfTwo32(x) {
a(true) a(true)
} else { } else {
@ -99,41 +99,41 @@ func isPowerOfTwoBranch32(x int32, a func(bool), b func(string)) {
} }
func isNotPowerOfTwo64(x int64) bool { func isNotPowerOfTwo64(x int64) bool {
// amd64/v3:"BLSRQ",-"TESTQ",-"CALL" // amd64/v3:"BLSRQ" -"TESTQ" -"CALL"
return blsr64(x) != 0 return blsr64(x) != 0
} }
func isNotPowerOfTwo32(x int32) bool { func isNotPowerOfTwo32(x int32) bool {
// amd64/v3:"BLSRL",-"TESTL",-"CALL" // amd64/v3:"BLSRL" -"TESTL" -"CALL"
return blsr32(x) != 0 return blsr32(x) != 0
} }
func isNotPowerOfTwoSelect64(x, a, b int64) int64 { func isNotPowerOfTwoSelect64(x, a, b int64) int64 {
var r int64 var r int64
// amd64/v3:"BLSRQ",-"TESTQ",-"CALL" // amd64/v3:"BLSRQ" -"TESTQ" -"CALL"
if isNotPowerOfTwo64(x) { if isNotPowerOfTwo64(x) {
r = a r = a
} else { } else {
r = b r = b
} }
// amd64/v3:"CMOVQNE",-"TESTQ",-"CALL" // amd64/v3:"CMOVQNE" -"TESTQ" -"CALL"
return r * 2 // force return blocks joining return r * 2 // force return blocks joining
} }
func isNotPowerOfTwoSelect32(x, a, b int32) int32 { func isNotPowerOfTwoSelect32(x, a, b int32) int32 {
var r int32 var r int32
// amd64/v3:"BLSRL",-"TESTL",-"CALL" // amd64/v3:"BLSRL" -"TESTL" -"CALL"
if isNotPowerOfTwo32(x) { if isNotPowerOfTwo32(x) {
r = a r = a
} else { } else {
r = b r = b
} }
// amd64/v3:"CMOVLNE",-"TESTL",-"CALL" // amd64/v3:"CMOVLNE" -"TESTL" -"CALL"
return r * 2 // force return blocks joining return r * 2 // force return blocks joining
} }
func isNotPowerOfTwoBranch64(x int64, a func(bool), b func(string)) { func isNotPowerOfTwoBranch64(x int64, a func(bool), b func(string)) {
// amd64/v3:"BLSRQ",-"TESTQ",-"CALL" // amd64/v3:"BLSRQ" -"TESTQ" -"CALL"
if isNotPowerOfTwo64(x) { if isNotPowerOfTwo64(x) {
a(true) a(true)
} else { } else {
@ -142,7 +142,7 @@ func isNotPowerOfTwoBranch64(x int64, a func(bool), b func(string)) {
} }
func isNotPowerOfTwoBranch32(x int32, a func(bool), b func(string)) { func isNotPowerOfTwoBranch32(x int32, a func(bool), b func(string)) {
// amd64/v3:"BLSRL",-"TESTL",-"CALL" // amd64/v3:"BLSRL" -"TESTL" -"CALL"
if isNotPowerOfTwo32(x) { if isNotPowerOfTwo32(x) {
a(true) a(true)
} else { } else {
@ -161,17 +161,17 @@ func sarx32(x, y int32) int32 {
} }
func sarx64_load(x []int64, i int) int64 { func sarx64_load(x []int64, i int) int64 {
// amd64/v3: `SARXQ\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64/v3: `SARXQ [A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s := x[i] >> (i & 63) s := x[i] >> (i & 63)
// amd64/v3: `SARXQ\t[A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64/v3: `SARXQ [A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s = x[i+1] >> (s & 63) s = x[i+1] >> (s & 63)
return s return s
} }
func sarx32_load(x []int32, i int) int32 { func sarx32_load(x []int32, i int) int32 {
// amd64/v3: `SARXL\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64/v3: `SARXL [A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s := x[i] >> (i & 63) s := x[i] >> (i & 63)
// amd64/v3: `SARXL\t[A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64/v3: `SARXL [A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s = x[i+1] >> (s & 63) s = x[i+1] >> (s & 63)
return s return s
} }
@ -193,17 +193,17 @@ func shlrx32(x, y uint32) uint32 {
} }
func shlrx64_load(x []uint64, i int, s uint64) uint64 { func shlrx64_load(x []uint64, i int, s uint64) uint64 {
// amd64/v3: `SHRXQ\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64/v3: `SHRXQ [A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s = x[i] >> i s = x[i] >> i
// amd64/v3: `SHLXQ\t[A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64/v3: `SHLXQ [A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s = x[i+1] << s s = x[i+1] << s
return s return s
} }
func shlrx32_load(x []uint32, i int, s uint32) uint32 { func shlrx32_load(x []uint32, i int, s uint32) uint32 {
// amd64/v3: `SHRXL\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64/v3: `SHRXL [A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s = x[i] >> i s = x[i] >> i
// amd64/v3: `SHLXL\t[A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64/v3: `SHLXL [A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s = x[i+1] << s s = x[i+1] << s
return s return s
} }

View file

@ -13,52 +13,52 @@ import (
// This file contains codegen tests related to boolean simplifications/optimizations. // This file contains codegen tests related to boolean simplifications/optimizations.
func convertNeq0B(x uint8, c bool) bool { func convertNeq0B(x uint8, c bool) bool {
// amd64:"ANDL\t[$]1",-"SETNE" // amd64:"ANDL [$]1" -"SETNE"
// ppc64x:"RLDICL",-"CMPW",-"ISEL" // ppc64x:"RLDICL" -"CMPW" -"ISEL"
b := x&1 != 0 b := x&1 != 0
return c && b return c && b
} }
func convertNeq0W(x uint16, c bool) bool { func convertNeq0W(x uint16, c bool) bool {
// amd64:"ANDL\t[$]1",-"SETNE" // amd64:"ANDL [$]1" -"SETNE"
// ppc64x:"RLDICL",-"CMPW",-"ISEL" // ppc64x:"RLDICL" -"CMPW" -"ISEL"
b := x&1 != 0 b := x&1 != 0
return c && b return c && b
} }
func convertNeq0L(x uint32, c bool) bool { func convertNeq0L(x uint32, c bool) bool {
// amd64:"ANDL\t[$]1",-"SETB" // amd64:"ANDL [$]1" -"SETB"
// ppc64x:"RLDICL",-"CMPW",-"ISEL" // ppc64x:"RLDICL" -"CMPW" -"ISEL"
b := x&1 != 0 b := x&1 != 0
return c && b return c && b
} }
func convertNeq0Q(x uint64, c bool) bool { func convertNeq0Q(x uint64, c bool) bool {
// amd64:"ANDL\t[$]1",-"SETB" // amd64:"ANDL [$]1" -"SETB"
// ppc64x:"RLDICL",-"CMP",-"ISEL" // ppc64x:"RLDICL" -"CMP" -"ISEL"
b := x&1 != 0 b := x&1 != 0
return c && b return c && b
} }
func convertNeqBool32(x uint32) bool { func convertNeqBool32(x uint32) bool {
// ppc64x:"RLDICL",-"CMPW",-"ISEL" // ppc64x:"RLDICL" -"CMPW" -"ISEL"
return x&1 != 0 return x&1 != 0
} }
func convertEqBool32(x uint32) bool { func convertEqBool32(x uint32) bool {
// ppc64x:"RLDICL",-"CMPW","XOR",-"ISEL" // ppc64x:"RLDICL" -"CMPW" "XOR" -"ISEL"
// amd64:"ANDL","XORL",-"BTL",-"SETCC" // amd64:"ANDL" "XORL" -"BTL" -"SETCC"
return x&1 == 0 return x&1 == 0
} }
func convertNeqBool64(x uint64) bool { func convertNeqBool64(x uint64) bool {
// ppc64x:"RLDICL",-"CMP",-"ISEL" // ppc64x:"RLDICL" -"CMP" -"ISEL"
return x&1 != 0 return x&1 != 0
} }
func convertEqBool64(x uint64) bool { func convertEqBool64(x uint64) bool {
// ppc64x:"RLDICL","XOR",-"CMP",-"ISEL" // ppc64x:"RLDICL" "XOR" -"CMP" -"ISEL"
// amd64:"ANDL","XORL",-"BTL",-"SETCC" // amd64:"ANDL" "XORL" -"BTL" -"SETCC"
return x&1 == 0 return x&1 == 0
} }
@ -87,157 +87,157 @@ func phiOr(a, b bool) bool {
} }
func TestSetEq64(x uint64, y uint64) bool { func TestSetEq64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBC\tCR0EQ",-"ISEL" // ppc64x/power10:"SETBC CR0EQ" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0EQ" // ppc64x/power9:"CMP" "ISEL" -"SETBC CR0EQ"
// ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0EQ" // ppc64x/power8:"CMP" "ISEL" -"SETBC CR0EQ"
b := x == y b := x == y
return b return b
} }
func TestSetNeq64(x uint64, y uint64) bool { func TestSetNeq64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBCR\tCR0EQ",-"ISEL" // ppc64x/power10:"SETBCR CR0EQ" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0EQ" // ppc64x/power9:"CMP" "ISEL" -"SETBCR CR0EQ"
// ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0EQ" // ppc64x/power8:"CMP" "ISEL" -"SETBCR CR0EQ"
b := x != y b := x != y
return b return b
} }
func TestSetLt64(x uint64, y uint64) bool { func TestSetLt64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBC\tCR0GT",-"ISEL" // ppc64x/power10:"SETBC CR0GT" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0GT" // ppc64x/power9:"CMP" "ISEL" -"SETBC CR0GT"
// ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0GT" // ppc64x/power8:"CMP" "ISEL" -"SETBC CR0GT"
b := x < y b := x < y
return b return b
} }
func TestSetLe64(x uint64, y uint64) bool { func TestSetLe64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBCR\tCR0LT",-"ISEL" // ppc64x/power10:"SETBCR CR0LT" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0LT" // ppc64x/power9:"CMP" "ISEL" -"SETBCR CR0LT"
// ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0LT" // ppc64x/power8:"CMP" "ISEL" -"SETBCR CR0LT"
b := x <= y b := x <= y
return b return b
} }
func TestSetGt64(x uint64, y uint64) bool { func TestSetGt64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBC\tCR0LT",-"ISEL" // ppc64x/power10:"SETBC CR0LT" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power9:"CMP" "ISEL" -"SETBC CR0LT"
// ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power8:"CMP" "ISEL" -"SETBC CR0LT"
b := x > y b := x > y
return b return b
} }
func TestSetGe64(x uint64, y uint64) bool { func TestSetGe64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBCR\tCR0GT",-"ISEL" // ppc64x/power10:"SETBCR CR0GT" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0GT" // ppc64x/power9:"CMP" "ISEL" -"SETBCR CR0GT"
// ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0GT" // ppc64x/power8:"CMP" "ISEL" -"SETBCR CR0GT"
b := x >= y b := x >= y
return b return b
} }
func TestSetLtFp64(x float64, y float64) bool { func TestSetLtFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBC\tCR0LT",-"ISEL" // ppc64x/power10:"SETBC CR0LT" -"ISEL"
// ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power9:"FCMP" "ISEL" -"SETBC CR0LT"
// ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power8:"FCMP" "ISEL" -"SETBC CR0LT"
b := x < y b := x < y
return b return b
} }
func TestSetLeFp64(x float64, y float64) bool { func TestSetLeFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBC\tCR0LT","SETBC\tCR0EQ","OR",-"ISEL",-"ISEL" // ppc64x/power10:"SETBC CR0LT" "SETBC CR0EQ" "OR" -"ISEL" -"ISEL"
// ppc64x/power9:"ISEL","ISEL",-"SETBC\tCR0LT",-"SETBC\tCR0EQ","OR" // ppc64x/power9:"ISEL" "ISEL" -"SETBC CR0LT" -"SETBC CR0EQ" "OR"
// ppc64x/power8:"ISEL","ISEL",-"SETBC\tCR0LT",-"SETBC\tCR0EQ","OR" // ppc64x/power8:"ISEL" "ISEL" -"SETBC CR0LT" -"SETBC CR0EQ" "OR"
b := x <= y b := x <= y
return b return b
} }
func TestSetGtFp64(x float64, y float64) bool { func TestSetGtFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBC\tCR0LT",-"ISEL" // ppc64x/power10:"SETBC CR0LT" -"ISEL"
// ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power9:"FCMP" "ISEL" -"SETBC CR0LT"
// ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power8:"FCMP" "ISEL" -"SETBC CR0LT"
b := x > y b := x > y
return b return b
} }
func TestSetGeFp64(x float64, y float64) bool { func TestSetGeFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBC\tCR0LT","SETBC\tCR0EQ","OR",-"ISEL",-"ISEL" // ppc64x/power10:"SETBC CR0LT" "SETBC CR0EQ" "OR" -"ISEL" -"ISEL"
// ppc64x/power9:"ISEL","ISEL",-"SETBC\tCR0LT",-"SETBC\tCR0EQ","OR" // ppc64x/power9:"ISEL" "ISEL" -"SETBC CR0LT" -"SETBC CR0EQ" "OR"
// ppc64x/power8:"ISEL","ISEL",-"SETBC\tCR0LT",-"SETBC\tCR0EQ","OR" // ppc64x/power8:"ISEL" "ISEL" -"SETBC CR0LT" -"SETBC CR0EQ" "OR"
b := x >= y b := x >= y
return b return b
} }
func TestSetInvEq64(x uint64, y uint64) bool { func TestSetInvEq64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBCR\tCR0EQ",-"ISEL" // ppc64x/power10:"SETBCR CR0EQ" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0EQ" // ppc64x/power9:"CMP" "ISEL" -"SETBCR CR0EQ"
// ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0EQ" // ppc64x/power8:"CMP" "ISEL" -"SETBCR CR0EQ"
b := !(x == y) b := !(x == y)
return b return b
} }
func TestSetInvNeq64(x uint64, y uint64) bool { func TestSetInvNeq64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBC\tCR0EQ",-"ISEL" // ppc64x/power10:"SETBC CR0EQ" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0EQ" // ppc64x/power9:"CMP" "ISEL" -"SETBC CR0EQ"
// ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0EQ" // ppc64x/power8:"CMP" "ISEL" -"SETBC CR0EQ"
b := !(x != y) b := !(x != y)
return b return b
} }
func TestSetInvLt64(x uint64, y uint64) bool { func TestSetInvLt64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBCR\tCR0GT",-"ISEL" // ppc64x/power10:"SETBCR CR0GT" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0GT" // ppc64x/power9:"CMP" "ISEL" -"SETBCR CR0GT"
// ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0GT" // ppc64x/power8:"CMP" "ISEL" -"SETBCR CR0GT"
b := !(x < y) b := !(x < y)
return b return b
} }
func TestSetInvLe64(x uint64, y uint64) bool { func TestSetInvLe64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBC\tCR0LT",-"ISEL" // ppc64x/power10:"SETBC CR0LT" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power9:"CMP" "ISEL" -"SETBC CR0LT"
// ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power8:"CMP" "ISEL" -"SETBC CR0LT"
b := !(x <= y) b := !(x <= y)
return b return b
} }
func TestSetInvGt64(x uint64, y uint64) bool { func TestSetInvGt64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBCR\tCR0LT",-"ISEL" // ppc64x/power10:"SETBCR CR0LT" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0LT" // ppc64x/power9:"CMP" "ISEL" -"SETBCR CR0LT"
// ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0LT" // ppc64x/power8:"CMP" "ISEL" -"SETBCR CR0LT"
b := !(x > y) b := !(x > y)
return b return b
} }
func TestSetInvGe64(x uint64, y uint64) bool { func TestSetInvGe64(x uint64, y uint64) bool {
// ppc64x/power10:"SETBC\tCR0GT",-"ISEL" // ppc64x/power10:"SETBC CR0GT" -"ISEL"
// ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0GT" // ppc64x/power9:"CMP" "ISEL" -"SETBC CR0GT"
// ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0GT" // ppc64x/power8:"CMP" "ISEL" -"SETBC CR0GT"
b := !(x >= y) b := !(x >= y)
return b return b
} }
func TestSetInvEqFp64(x float64, y float64) bool { func TestSetInvEqFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBCR\tCR0EQ",-"ISEL" // ppc64x/power10:"SETBCR CR0EQ" -"ISEL"
// ppc64x/power9:"FCMP","ISEL",-"SETBCR\tCR0EQ" // ppc64x/power9:"FCMP" "ISEL" -"SETBCR CR0EQ"
// ppc64x/power8:"FCMP","ISEL",-"SETBCR\tCR0EQ" // ppc64x/power8:"FCMP" "ISEL" -"SETBCR CR0EQ"
b := !(x == y) b := !(x == y)
return b return b
} }
func TestSetInvNeqFp64(x float64, y float64) bool { func TestSetInvNeqFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBC\tCR0EQ",-"ISEL" // ppc64x/power10:"SETBC CR0EQ" -"ISEL"
// ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0EQ" // ppc64x/power9:"FCMP" "ISEL" -"SETBC CR0EQ"
// ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0EQ" // ppc64x/power8:"FCMP" "ISEL" -"SETBC CR0EQ"
b := !(x != y) b := !(x != y)
return b return b
} }
func TestSetInvLtFp64(x float64, y float64) bool { func TestSetInvLtFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBCR\tCR0LT",-"ISEL" // ppc64x/power10:"SETBCR CR0LT" -"ISEL"
// ppc64x/power9:"FCMP","ISEL",-"SETBCR\tCR0LT" // ppc64x/power9:"FCMP" "ISEL" -"SETBCR CR0LT"
// ppc64x/power8:"FCMP","ISEL",-"SETBCR\tCR0LT" // ppc64x/power8:"FCMP" "ISEL" -"SETBCR CR0LT"
b := !(x < y) b := !(x < y)
return b return b
} }
func TestSetInvLeFp64(x float64, y float64) bool { func TestSetInvLeFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBC\tCR0LT",-"ISEL" // ppc64x/power10:"SETBC CR0LT" -"ISEL"
// ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power9:"FCMP" "ISEL" -"SETBC CR0LT"
// ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power8:"FCMP" "ISEL" -"SETBC CR0LT"
b := !(x <= y) b := !(x <= y)
return b return b
} }
func TestSetInvGtFp64(x float64, y float64) bool { func TestSetInvGtFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBCR\tCR0LT",-"ISEL" // ppc64x/power10:"SETBCR CR0LT" -"ISEL"
// ppc64x/power9:"FCMP","ISEL",-"SETBCR\tCR0LT" // ppc64x/power9:"FCMP" "ISEL" -"SETBCR CR0LT"
// ppc64x/power8:"FCMP","ISEL",-"SETBCR\tCR0LT" // ppc64x/power8:"FCMP" "ISEL" -"SETBCR CR0LT"
b := !(x > y) b := !(x > y)
return b return b
} }
func TestSetInvGeFp64(x float64, y float64) bool { func TestSetInvGeFp64(x float64, y float64) bool {
// ppc64x/power10:"SETBC\tCR0LT",-"ISEL" // ppc64x/power10:"SETBC CR0LT" -"ISEL"
// ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power9:"FCMP" "ISEL" -"SETBC CR0LT"
// ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0LT" // ppc64x/power8:"FCMP" "ISEL" -"SETBC CR0LT"
b := !(x >= y) b := !(x >= y)
return b return b
} }
@ -293,7 +293,7 @@ func TestLogicalCompareZero(x *[64]uint64) {
x[12] = b x[12] = b
} }
// ppc64x:"ADDCCC\t[$]4," // ppc64x:"ADDCCC [$]4,"
c := int64(x[12]) + 4 c := int64(x[12]) + 4
if c <= 0 { if c <= 0 {
x[12] = uint64(c) x[12] = uint64(c)
@ -309,7 +309,7 @@ func TestLogicalCompareZero(x *[64]uint64) {
func constantWrite(b bool, p *bool) { func constantWrite(b bool, p *bool) {
if b { if b {
// amd64:`MOVB\t[$]1, \(` // amd64:`MOVB [$]1, \(`
*p = b *p = b
} }
} }

View file

@ -15,16 +15,16 @@ var p1, p2, p3 T
func F() { func F() {
// 3735936685 is 0xdeaddead. On ARM64 R27 is REGTMP. // 3735936685 is 0xdeaddead. On ARM64 R27 is REGTMP.
// clobber x, y at entry. not clobber z (stack object). // clobber x, y at entry. not clobber z (stack object).
// amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, `MOVL\t\$3735936685, command-line-arguments\.y`, -`MOVL\t\$3735936685, command-line-arguments\.z` // amd64:`MOVL \$3735936685, command-line-arguments\.x`, `MOVL \$3735936685, command-line-arguments\.y`, -`MOVL \$3735936685, command-line-arguments\.z`
// arm64:`MOVW\tR27, command-line-arguments\.x`, `MOVW\tR27, command-line-arguments\.y`, -`MOVW\tR27, command-line-arguments\.z` // arm64:`MOVW R27, command-line-arguments\.x`, `MOVW R27, command-line-arguments\.y`, -`MOVW R27, command-line-arguments\.z`
x, y, z := p1, p2, p3 x, y, z := p1, p2, p3
addrTaken(&z) addrTaken(&z)
// x is dead at the call (the value of x is loaded before the CALL), y is not // x is dead at the call (the value of x is loaded before the CALL), y is not
// amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, -`MOVL\t\$3735936685, command-line-arguments\.y` // amd64:`MOVL \$3735936685, command-line-arguments\.x`, -`MOVL \$3735936685, command-line-arguments\.y`
// arm64:`MOVW\tR27, command-line-arguments\.x`, -`MOVW\tR27, command-line-arguments\.y` // arm64:`MOVW R27, command-line-arguments\.x`, -`MOVW R27, command-line-arguments\.y`
use(x) use(x)
// amd64:`MOVL\t\$3735936685, command-line-arguments\.x`, `MOVL\t\$3735936685, command-line-arguments\.y` // amd64:`MOVL \$3735936685, command-line-arguments\.x`, `MOVL \$3735936685, command-line-arguments\.y`
// arm64:`MOVW\tR27, command-line-arguments\.x`, `MOVW\tR27, command-line-arguments\.y` // arm64:`MOVW R27, command-line-arguments\.x`, `MOVW R27, command-line-arguments\.y`
use(y) use(y)
} }

View file

@ -14,14 +14,14 @@ type S struct {
func F(a, b, c int, d S) { func F(a, b, c int, d S) {
// -2401018187971961171 is 0xdeaddeaddeaddead // -2401018187971961171 is 0xdeaddeaddeaddead
// amd64:`MOVQ\t\$-2401018187971961171, AX`, `MOVQ\t\$-2401018187971961171, BX`, `MOVQ\t\$-2401018187971961171, CX` // amd64:`MOVQ \$-2401018187971961171, AX`, `MOVQ \$-2401018187971961171, BX`, `MOVQ \$-2401018187971961171, CX`
// amd64:`MOVQ\t\$-2401018187971961171, DX`, `MOVQ\t\$-2401018187971961171, SI`, `MOVQ\t\$-2401018187971961171, DI` // amd64:`MOVQ \$-2401018187971961171, DX`, `MOVQ \$-2401018187971961171, SI`, `MOVQ \$-2401018187971961171, DI`
// amd64:`MOVQ\t\$-2401018187971961171, R8`, `MOVQ\t\$-2401018187971961171, R9`, `MOVQ\t\$-2401018187971961171, R10` // amd64:`MOVQ \$-2401018187971961171, R8`, `MOVQ \$-2401018187971961171, R9`, `MOVQ \$-2401018187971961171, R10`
// amd64:`MOVQ\t\$-2401018187971961171, R11`, `MOVQ\t\$-2401018187971961171, R12`, `MOVQ\t\$-2401018187971961171, R13` // amd64:`MOVQ \$-2401018187971961171, R11`, `MOVQ \$-2401018187971961171, R12`, `MOVQ \$-2401018187971961171, R13`
// amd64:-`MOVQ\t\$-2401018187971961171, BP` // frame pointer is not clobbered // amd64:-`MOVQ \$-2401018187971961171, BP` // frame pointer is not clobbered
StackArgsCall([10]int{a, b, c}) StackArgsCall([10]int{a, b, c})
// amd64:`MOVQ\t\$-2401018187971961171, R12`, `MOVQ\t\$-2401018187971961171, R13`, `MOVQ\t\$-2401018187971961171, DX` // amd64:`MOVQ \$-2401018187971961171, R12`, `MOVQ \$-2401018187971961171, R13`, `MOVQ \$-2401018187971961171, DX`
// amd64:-`MOVQ\t\$-2401018187971961171, AX`, -`MOVQ\t\$-2401018187971961171, R11` // register args are not clobbered // amd64:-`MOVQ \$-2401018187971961171, AX`, -`MOVQ \$-2401018187971961171, R11` // register args are not clobbered
RegArgsCall(a, b, c, d) RegArgsCall(a, b, c, d)
} }

View file

@ -11,12 +11,12 @@ func dummy() {}
// Signed 64-bit compare-and-branch. // Signed 64-bit compare-and-branch.
func si64(x, y chan int64) { func si64(x, y chan int64) {
// s390x:"CGRJ\t[$](2|4), R[0-9]+, R[0-9]+, " // s390x:"CGRJ [$](2|4), R[0-9]+, R[0-9]+, "
for <-x < <-y { for <-x < <-y {
dummy() dummy()
} }
// s390x:"CL?GRJ\t[$]8, R[0-9]+, R[0-9]+, " // s390x:"CL?GRJ [$]8, R[0-9]+, R[0-9]+, "
for <-x == <-y { for <-x == <-y {
dummy() dummy()
} }
@ -25,22 +25,22 @@ func si64(x, y chan int64) {
// Signed 64-bit compare-and-branch with 8-bit immediate. // Signed 64-bit compare-and-branch with 8-bit immediate.
func si64x8(doNotOptimize int64) { func si64x8(doNotOptimize int64) {
// take in doNotOptimize as an argument to avoid the loops being rewritten to count down // take in doNotOptimize as an argument to avoid the loops being rewritten to count down
// s390x:"CGIJ\t[$]12, R[0-9]+, [$]127, " // s390x:"CGIJ [$]12, R[0-9]+, [$]127, "
for i := doNotOptimize; i < 128; i++ { for i := doNotOptimize; i < 128; i++ {
dummy() dummy()
} }
// s390x:"CGIJ\t[$]10, R[0-9]+, [$]-128, " // s390x:"CGIJ [$]10, R[0-9]+, [$]-128, "
for i := doNotOptimize; i > -129; i-- { for i := doNotOptimize; i > -129; i-- {
dummy() dummy()
} }
// s390x:"CGIJ\t[$]2, R[0-9]+, [$]127, " // s390x:"CGIJ [$]2, R[0-9]+, [$]127, "
for i := doNotOptimize; i >= 128; i++ { for i := doNotOptimize; i >= 128; i++ {
dummy() dummy()
} }
// s390x:"CGIJ\t[$]4, R[0-9]+, [$]-128, " // s390x:"CGIJ [$]4, R[0-9]+, [$]-128, "
for i := doNotOptimize; i <= -129; i-- { for i := doNotOptimize; i <= -129; i-- {
dummy() dummy()
} }
@ -48,12 +48,12 @@ func si64x8(doNotOptimize int64) {
// Unsigned 64-bit compare-and-branch. // Unsigned 64-bit compare-and-branch.
func ui64(x, y chan uint64) { func ui64(x, y chan uint64) {
// s390x:"CLGRJ\t[$](2|4), R[0-9]+, R[0-9]+, " // s390x:"CLGRJ [$](2|4), R[0-9]+, R[0-9]+, "
for <-x > <-y { for <-x > <-y {
dummy() dummy()
} }
// s390x:"CL?GRJ\t[$]6, R[0-9]+, R[0-9]+, " // s390x:"CL?GRJ [$]6, R[0-9]+, R[0-9]+, "
for <-x != <-y { for <-x != <-y {
dummy() dummy()
} }
@ -61,22 +61,22 @@ func ui64(x, y chan uint64) {
// Unsigned 64-bit comparison with 8-bit immediate. // Unsigned 64-bit comparison with 8-bit immediate.
func ui64x8() { func ui64x8() {
// s390x:"CLGIJ\t[$]4, R[0-9]+, [$]128, " // s390x:"CLGIJ [$]4, R[0-9]+, [$]128, "
for i := uint64(0); i < 128; i++ { for i := uint64(0); i < 128; i++ {
dummy() dummy()
} }
// s390x:"CLGIJ\t[$]12, R[0-9]+, [$]255, " // s390x:"CLGIJ [$]12, R[0-9]+, [$]255, "
for i := uint64(0); i < 256; i++ { for i := uint64(0); i < 256; i++ {
dummy() dummy()
} }
// s390x:"CLGIJ\t[$]2, R[0-9]+, [$]255, " // s390x:"CLGIJ [$]2, R[0-9]+, [$]255, "
for i := uint64(257); i >= 256; i-- { for i := uint64(257); i >= 256; i-- {
dummy() dummy()
} }
// s390x:"CLGIJ\t[$]2, R[0-9]+, [$]0, " // s390x:"CLGIJ [$]2, R[0-9]+, [$]0, "
for i := uint64(1024); i > 0; i-- { for i := uint64(1024); i > 0; i-- {
dummy() dummy()
} }
@ -84,12 +84,12 @@ func ui64x8() {
// Signed 32-bit compare-and-branch. // Signed 32-bit compare-and-branch.
func si32(x, y chan int32) { func si32(x, y chan int32) {
// s390x:"CRJ\t[$](2|4), R[0-9]+, R[0-9]+, " // s390x:"CRJ [$](2|4), R[0-9]+, R[0-9]+, "
for <-x < <-y { for <-x < <-y {
dummy() dummy()
} }
// s390x:"CL?RJ\t[$]8, R[0-9]+, R[0-9]+, " // s390x:"CL?RJ [$]8, R[0-9]+, R[0-9]+, "
for <-x == <-y { for <-x == <-y {
dummy() dummy()
} }
@ -98,22 +98,22 @@ func si32(x, y chan int32) {
// Signed 32-bit compare-and-branch with 8-bit immediate. // Signed 32-bit compare-and-branch with 8-bit immediate.
func si32x8(doNotOptimize int32) { func si32x8(doNotOptimize int32) {
// take in doNotOptimize as an argument to avoid the loops being rewritten to count down // take in doNotOptimize as an argument to avoid the loops being rewritten to count down
// s390x:"CIJ\t[$]12, R[0-9]+, [$]127, " // s390x:"CIJ [$]12, R[0-9]+, [$]127, "
for i := doNotOptimize; i < 128; i++ { for i := doNotOptimize; i < 128; i++ {
dummy() dummy()
} }
// s390x:"CIJ\t[$]10, R[0-9]+, [$]-128, " // s390x:"CIJ [$]10, R[0-9]+, [$]-128, "
for i := doNotOptimize; i > -129; i-- { for i := doNotOptimize; i > -129; i-- {
dummy() dummy()
} }
// s390x:"CIJ\t[$]2, R[0-9]+, [$]127, " // s390x:"CIJ [$]2, R[0-9]+, [$]127, "
for i := doNotOptimize; i >= 128; i++ { for i := doNotOptimize; i >= 128; i++ {
dummy() dummy()
} }
// s390x:"CIJ\t[$]4, R[0-9]+, [$]-128, " // s390x:"CIJ [$]4, R[0-9]+, [$]-128, "
for i := doNotOptimize; i <= -129; i-- { for i := doNotOptimize; i <= -129; i-- {
dummy() dummy()
} }
@ -121,12 +121,12 @@ func si32x8(doNotOptimize int32) {
// Unsigned 32-bit compare-and-branch. // Unsigned 32-bit compare-and-branch.
func ui32(x, y chan uint32) { func ui32(x, y chan uint32) {
// s390x:"CLRJ\t[$](2|4), R[0-9]+, R[0-9]+, " // s390x:"CLRJ [$](2|4), R[0-9]+, R[0-9]+, "
for <-x > <-y { for <-x > <-y {
dummy() dummy()
} }
// s390x:"CL?RJ\t[$]6, R[0-9]+, R[0-9]+, " // s390x:"CL?RJ [$]6, R[0-9]+, R[0-9]+, "
for <-x != <-y { for <-x != <-y {
dummy() dummy()
} }
@ -134,22 +134,22 @@ func ui32(x, y chan uint32) {
// Unsigned 32-bit comparison with 8-bit immediate. // Unsigned 32-bit comparison with 8-bit immediate.
func ui32x8() { func ui32x8() {
// s390x:"CLIJ\t[$]4, R[0-9]+, [$]128, " // s390x:"CLIJ [$]4, R[0-9]+, [$]128, "
for i := uint32(0); i < 128; i++ { for i := uint32(0); i < 128; i++ {
dummy() dummy()
} }
// s390x:"CLIJ\t[$]12, R[0-9]+, [$]255, " // s390x:"CLIJ [$]12, R[0-9]+, [$]255, "
for i := uint32(0); i < 256; i++ { for i := uint32(0); i < 256; i++ {
dummy() dummy()
} }
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]255, " // s390x:"CLIJ [$]2, R[0-9]+, [$]255, "
for i := uint32(257); i >= 256; i-- { for i := uint32(257); i >= 256; i-- {
dummy() dummy()
} }
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]0, " // s390x:"CLIJ [$]2, R[0-9]+, [$]0, "
for i := uint32(1024); i > 0; i-- { for i := uint32(1024); i > 0; i-- {
dummy() dummy()
} }
@ -157,12 +157,12 @@ func ui32x8() {
// Signed 64-bit comparison with unsigned 8-bit immediate. // Signed 64-bit comparison with unsigned 8-bit immediate.
func si64xu8(x chan int64) { func si64xu8(x chan int64) {
// s390x:"CLGIJ\t[$]8, R[0-9]+, [$]128, " // s390x:"CLGIJ [$]8, R[0-9]+, [$]128, "
for <-x == 128 { for <-x == 128 {
dummy() dummy()
} }
// s390x:"CLGIJ\t[$]6, R[0-9]+, [$]255, " // s390x:"CLGIJ [$]6, R[0-9]+, [$]255, "
for <-x != 255 { for <-x != 255 {
dummy() dummy()
} }
@ -170,12 +170,12 @@ func si64xu8(x chan int64) {
// Signed 32-bit comparison with unsigned 8-bit immediate. // Signed 32-bit comparison with unsigned 8-bit immediate.
func si32xu8(x chan int32) { func si32xu8(x chan int32) {
// s390x:"CLIJ\t[$]8, R[0-9]+, [$]255, " // s390x:"CLIJ [$]8, R[0-9]+, [$]255, "
for <-x == 255 { for <-x == 255 {
dummy() dummy()
} }
// s390x:"CLIJ\t[$]6, R[0-9]+, [$]128, " // s390x:"CLIJ [$]6, R[0-9]+, [$]128, "
for <-x != 128 { for <-x != 128 {
dummy() dummy()
} }
@ -183,12 +183,12 @@ func si32xu8(x chan int32) {
// Unsigned 64-bit comparison with signed 8-bit immediate. // Unsigned 64-bit comparison with signed 8-bit immediate.
func ui64xu8(x chan uint64) { func ui64xu8(x chan uint64) {
// s390x:"CGIJ\t[$]8, R[0-9]+, [$]-1, " // s390x:"CGIJ [$]8, R[0-9]+, [$]-1, "
for <-x == ^uint64(0) { for <-x == ^uint64(0) {
dummy() dummy()
} }
// s390x:"CGIJ\t[$]6, R[0-9]+, [$]-128, " // s390x:"CGIJ [$]6, R[0-9]+, [$]-128, "
for <-x != ^uint64(127) { for <-x != ^uint64(127) {
dummy() dummy()
} }
@ -196,12 +196,12 @@ func ui64xu8(x chan uint64) {
// Unsigned 32-bit comparison with signed 8-bit immediate. // Unsigned 32-bit comparison with signed 8-bit immediate.
func ui32xu8(x chan uint32) { func ui32xu8(x chan uint32) {
// s390x:"CIJ\t[$]8, R[0-9]+, [$]-128, " // s390x:"CIJ [$]8, R[0-9]+, [$]-128, "
for <-x == ^uint32(127) { for <-x == ^uint32(127) {
dummy() dummy()
} }
// s390x:"CIJ\t[$]6, R[0-9]+, [$]-1, " // s390x:"CIJ [$]6, R[0-9]+, [$]-1, "
for <-x != ^uint32(0) { for <-x != ^uint32(0) {
dummy() dummy()
} }

View file

@ -21,68 +21,68 @@ import (
// Check that compare to constant string use 2/4/8 byte compares // Check that compare to constant string use 2/4/8 byte compares
func CompareString1(s string) bool { func CompareString1(s string) bool {
// amd64:`CMPW\t\(.*\), [$]` // amd64:`CMPW \(.*\), [$]`
// arm64:`MOVHU\t\(.*\), [R]`,`MOVD\t[$]`,`CMPW\tR` // arm64:`MOVHU \(.*\), [R]`,`MOVD [$]`,`CMPW R`
// ppc64le:`MOVHZ\t\(.*\), [R]`,`CMPW\t.*, [$]` // ppc64le:`MOVHZ \(.*\), [R]`,`CMPW .*, [$]`
// s390x:`MOVHBR\t\(.*\), [R]`,`CMPW\t.*, [$]` // s390x:`MOVHBR \(.*\), [R]`,`CMPW .*, [$]`
return s == "xx" return s == "xx"
} }
func CompareString2(s string) bool { func CompareString2(s string) bool {
// amd64:`CMPL\t\(.*\), [$]` // amd64:`CMPL \(.*\), [$]`
// arm64:`MOVWU\t\(.*\), [R]`,`CMPW\t.*, [R]` // arm64:`MOVWU \(.*\), [R]`,`CMPW .*, [R]`
// ppc64le:`MOVWZ\t\(.*\), [R]`,`CMPW\t.*, [R]` // ppc64le:`MOVWZ \(.*\), [R]`,`CMPW .*, [R]`
// s390x:`MOVWBR\t\(.*\), [R]`,`CMPW\t.*, [$]` // s390x:`MOVWBR \(.*\), [R]`,`CMPW .*, [$]`
return s == "xxxx" return s == "xxxx"
} }
func CompareString3(s string) bool { func CompareString3(s string) bool {
// amd64:`CMPQ\t\(.*\), [A-Z]` // amd64:`CMPQ \(.*\), [A-Z]`
// arm64:-`CMPW\t` // arm64:-`CMPW `
// ppc64x:-`CMPW\t` // ppc64x:-`CMPW `
// s390x:-`CMPW\t` // s390x:-`CMPW `
return s == "xxxxxxxx" return s == "xxxxxxxx"
} }
// Check that arrays compare use 2/4/8 byte compares // Check that arrays compare use 2/4/8 byte compares
func CompareArray1(a, b [2]byte) bool { func CompareArray1(a, b [2]byte) bool {
// amd64:`CMPW\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPW command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// arm64:-`MOVBU\t` // arm64:-`MOVBU `
// ppc64le:-`MOVBZ\t` // ppc64le:-`MOVBZ `
// s390x:-`MOVBZ\t` // s390x:-`MOVBZ `
return a == b return a == b
} }
func CompareArray2(a, b [3]uint16) bool { func CompareArray2(a, b [3]uint16) bool {
// amd64:`CMPL\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPL command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// amd64:`CMPW\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPW command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
return a == b return a == b
} }
func CompareArray3(a, b [3]int16) bool { func CompareArray3(a, b [3]int16) bool {
// amd64:`CMPL\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPL command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// amd64:`CMPW\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPW command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
return a == b return a == b
} }
func CompareArray4(a, b [12]int8) bool { func CompareArray4(a, b [12]int8) bool {
// amd64:`CMPQ\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPQ command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// amd64:`CMPL\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPL command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
return a == b return a == b
} }
func CompareArray5(a, b [15]byte) bool { func CompareArray5(a, b [15]byte) bool {
// amd64:`CMPQ\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPQ command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
return a == b return a == b
} }
// This was a TODO in mapaccess1_faststr // This was a TODO in mapaccess1_faststr
func CompareArray6(a, b unsafe.Pointer) bool { func CompareArray6(a, b unsafe.Pointer) bool {
// amd64:`CMPL\t\(.*\), [A-Z]` // amd64:`CMPL \(.*\), [A-Z]`
// arm64:`MOVWU\t\(.*\), [R]`,`CMPW\t.*, [R]` // arm64:`MOVWU \(.*\), [R]`,`CMPW .*, [R]`
// ppc64le:`MOVWZ\t\(.*\), [R]`,`CMPW\t.*, [R]` // ppc64le:`MOVWZ \(.*\), [R]`,`CMPW .*, [R]`
// s390x:`MOVWBR\t\(.*\), [R]`,`CMPW\t.*, [R]` // s390x:`MOVWBR \(.*\), [R]`,`CMPW .*, [R]`
return *((*[4]byte)(a)) != *((*[4]byte)(b)) return *((*[4]byte)(a)) != *((*[4]byte)(b))
} }
@ -93,7 +93,7 @@ type T1 struct {
} }
func CompareStruct1(s1, s2 T1) bool { func CompareStruct1(s1, s2 T1) bool {
// amd64:`CMPQ\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPQ command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// amd64:-`CALL` // amd64:-`CALL`
return s1 == s2 return s1 == s2
} }
@ -103,7 +103,7 @@ type T2 struct {
} }
func CompareStruct2(s1, s2 T2) bool { func CompareStruct2(s1, s2 T2) bool {
// amd64:`CMPQ\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:`CMPQ command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// amd64:-`CALL` // amd64:-`CALL`
return s1 == s2 return s1 == s2
} }
@ -116,7 +116,7 @@ type T3 struct {
} }
func CompareStruct3(s1, s2 T3) bool { func CompareStruct3(s1, s2 T3) bool {
// amd64:-`CMPQ\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:-`CMPQ command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// amd64:`CALL` // amd64:`CALL`
return s1 == s2 return s1 == s2
} }
@ -126,7 +126,7 @@ type T4 struct {
} }
func CompareStruct4(s1, s2 T4) bool { func CompareStruct4(s1, s2 T4) bool {
// amd64:-`CMPQ\tcommand-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]` // amd64:-`CMPQ command-line-arguments[.+_a-z0-9]+\(SP\), [A-Z]`
// amd64:`CALL` // amd64:`CALL`
return s1 == s2 return s1 == s2
} }
@ -140,7 +140,7 @@ func CompareStruct4(s1, s2 T4) bool {
var r bool var r bool
func CmpFold(x uint32) { func CmpFold(x uint32) {
// amd64:`SETHI\t.*\(SB\)` // amd64:`SETHI .*\(SB\)`
r = x > 4 r = x > 4
} }
@ -148,27 +148,27 @@ func CmpFold(x uint32) {
// possible // possible
func CmpMem1(p int, q *int) bool { func CmpMem1(p int, q *int) bool {
// amd64:`CMPQ\t\(.*\), [A-Z]` // amd64:`CMPQ \(.*\), [A-Z]`
return p < *q return p < *q
} }
func CmpMem2(p *int, q int) bool { func CmpMem2(p *int, q int) bool {
// amd64:`CMPQ\t\(.*\), [A-Z]` // amd64:`CMPQ \(.*\), [A-Z]`
return *p < q return *p < q
} }
func CmpMem3(p *int) bool { func CmpMem3(p *int) bool {
// amd64:`CMPQ\t\(.*\), [$]7` // amd64:`CMPQ \(.*\), [$]7`
return *p < 7 return *p < 7
} }
func CmpMem4(p *int) bool { func CmpMem4(p *int) bool {
// amd64:`CMPQ\t\(.*\), [$]7` // amd64:`CMPQ \(.*\), [$]7`
return 7 < *p return 7 < *p
} }
func CmpMem5(p **int) { func CmpMem5(p **int) {
// amd64:`CMPL\truntime.writeBarrier\(SB\), [$]0` // amd64:`CMPL runtime.writeBarrier\(SB\), [$]0`
*p = nil *p = nil
} }
@ -270,31 +270,31 @@ func CmpToZero(a, b, d int32, e, f int64, deOptC0, deOptC1 bool) int32 {
func CmpLogicalToZero(a, b, c uint32, d, e, f, g uint64) uint64 { func CmpLogicalToZero(a, b, c uint32, d, e, f, g uint64) uint64 {
// ppc64x:"ANDCC",-"CMPW" // ppc64x:"ANDCC" -"CMPW"
// wasm:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" // wasm:"I64Eqz" -"I32Eqz" -"I64ExtendI32U" -"I32WrapI64"
if a&63 == 0 { if a&63 == 0 {
return 1 return 1
} }
// ppc64x:"ANDCC",-"CMP" // ppc64x:"ANDCC" -"CMP"
// wasm:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" // wasm:"I64Eqz" -"I32Eqz" -"I64ExtendI32U" -"I32WrapI64"
if d&255 == 0 { if d&255 == 0 {
return 1 return 1
} }
// ppc64x:"ANDCC",-"CMP" // ppc64x:"ANDCC" -"CMP"
// wasm:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" // wasm:"I64Eqz" -"I32Eqz" -"I64ExtendI32U" -"I32WrapI64"
if d&e == 0 { if d&e == 0 {
return 1 return 1
} }
// ppc64x:"ORCC",-"CMP" // ppc64x:"ORCC" -"CMP"
// wasm:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" // wasm:"I64Eqz" -"I32Eqz" -"I64ExtendI32U" -"I32WrapI64"
if f|g == 0 { if f|g == 0 {
return 1 return 1
} }
// ppc64x:"XORCC",-"CMP" // ppc64x:"XORCC" -"CMP"
// wasm:"I64Eqz","I32Eqz",-"I64ExtendI32U",-"I32WrapI64" // wasm:"I64Eqz" "I32Eqz" -"I64ExtendI32U" -"I32WrapI64"
if e^d == 0 { if e^d == 0 {
return 1 return 1
} }
@ -711,19 +711,19 @@ func cmpToCmn(a, b, c, d int) int {
func cmpToCmnLessThan(a, b, c, d int) int { func cmpToCmnLessThan(a, b, c, d int) int {
var c1, c2, c3, c4 int var c1, c2, c3, c4 int
// arm64:`CMN`,`CSET\tMI`,-`CMP` // arm64:`CMN`,`CSET MI`,-`CMP`
if a+1 < 0 { if a+1 < 0 {
c1 = 1 c1 = 1
} }
// arm64:`CMN`,`CSET\tMI`,-`CMP` // arm64:`CMN`,`CSET MI`,-`CMP`
if a+b < 0 { if a+b < 0 {
c2 = 1 c2 = 1
} }
// arm64:`CMN`,`CSET\tMI`,-`CMP` // arm64:`CMN`,`CSET MI`,-`CMP`
if a*b+c < 0 { if a*b+c < 0 {
c3 = 1 c3 = 1
} }
// arm64:`CMP`,`CSET\tMI`,-`CMN` // arm64:`CMP`,`CSET MI`,-`CMN`
if a-b*c < 0 { if a-b*c < 0 {
c4 = 1 c4 = 1
} }
@ -780,19 +780,19 @@ func ge128Signed64(x int64) bool {
func cmpToCmnGreaterThanEqual(a, b, c, d int) int { func cmpToCmnGreaterThanEqual(a, b, c, d int) int {
var c1, c2, c3, c4 int var c1, c2, c3, c4 int
// arm64:`CMN`,`CSET\tPL`,-`CMP` // arm64:`CMN`,`CSET PL`,-`CMP`
if a+1 >= 0 { if a+1 >= 0 {
c1 = 1 c1 = 1
} }
// arm64:`CMN`,`CSET\tPL`,-`CMP` // arm64:`CMN`,`CSET PL`,-`CMP`
if a+b >= 0 { if a+b >= 0 {
c2 = 1 c2 = 1
} }
// arm64:`CMN`,`CSET\tPL`,-`CMP` // arm64:`CMN`,`CSET PL`,-`CMP`
if a*b+c >= 0 { if a*b+c >= 0 {
c3 = 1 c3 = 1
} }
// arm64:`CMP`,`CSET\tPL`,-`CMN` // arm64:`CMP`,`CSET PL`,-`CMN`
if a-b*c >= 0 { if a-b*c >= 0 {
c4 = 1 c4 = 1
} }
@ -870,6 +870,6 @@ func cmpstring2(x, y string) int {
// like in cmpstring1 will not work. Instead, we // like in cmpstring1 will not work. Instead, we
// look for spill/restore instructions, which only // look for spill/restore instructions, which only
// need to exist if there are 2 calls. // need to exist if there are 2 calls.
//amd64:-`MOVQ\t.*\(SP\)` //amd64:-`MOVQ .*\(SP\)`
return cmp.Compare(x, y) return cmp.Compare(x, y)
} }

View file

@ -12,8 +12,8 @@ func cmovint(c int) int {
x = 182 x = 182
} }
// amd64:"CMOVQLT" // amd64:"CMOVQLT"
// arm64:"CSEL\tLT" // arm64:"CSEL LT"
// ppc64x:"ISEL\t[$]0" // ppc64x:"ISEL [$]0"
// wasm:"Select" // wasm:"Select"
return x return x
} }
@ -23,8 +23,8 @@ func cmovchan(x, y chan int) chan int {
x = y x = y
} }
// amd64:"CMOVQNE" // amd64:"CMOVQNE"
// arm64:"CSEL\tNE" // arm64:"CSEL NE"
// ppc64x:"ISEL\t[$]2" // ppc64x:"ISEL [$]2"
// wasm:"Select" // wasm:"Select"
return x return x
} }
@ -34,8 +34,8 @@ func cmovuintptr(x, y uintptr) uintptr {
x = -y x = -y
} }
// amd64:"CMOVQ(HI|CS)" // amd64:"CMOVQ(HI|CS)"
// arm64:"CSNEG\tLS" // arm64:"CSNEG LS"
// ppc64x:"ISEL\t[$]1" // ppc64x:"ISEL [$]1"
// wasm:"Select" // wasm:"Select"
return x return x
} }
@ -45,8 +45,8 @@ func cmov32bit(x, y uint32) uint32 {
x = -y x = -y
} }
// amd64:"CMOVL(HI|CS)" // amd64:"CMOVL(HI|CS)"
// arm64:"CSNEG\t(LS|HS)" // arm64:"CSNEG (LS|HS)"
// ppc64x:"ISEL\t[$]1" // ppc64x:"ISEL [$]1"
// wasm:"Select" // wasm:"Select"
return x return x
} }
@ -56,8 +56,8 @@ func cmov16bit(x, y uint16) uint16 {
x = -y x = -y
} }
// amd64:"CMOVW(HI|CS)" // amd64:"CMOVW(HI|CS)"
// arm64:"CSNEG\t(LS|HS)" // arm64:"CSNEG (LS|HS)"
// ppc64x:"ISEL\t[$][01]" // ppc64x:"ISEL [$][01]"
// wasm:"Select" // wasm:"Select"
return x return x
} }
@ -69,9 +69,9 @@ func cmovfloateq(x, y float64) int {
if x == y { if x == y {
a = 256 a = 256
} }
// amd64:"CMOVQNE","CMOVQPC" // amd64:"CMOVQNE" "CMOVQPC"
// arm64:"CSEL\tEQ" // arm64:"CSEL EQ"
// ppc64x:"ISEL\t[$]2" // ppc64x:"ISEL [$]2"
// wasm:"Select" // wasm:"Select"
return a return a
} }
@ -81,9 +81,9 @@ func cmovfloatne(x, y float64) int {
if x != y { if x != y {
a = 256 a = 256
} }
// amd64:"CMOVQNE","CMOVQPS" // amd64:"CMOVQNE" "CMOVQPS"
// arm64:"CSEL\tNE" // arm64:"CSEL NE"
// ppc64x:"ISEL\t[$]2" // ppc64x:"ISEL [$]2"
// wasm:"Select" // wasm:"Select"
return a return a
} }
@ -109,8 +109,8 @@ func cmovfloatint2(x, y float64) float64 {
rexp = rexp - 42 rexp = rexp - 42
} }
// amd64:"CMOVQHI" // amd64:"CMOVQHI"
// arm64:"CSEL\tMI" // arm64:"CSEL MI"
// ppc64x:"ISEL\t[$]0" // ppc64x:"ISEL [$]0"
// wasm:"Select" // wasm:"Select"
r = r - ldexp(y, rexp-yexp) r = r - ldexp(y, rexp-yexp)
} }
@ -124,8 +124,8 @@ func cmovloaded(x [4]int, y int) int {
y = y >> 2 y = y >> 2
} }
// amd64:"CMOVQNE" // amd64:"CMOVQNE"
// arm64:"CSEL\tNE" // arm64:"CSEL NE"
// ppc64x:"ISEL\t[$]2" // ppc64x:"ISEL [$]2"
// wasm:"Select" // wasm:"Select"
return y return y
} }
@ -136,8 +136,8 @@ func cmovuintptr2(x, y uintptr) uintptr {
a = 256 a = 256
} }
// amd64:"CMOVQEQ" // amd64:"CMOVQEQ"
// arm64:"CSEL\tEQ" // arm64:"CSEL EQ"
// ppc64x:"ISEL\t[$]2" // ppc64x:"ISEL [$]2"
// wasm:"Select" // wasm:"Select"
return a return a
} }
@ -230,7 +230,7 @@ func cmovinc(cond bool, a, b, c int) {
} else { } else {
x0 = b + 1 x0 = b + 1
} }
// arm64:"CSINC\tNE", -"CSEL" // arm64:"CSINC NE", -"CSEL"
r0 = x0 r0 = x0
if cond { if cond {
@ -238,13 +238,13 @@ func cmovinc(cond bool, a, b, c int) {
} else { } else {
x1 = a x1 = a
} }
// arm64:"CSINC\tEQ", -"CSEL" // arm64:"CSINC EQ", -"CSEL"
r1 = x1 r1 = x1
if cond { if cond {
c++ c++
} }
// arm64:"CSINC\tEQ", -"CSEL" // arm64:"CSINC EQ", -"CSEL"
r2 = c r2 = c
} }
@ -256,7 +256,7 @@ func cmovinv(cond bool, a, b int) {
} else { } else {
x0 = ^b x0 = ^b
} }
// arm64:"CSINV\tNE", -"CSEL" // arm64:"CSINV NE", -"CSEL"
r0 = x0 r0 = x0
if cond { if cond {
@ -264,7 +264,7 @@ func cmovinv(cond bool, a, b int) {
} else { } else {
x1 = a x1 = a
} }
// arm64:"CSINV\tEQ", -"CSEL" // arm64:"CSINV EQ", -"CSEL"
r1 = x1 r1 = x1
} }
@ -276,7 +276,7 @@ func cmovneg(cond bool, a, b, c int) {
} else { } else {
x0 = -b x0 = -b
} }
// arm64:"CSNEG\tNE", -"CSEL" // arm64:"CSNEG NE", -"CSEL"
r0 = x0 r0 = x0
if cond { if cond {
@ -284,7 +284,7 @@ func cmovneg(cond bool, a, b, c int) {
} else { } else {
x1 = a x1 = a
} }
// arm64:"CSNEG\tEQ", -"CSEL" // arm64:"CSNEG EQ", -"CSEL"
r1 = x1 r1 = x1
} }
@ -296,7 +296,7 @@ func cmovsetm(cond bool, x int) {
} else { } else {
x0 = 0 x0 = 0
} }
// arm64:"CSETM\tNE", -"CSEL" // arm64:"CSETM NE", -"CSEL"
r0 = x0 r0 = x0
if cond { if cond {
@ -304,7 +304,7 @@ func cmovsetm(cond bool, x int) {
} else { } else {
x1 = -1 x1 = -1
} }
// arm64:"CSETM\tEQ", -"CSEL" // arm64:"CSETM EQ", -"CSEL"
r1 = x1 r1 = x1
} }
@ -316,7 +316,7 @@ func cmovFcmp0(s, t float64, a, b int) {
} else { } else {
x0 = b + 1 x0 = b + 1
} }
// arm64:"CSINC\tMI", -"CSEL" // arm64:"CSINC MI", -"CSEL"
r0 = x0 r0 = x0
if s <= t { if s <= t {
@ -324,7 +324,7 @@ func cmovFcmp0(s, t float64, a, b int) {
} else { } else {
x1 = ^b x1 = ^b
} }
// arm64:"CSINV\tLS", -"CSEL" // arm64:"CSINV LS", -"CSEL"
r1 = x1 r1 = x1
if s > t { if s > t {
@ -332,7 +332,7 @@ func cmovFcmp0(s, t float64, a, b int) {
} else { } else {
x2 = -b x2 = -b
} }
// arm64:"CSNEG\tMI", -"CSEL" // arm64:"CSNEG MI", -"CSEL"
r2 = x2 r2 = x2
if s >= t { if s >= t {
@ -340,7 +340,7 @@ func cmovFcmp0(s, t float64, a, b int) {
} else { } else {
x3 = 0 x3 = 0
} }
// arm64:"CSETM\tLS", -"CSEL" // arm64:"CSETM LS", -"CSEL"
r3 = x3 r3 = x3
if s == t { if s == t {
@ -348,7 +348,7 @@ func cmovFcmp0(s, t float64, a, b int) {
} else { } else {
x4 = b + 1 x4 = b + 1
} }
// arm64:"CSINC\tEQ", -"CSEL" // arm64:"CSINC EQ", -"CSEL"
r4 = x4 r4 = x4
if s != t { if s != t {
@ -356,7 +356,7 @@ func cmovFcmp0(s, t float64, a, b int) {
} else { } else {
x5 = b + 1 x5 = b + 1
} }
// arm64:"CSINC\tNE", -"CSEL" // arm64:"CSINC NE", -"CSEL"
r5 = x5 r5 = x5
} }
@ -368,7 +368,7 @@ func cmovFcmp1(s, t float64, a, b int) {
} else { } else {
x0 = a x0 = a
} }
// arm64:"CSINC\tPL", -"CSEL" // arm64:"CSINC PL", -"CSEL"
r0 = x0 r0 = x0
if s <= t { if s <= t {
@ -376,7 +376,7 @@ func cmovFcmp1(s, t float64, a, b int) {
} else { } else {
x1 = a x1 = a
} }
// arm64:"CSINV\tHI", -"CSEL" // arm64:"CSINV HI", -"CSEL"
r1 = x1 r1 = x1
if s > t { if s > t {
@ -384,7 +384,7 @@ func cmovFcmp1(s, t float64, a, b int) {
} else { } else {
x2 = a x2 = a
} }
// arm64:"CSNEG\tPL", -"CSEL" // arm64:"CSNEG PL", -"CSEL"
r2 = x2 r2 = x2
if s >= t { if s >= t {
@ -392,7 +392,7 @@ func cmovFcmp1(s, t float64, a, b int) {
} else { } else {
x3 = -1 x3 = -1
} }
// arm64:"CSETM\tHI", -"CSEL" // arm64:"CSETM HI", -"CSEL"
r3 = x3 r3 = x3
if s == t { if s == t {
@ -400,7 +400,7 @@ func cmovFcmp1(s, t float64, a, b int) {
} else { } else {
x4 = a x4 = a
} }
// arm64:"CSINC\tNE", -"CSEL" // arm64:"CSINC NE", -"CSEL"
r4 = x4 r4 = x4
if s != t { if s != t {
@ -408,7 +408,7 @@ func cmovFcmp1(s, t float64, a, b int) {
} else { } else {
x5 = a x5 = a
} }
// arm64:"CSINC\tEQ", -"CSEL" // arm64:"CSINC EQ", -"CSEL"
r5 = x5 r5 = x5
} }
@ -439,7 +439,7 @@ func cmovzeroreg0(a, b int) int {
if a == b { if a == b {
x = a x = a
} }
// ppc64x:"ISEL\t[$]2, R[0-9]+, R0, R[0-9]+" // ppc64x:"ISEL [$]2, R[0-9]+, R0, R[0-9]+"
return x return x
} }
@ -448,7 +448,7 @@ func cmovzeroreg1(a, b int) int {
if a == b { if a == b {
x = 0 x = 0
} }
// ppc64x:"ISEL\t[$]2, R0, R[0-9]+, R[0-9]+" // ppc64x:"ISEL [$]2, R0, R[0-9]+, R[0-9]+"
return x return x
} }

View file

@ -8,28 +8,28 @@ package codegen
// A uint16 or sint16 constant shifted left. // A uint16 or sint16 constant shifted left.
func shifted16BitConstants() (out [64]uint64) { func shifted16BitConstants() (out [64]uint64) {
// ppc64x: "MOVD\t[$]8193,", "SLD\t[$]27," // ppc64x: "MOVD [$]8193,", "SLD [$]27,"
out[0] = 0x0000010008000000 out[0] = 0x0000010008000000
// ppc64x: "MOVD\t[$]-32767", "SLD\t[$]26," // ppc64x: "MOVD [$]-32767", "SLD [$]26,"
out[1] = 0xFFFFFE0004000000 out[1] = 0xFFFFFE0004000000
// ppc64x: "MOVD\t[$]-1", "SLD\t[$]48," // ppc64x: "MOVD [$]-1", "SLD [$]48,"
out[2] = 0xFFFF000000000000 out[2] = 0xFFFF000000000000
// ppc64x: "MOVD\t[$]65535", "SLD\t[$]44," // ppc64x: "MOVD [$]65535", "SLD [$]44,"
out[3] = 0x0FFFF00000000000 out[3] = 0x0FFFF00000000000
return return
} }
// A contiguous set of 1 bits, potentially wrapping. // A contiguous set of 1 bits, potentially wrapping.
func contiguousMaskConstants() (out [64]uint64) { func contiguousMaskConstants() (out [64]uint64) {
// ppc64x: "MOVD\t[$]-1", "RLDC\tR[0-9]+, [$]44, [$]63," // ppc64x: "MOVD [$]-1", "RLDC R[0-9]+, [$]44, [$]63,"
out[0] = 0xFFFFF00000000001 out[0] = 0xFFFFF00000000001
// ppc64x: "MOVD\t[$]-1", "RLDC\tR[0-9]+, [$]43, [$]63," // ppc64x: "MOVD [$]-1", "RLDC R[0-9]+, [$]43, [$]63,"
out[1] = 0xFFFFF80000000001 out[1] = 0xFFFFF80000000001
// ppc64x: "MOVD\t[$]-1", "RLDC\tR[0-9]+, [$]43, [$]4," // ppc64x: "MOVD [$]-1", "RLDC R[0-9]+, [$]43, [$]4,"
out[2] = 0x0FFFF80000000000 out[2] = 0x0FFFF80000000000
// ppc64x/power8: "MOVD\t[$]-1", "RLDC\tR[0-9]+, [$]33, [$]63," // ppc64x/power8: "MOVD [$]-1", "RLDC R[0-9]+, [$]33, [$]63,"
// ppc64x/power9: "MOVD\t[$]-1", "RLDC\tR[0-9]+, [$]33, [$]63," // ppc64x/power9: "MOVD [$]-1", "RLDC R[0-9]+, [$]33, [$]63,"
// ppc64x/power10: "MOVD\t[$]-8589934591," // ppc64x/power10: "MOVD [$]-8589934591,"
out[3] = 0xFFFFFFFE00000001 out[3] = 0xFFFFFFFE00000001
return return
} }

View file

@ -43,8 +43,8 @@ var x [256]byte
func moveDisjointStack32() { func moveDisjointStack32() {
var s [32]byte var s [32]byte
// ppc64x:-".*memmove" // ppc64x:-".*memmove"
// ppc64x/power8:"LXVD2X",-"ADD",-"BC" // ppc64x/power8:"LXVD2X" -"ADD" -"BC"
// ppc64x/power9:"LXV",-"LXVD2X",-"ADD",-"BC" // ppc64x/power9:"LXV" -"LXVD2X" -"ADD" -"BC"
copy(s[:], x[:32]) copy(s[:], x[:32])
runtime.KeepAlive(&s) runtime.KeepAlive(&s)
} }
@ -52,8 +52,8 @@ func moveDisjointStack32() {
func moveDisjointStack64() { func moveDisjointStack64() {
var s [96]byte var s [96]byte
// ppc64x:-".*memmove" // ppc64x:-".*memmove"
// ppc64x/power8:"LXVD2X","ADD","BC" // ppc64x/power8:"LXVD2X" "ADD" "BC"
// ppc64x/power9:"LXV",-"LXVD2X",-"ADD",-"BC" // ppc64x/power9:"LXV" -"LXVD2X" -"ADD" -"BC"
copy(s[:], x[:96]) copy(s[:], x[:96])
runtime.KeepAlive(&s) runtime.KeepAlive(&s)
} }
@ -64,7 +64,7 @@ func moveDisjointStack() {
// amd64:-".*memmove" // amd64:-".*memmove"
// ppc64x:-".*memmove" // ppc64x:-".*memmove"
// ppc64x/power8:"LXVD2X" // ppc64x/power8:"LXVD2X"
// ppc64x/power9:"LXV",-"LXVD2X" // ppc64x/power9:"LXV" -"LXVD2X"
copy(s[:], x[:]) copy(s[:], x[:])
runtime.KeepAlive(&s) runtime.KeepAlive(&s)
} }
@ -75,7 +75,7 @@ func moveDisjointArg(b *[256]byte) {
// amd64:-".*memmove" // amd64:-".*memmove"
// ppc64x:-".*memmove" // ppc64x:-".*memmove"
// ppc64x/power8:"LXVD2X" // ppc64x/power8:"LXVD2X"
// ppc64x/power9:"LXV",-"LXVD2X" // ppc64x/power9:"LXV" -"LXVD2X"
copy(s[:], b[:]) copy(s[:], b[:])
runtime.KeepAlive(&s) runtime.KeepAlive(&s)
} }
@ -85,7 +85,7 @@ func moveDisjointNoOverlap(a *[256]byte) {
// amd64:-".*memmove" // amd64:-".*memmove"
// ppc64x:-".*memmove" // ppc64x:-".*memmove"
// ppc64x/power8:"LXVD2X" // ppc64x/power8:"LXVD2X"
// ppc64x/power9:"LXV",-"LXVD2X" // ppc64x/power9:"LXV" -"LXVD2X"
copy(a[:], a[128:]) copy(a[:], a[128:])
} }
@ -135,28 +135,28 @@ func moveArchLowering16(b []byte, x *[16]byte) {
// Check that no branches are generated when the pointers are [not] equal. // Check that no branches are generated when the pointers are [not] equal.
func ptrEqual() { func ptrEqual() {
// amd64:-"JEQ",-"JNE" // amd64:-"JEQ" -"JNE"
// ppc64x:-"BEQ",-"BNE" // ppc64x:-"BEQ" -"BNE"
// s390x:-"BEQ",-"BNE" // s390x:-"BEQ" -"BNE"
copy(x[:], x[:]) copy(x[:], x[:])
} }
func ptrOneOffset() { func ptrOneOffset() {
// amd64:-"JEQ",-"JNE" // amd64:-"JEQ" -"JNE"
// ppc64x:-"BEQ",-"BNE" // ppc64x:-"BEQ" -"BNE"
// s390x:-"BEQ",-"BNE" // s390x:-"BEQ" -"BNE"
copy(x[1:], x[:]) copy(x[1:], x[:])
} }
func ptrBothOffset() { func ptrBothOffset() {
// amd64:-"JEQ",-"JNE" // amd64:-"JEQ" -"JNE"
// ppc64x:-"BEQ",-"BNE" // ppc64x:-"BEQ" -"BNE"
// s390x:-"BEQ",-"BNE" // s390x:-"BEQ" -"BNE"
copy(x[1:], x[2:]) copy(x[1:], x[2:])
} }
// Verify #62698 on PPC64. // Verify #62698 on PPC64.
func noMaskOnCopy(a []int, s string, x int) int { func noMaskOnCopy(a []int, s string, x int) int {
// ppc64x:-"MOVD\t$-1", -"AND" // ppc64x:-"MOVD [$]-1", -"AND"
return a[x&^copy([]byte{}, s)] return a[x&^copy([]byte{}, s)]
} }

View file

@ -15,42 +15,42 @@ package codegen
// --------------------- // // --------------------- //
func Mul2(f float64) float64 { func Mul2(f float64) float64 {
// 386/sse2:"ADDSD",-"MULSD" // 386/sse2:"ADDSD" -"MULSD"
// amd64:"ADDSD",-"MULSD" // amd64:"ADDSD" -"MULSD"
// arm/7:"ADDD",-"MULD" // arm/7:"ADDD" -"MULD"
// arm64:"FADDD",-"FMULD" // arm64:"FADDD" -"FMULD"
// loong64:"ADDD",-"MULD" // loong64:"ADDD" -"MULD"
// ppc64x:"FADD",-"FMUL" // ppc64x:"FADD" -"FMUL"
// riscv64:"FADDD",-"FMULD" // riscv64:"FADDD" -"FMULD"
return f * 2.0 return f * 2.0
} }
func DivPow2(f1, f2, f3 float64) (float64, float64, float64) { func DivPow2(f1, f2, f3 float64) (float64, float64, float64) {
// 386/sse2:"MULSD",-"DIVSD" // 386/sse2:"MULSD" -"DIVSD"
// amd64:"MULSD",-"DIVSD" // amd64:"MULSD" -"DIVSD"
// arm/7:"MULD",-"DIVD" // arm/7:"MULD" -"DIVD"
// arm64:"FMULD",-"FDIVD" // arm64:"FMULD" -"FDIVD"
// loong64:"MULD",-"DIVD" // loong64:"MULD" -"DIVD"
// ppc64x:"FMUL",-"FDIV" // ppc64x:"FMUL" -"FDIV"
// riscv64:"FMULD",-"FDIVD" // riscv64:"FMULD" -"FDIVD"
x := f1 / 16.0 x := f1 / 16.0
// 386/sse2:"MULSD",-"DIVSD" // 386/sse2:"MULSD" -"DIVSD"
// amd64:"MULSD",-"DIVSD" // amd64:"MULSD" -"DIVSD"
// arm/7:"MULD",-"DIVD" // arm/7:"MULD" -"DIVD"
// arm64:"FMULD",-"FDIVD" // arm64:"FMULD" -"FDIVD"
// loong64:"MULD",-"DIVD" // loong64:"MULD" -"DIVD"
// ppc64x:"FMUL",-"FDIVD" // ppc64x:"FMUL" -"FDIVD"
// riscv64:"FMULD",-"FDIVD" // riscv64:"FMULD" -"FDIVD"
y := f2 / 0.125 y := f2 / 0.125
// 386/sse2:"ADDSD",-"DIVSD",-"MULSD" // 386/sse2:"ADDSD" -"DIVSD" -"MULSD"
// amd64:"ADDSD",-"DIVSD",-"MULSD" // amd64:"ADDSD" -"DIVSD" -"MULSD"
// arm/7:"ADDD",-"MULD",-"DIVD" // arm/7:"ADDD" -"MULD" -"DIVD"
// arm64:"FADDD",-"FMULD",-"FDIVD" // arm64:"FADDD" -"FMULD" -"FDIVD"
// loong64:"ADDD",-"MULD",-"DIVD" // loong64:"ADDD" -"MULD" -"DIVD"
// ppc64x:"FADD",-"FMUL",-"FDIV" // ppc64x:"FADD" -"FMUL" -"FDIV"
// riscv64:"FADDD",-"FMULD",-"FDIVD" // riscv64:"FADDD" -"FMULD" -"FDIVD"
z := f3 / 0.5 z := f3 / 0.5
return x, y, z return x, y, z
@ -73,67 +73,67 @@ func indexStore(b0 []float64, b1 float64, idx int) {
// ----------- // // ----------- //
func FusedAdd32(x, y, z float32) float32 { func FusedAdd32(x, y, z float32) float32 {
// s390x:"FMADDS\t" // s390x:"FMADDS "
// ppc64x:"FMADDS\t" // ppc64x:"FMADDS "
// arm64:"FMADDS" // arm64:"FMADDS"
// loong64:"FMADDF\t" // loong64:"FMADDF "
// riscv64:"FMADDS\t" // riscv64:"FMADDS "
// amd64/v3:"VFMADD231SS\t" // amd64/v3:"VFMADD231SS "
return x*y + z return x*y + z
} }
func FusedSub32_a(x, y, z float32) float32 { func FusedSub32_a(x, y, z float32) float32 {
// s390x:"FMSUBS\t" // s390x:"FMSUBS "
// ppc64x:"FMSUBS\t" // ppc64x:"FMSUBS "
// riscv64:"FMSUBS\t" // riscv64:"FMSUBS "
// loong64:"FMSUBF\t" // loong64:"FMSUBF "
return x*y - z return x*y - z
} }
func FusedSub32_b(x, y, z float32) float32 { func FusedSub32_b(x, y, z float32) float32 {
// arm64:"FMSUBS" // arm64:"FMSUBS"
// loong64:"FNMSUBF\t" // loong64:"FNMSUBF "
// riscv64:"FNMSUBS\t" // riscv64:"FNMSUBS "
return z - x*y return z - x*y
} }
func FusedAdd64(x, y, z float64) float64 { func FusedAdd64(x, y, z float64) float64 {
// s390x:"FMADD\t" // s390x:"FMADD "
// ppc64x:"FMADD\t" // ppc64x:"FMADD "
// arm64:"FMADDD" // arm64:"FMADDD"
// loong64:"FMADDD\t" // loong64:"FMADDD "
// riscv64:"FMADDD\t" // riscv64:"FMADDD "
// amd64/v3:"VFMADD231SD\t" // amd64/v3:"VFMADD231SD "
return x*y + z return x*y + z
} }
func FusedSub64_a(x, y, z float64) float64 { func FusedSub64_a(x, y, z float64) float64 {
// s390x:"FMSUB\t" // s390x:"FMSUB "
// ppc64x:"FMSUB\t" // ppc64x:"FMSUB "
// riscv64:"FMSUBD\t" // riscv64:"FMSUBD "
// loong64:"FMSUBD\t" // loong64:"FMSUBD "
return x*y - z return x*y - z
} }
func FusedSub64_b(x, y, z float64) float64 { func FusedSub64_b(x, y, z float64) float64 {
// arm64:"FMSUBD" // arm64:"FMSUBD"
// loong64:"FNMSUBD\t" // loong64:"FNMSUBD "
// riscv64:"FNMSUBD\t" // riscv64:"FNMSUBD "
return z - x*y return z - x*y
} }
func Cmp(f float64) bool { func Cmp(f float64) bool {
// arm64:"FCMPD","(BGT|BLE|BMI|BPL)",-"CSET\tGT",-"CBZ" // arm64:"FCMPD" "(BGT|BLE|BMI|BPL)" -"CSET GT" -"CBZ"
return f > 4 || f < -4 return f > 4 || f < -4
} }
func CmpZero64(f float64) bool { func CmpZero64(f float64) bool {
// s390x:"LTDBR",-"FCMPU" // s390x:"LTDBR" -"FCMPU"
return f <= 0 return f <= 0
} }
func CmpZero32(f float32) bool { func CmpZero32(f float32) bool {
// s390x:"LTEBR",-"CEBR" // s390x:"LTEBR" -"CEBR"
return f <= 0 return f <= 0
} }
@ -218,43 +218,43 @@ func Float32Max(a, b float32) float32 {
// ------------------------ // // ------------------------ //
func Float32ConstantZero() float32 { func Float32ConstantZero() float32 {
// arm64:"FMOVS\tZR," // arm64:"FMOVS ZR,"
return 0.0 return 0.0
} }
func Float32ConstantChipFloat() float32 { func Float32ConstantChipFloat() float32 {
// arm64:"FMOVS\t[$]\\(2\\.25\\)," // arm64:"FMOVS [$]\\(2\\.25\\),"
return 2.25 return 2.25
} }
func Float32Constant() float32 { func Float32Constant() float32 {
// arm64:"FMOVS\t[$]f32\\.42440000\\(SB\\)" // arm64:"FMOVS [$]f32\\.42440000\\(SB\\)"
// ppc64x/power8:"FMOVS\t[$]f32\\.42440000\\(SB\\)" // ppc64x/power8:"FMOVS [$]f32\\.42440000\\(SB\\)"
// ppc64x/power9:"FMOVS\t[$]f32\\.42440000\\(SB\\)" // ppc64x/power9:"FMOVS [$]f32\\.42440000\\(SB\\)"
// ppc64x/power10:"XXSPLTIDP\t[$]1111752704," // ppc64x/power10:"XXSPLTIDP [$]1111752704,"
return 49.0 return 49.0
} }
func Float64ConstantZero() float64 { func Float64ConstantZero() float64 {
// arm64:"FMOVD\tZR," // arm64:"FMOVD ZR,"
return 0.0 return 0.0
} }
func Float64ConstantChipFloat() float64 { func Float64ConstantChipFloat() float64 {
// arm64:"FMOVD\t[$]\\(2\\.25\\)," // arm64:"FMOVD [$]\\(2\\.25\\),"
return 2.25 return 2.25
} }
func Float64Constant() float64 { func Float64Constant() float64 {
// arm64:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)" // arm64:"FMOVD [$]f64\\.4048800000000000\\(SB\\)"
// ppc64x/power8:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)" // ppc64x/power8:"FMOVD [$]f64\\.4048800000000000\\(SB\\)"
// ppc64x/power9:"FMOVD\t[$]f64\\.4048800000000000\\(SB\\)" // ppc64x/power9:"FMOVD [$]f64\\.4048800000000000\\(SB\\)"
// ppc64x/power10:"XXSPLTIDP\t[$]1111752704," // ppc64x/power10:"XXSPLTIDP [$]1111752704,"
return 49.0 return 49.0
} }
func Float32DenormalConstant() float32 { func Float32DenormalConstant() float32 {
// ppc64x:"FMOVS\t[$]f32\\.00400000\\(SB\\)" // ppc64x:"FMOVS [$]f32\\.00400000\\(SB\\)"
return 0x1p-127 return 0x1p-127
} }
@ -262,18 +262,18 @@ func Float32DenormalConstant() float32 {
// denormal float32 value. On ppc64x, denormal values cannot // denormal float32 value. On ppc64x, denormal values cannot
// be used with XXSPLTIDP. // be used with XXSPLTIDP.
func Float64DenormalFloat32Constant() float64 { func Float64DenormalFloat32Constant() float64 {
// ppc64x:"FMOVD\t[$]f64\\.3800000000000000\\(SB\\)" // ppc64x:"FMOVD [$]f64\\.3800000000000000\\(SB\\)"
return 0x1p-127 return 0x1p-127
} }
func Float32ConstantStore(p *float32) { func Float32ConstantStore(p *float32) {
// amd64:"MOVL\t[$]1085133554" // amd64:"MOVL [$]1085133554"
// riscv64: "MOVF\t[$]f32.40add2f2" // riscv64: "MOVF [$]f32.40add2f2"
*p = 5.432 *p = 5.432
} }
func Float64ConstantStore(p *float64) { func Float64ConstantStore(p *float64) {
// amd64: "MOVQ\t[$]4617801906721357038" // amd64: "MOVQ [$]4617801906721357038"
// riscv64: "MOVD\t[$]f64.4015ba5e353f7cee" // riscv64: "MOVD [$]f64.4015ba5e353f7cee"
*p = 5.432 *p = 5.432
} }

View file

@ -19,57 +19,57 @@ import "math"
// ---------------------------------- // // ---------------------------------- //
func si1c(c <-chan int64) { func si1c(c <-chan int64) {
// amd64:"CMPQ\t.+, [$]256" // amd64:"CMPQ .+, [$]256"
// s390x:"CLGIJ\t[$]12, R[0-9]+, [$]255" // s390x:"CLGIJ [$]12, R[0-9]+, [$]255"
for x := <-c; x >= 0 && x < 256; x = <-c { for x := <-c; x >= 0 && x < 256; x = <-c {
} }
} }
func si2c(c <-chan int32) { func si2c(c <-chan int32) {
// amd64:"CMPL\t.+, [$]256" // amd64:"CMPL .+, [$]256"
// s390x:"CLIJ\t[$]12, R[0-9]+, [$]255" // s390x:"CLIJ [$]12, R[0-9]+, [$]255"
for x := <-c; x >= 0 && x < 256; x = <-c { for x := <-c; x >= 0 && x < 256; x = <-c {
} }
} }
func si3c(c <-chan int16) { func si3c(c <-chan int16) {
// amd64:"CMPW\t.+, [$]256" // amd64:"CMPW .+, [$]256"
// s390x:"CLIJ\t[$]12, R[0-9]+, [$]255" // s390x:"CLIJ [$]12, R[0-9]+, [$]255"
for x := <-c; x >= 0 && x < 256; x = <-c { for x := <-c; x >= 0 && x < 256; x = <-c {
} }
} }
func si4c(c <-chan int8) { func si4c(c <-chan int8) {
// amd64:"CMPB\t.+, [$]10" // amd64:"CMPB .+, [$]10"
// s390x:"CLIJ\t[$]4, R[0-9]+, [$]10" // s390x:"CLIJ [$]4, R[0-9]+, [$]10"
for x := <-c; x >= 0 && x < 10; x = <-c { for x := <-c; x >= 0 && x < 10; x = <-c {
} }
} }
func si5c(c <-chan int64) { func si5c(c <-chan int64) {
// amd64:"CMPQ\t.+, [$]251","ADDQ\t[$]-5," // amd64:"CMPQ .+, [$]251" "ADDQ [$]-5,"
// s390x:"CLGIJ\t[$]4, R[0-9]+, [$]251","ADD\t[$]-5," // s390x:"CLGIJ [$]4, R[0-9]+, [$]251" "ADD [$]-5,"
for x := <-c; x < 256 && x > 4; x = <-c { for x := <-c; x < 256 && x > 4; x = <-c {
} }
} }
func si6c(c <-chan int32) { func si6c(c <-chan int32) {
// amd64:"CMPL\t.+, [$]255","DECL\t" // amd64:"CMPL .+, [$]255" "DECL "
// s390x:"CLIJ\t[$]12, R[0-9]+, [$]255","ADDW\t[$]-1," // s390x:"CLIJ [$]12, R[0-9]+, [$]255" "ADDW [$]-1,"
for x := <-c; x > 0 && x <= 256; x = <-c { for x := <-c; x > 0 && x <= 256; x = <-c {
} }
} }
func si7c(c <-chan int16) { func si7c(c <-chan int16) {
// amd64:"CMPW\t.+, [$]60","ADDL\t[$]10," // amd64:"CMPW .+, [$]60" "ADDL [$]10,"
// s390x:"CLIJ\t[$]12, R[0-9]+, [$]60","ADDW\t[$]10," // s390x:"CLIJ [$]12, R[0-9]+, [$]60" "ADDW [$]10,"
for x := <-c; x >= -10 && x <= 50; x = <-c { for x := <-c; x >= -10 && x <= 50; x = <-c {
} }
} }
func si8c(c <-chan int8) { func si8c(c <-chan int8) {
// amd64:"CMPB\t.+, [$]126","ADDL\t[$]126," // amd64:"CMPB .+, [$]126" "ADDL [$]126,"
// s390x:"CLIJ\t[$]4, R[0-9]+, [$]126","ADDW\t[$]126," // s390x:"CLIJ [$]4, R[0-9]+, [$]126" "ADDW [$]126,"
for x := <-c; x >= -126 && x < 0; x = <-c { for x := <-c; x >= -126 && x < 0; x = <-c {
} }
} }
@ -79,57 +79,57 @@ func si8c(c <-chan int8) {
// ---------------------------------- // // ---------------------------------- //
func si1d(c <-chan int64) { func si1d(c <-chan int64) {
// amd64:"CMPQ\t.+, [$]256" // amd64:"CMPQ .+, [$]256"
// s390x:"CLGIJ\t[$]2, R[0-9]+, [$]255" // s390x:"CLGIJ [$]2, R[0-9]+, [$]255"
for x := <-c; x < 0 || x >= 256; x = <-c { for x := <-c; x < 0 || x >= 256; x = <-c {
} }
} }
func si2d(c <-chan int32) { func si2d(c <-chan int32) {
// amd64:"CMPL\t.+, [$]256" // amd64:"CMPL .+, [$]256"
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]255" // s390x:"CLIJ [$]2, R[0-9]+, [$]255"
for x := <-c; x < 0 || x >= 256; x = <-c { for x := <-c; x < 0 || x >= 256; x = <-c {
} }
} }
func si3d(c <-chan int16) { func si3d(c <-chan int16) {
// amd64:"CMPW\t.+, [$]256" // amd64:"CMPW .+, [$]256"
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]255" // s390x:"CLIJ [$]2, R[0-9]+, [$]255"
for x := <-c; x < 0 || x >= 256; x = <-c { for x := <-c; x < 0 || x >= 256; x = <-c {
} }
} }
func si4d(c <-chan int8) { func si4d(c <-chan int8) {
// amd64:"CMPB\t.+, [$]10" // amd64:"CMPB .+, [$]10"
// s390x:"CLIJ\t[$]10, R[0-9]+, [$]10" // s390x:"CLIJ [$]10, R[0-9]+, [$]10"
for x := <-c; x < 0 || x >= 10; x = <-c { for x := <-c; x < 0 || x >= 10; x = <-c {
} }
} }
func si5d(c <-chan int64) { func si5d(c <-chan int64) {
// amd64:"CMPQ\t.+, [$]251","ADDQ\t[$]-5," // amd64:"CMPQ .+, [$]251" "ADDQ [$]-5,"
// s390x:"CLGIJ\t[$]10, R[0-9]+, [$]251","ADD\t[$]-5," // s390x:"CLGIJ [$]10, R[0-9]+, [$]251" "ADD [$]-5,"
for x := <-c; x >= 256 || x <= 4; x = <-c { for x := <-c; x >= 256 || x <= 4; x = <-c {
} }
} }
func si6d(c <-chan int32) { func si6d(c <-chan int32) {
// amd64:"CMPL\t.+, [$]255","DECL\t" // amd64:"CMPL .+, [$]255" "DECL "
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]255","ADDW\t[$]-1," // s390x:"CLIJ [$]2, R[0-9]+, [$]255" "ADDW [$]-1,"
for x := <-c; x <= 0 || x > 256; x = <-c { for x := <-c; x <= 0 || x > 256; x = <-c {
} }
} }
func si7d(c <-chan int16) { func si7d(c <-chan int16) {
// amd64:"CMPW\t.+, [$]60","ADDL\t[$]10," // amd64:"CMPW .+, [$]60" "ADDL [$]10,"
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]60","ADDW\t[$]10," // s390x:"CLIJ [$]2, R[0-9]+, [$]60" "ADDW [$]10,"
for x := <-c; x < -10 || x > 50; x = <-c { for x := <-c; x < -10 || x > 50; x = <-c {
} }
} }
func si8d(c <-chan int8) { func si8d(c <-chan int8) {
// amd64:"CMPB\t.+, [$]126","ADDL\t[$]126," // amd64:"CMPB .+, [$]126" "ADDL [$]126,"
// s390x:"CLIJ\t[$]10, R[0-9]+, [$]126","ADDW\t[$]126," // s390x:"CLIJ [$]10, R[0-9]+, [$]126" "ADDW [$]126,"
for x := <-c; x < -126 || x >= 0; x = <-c { for x := <-c; x < -126 || x >= 0; x = <-c {
} }
} }
@ -139,29 +139,29 @@ func si8d(c <-chan int8) {
// ------------------------------------ // // ------------------------------------ //
func ui1c(c <-chan uint64) { func ui1c(c <-chan uint64) {
// amd64:"CMPQ\t.+, [$]251","ADDQ\t[$]-5," // amd64:"CMPQ .+, [$]251" "ADDQ [$]-5,"
// s390x:"CLGIJ\t[$]4, R[0-9]+, [$]251","ADD\t[$]-5," // s390x:"CLGIJ [$]4, R[0-9]+, [$]251" "ADD [$]-5,"
for x := <-c; x < 256 && x > 4; x = <-c { for x := <-c; x < 256 && x > 4; x = <-c {
} }
} }
func ui2c(c <-chan uint32) { func ui2c(c <-chan uint32) {
// amd64:"CMPL\t.+, [$]255","DECL\t" // amd64:"CMPL .+, [$]255" "DECL "
// s390x:"CLIJ\t[$]12, R[0-9]+, [$]255","ADDW\t[$]-1," // s390x:"CLIJ [$]12, R[0-9]+, [$]255" "ADDW [$]-1,"
for x := <-c; x > 0 && x <= 256; x = <-c { for x := <-c; x > 0 && x <= 256; x = <-c {
} }
} }
func ui3c(c <-chan uint16) { func ui3c(c <-chan uint16) {
// amd64:"CMPW\t.+, [$]40","ADDL\t[$]-10," // amd64:"CMPW .+, [$]40" "ADDL [$]-10,"
// s390x:"CLIJ\t[$]12, R[0-9]+, [$]40","ADDW\t[$]-10," // s390x:"CLIJ [$]12, R[0-9]+, [$]40" "ADDW [$]-10,"
for x := <-c; x >= 10 && x <= 50; x = <-c { for x := <-c; x >= 10 && x <= 50; x = <-c {
} }
} }
func ui4c(c <-chan uint8) { func ui4c(c <-chan uint8) {
// amd64:"CMPB\t.+, [$]2","ADDL\t[$]-126," // amd64:"CMPB .+, [$]2" "ADDL [$]-126,"
// s390x:"CLIJ\t[$]4, R[0-9]+, [$]2","ADDW\t[$]-126," // s390x:"CLIJ [$]4, R[0-9]+, [$]2" "ADDW [$]-126,"
for x := <-c; x >= 126 && x < 128; x = <-c { for x := <-c; x >= 126 && x < 128; x = <-c {
} }
} }
@ -171,29 +171,29 @@ func ui4c(c <-chan uint8) {
// ------------------------------------ // // ------------------------------------ //
func ui1d(c <-chan uint64) { func ui1d(c <-chan uint64) {
// amd64:"CMPQ\t.+, [$]251","ADDQ\t[$]-5," // amd64:"CMPQ .+, [$]251" "ADDQ [$]-5,"
// s390x:"CLGIJ\t[$]10, R[0-9]+, [$]251","ADD\t[$]-5," // s390x:"CLGIJ [$]10, R[0-9]+, [$]251" "ADD [$]-5,"
for x := <-c; x >= 256 || x <= 4; x = <-c { for x := <-c; x >= 256 || x <= 4; x = <-c {
} }
} }
func ui2d(c <-chan uint32) { func ui2d(c <-chan uint32) {
// amd64:"CMPL\t.+, [$]254","ADDL\t[$]-2," // amd64:"CMPL .+, [$]254" "ADDL [$]-2,"
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]254","ADDW\t[$]-2," // s390x:"CLIJ [$]2, R[0-9]+, [$]254" "ADDW [$]-2,"
for x := <-c; x <= 1 || x > 256; x = <-c { for x := <-c; x <= 1 || x > 256; x = <-c {
} }
} }
func ui3d(c <-chan uint16) { func ui3d(c <-chan uint16) {
// amd64:"CMPW\t.+, [$]40","ADDL\t[$]-10," // amd64:"CMPW .+, [$]40" "ADDL [$]-10,"
// s390x:"CLIJ\t[$]2, R[0-9]+, [$]40","ADDW\t[$]-10," // s390x:"CLIJ [$]2, R[0-9]+, [$]40" "ADDW [$]-10,"
for x := <-c; x < 10 || x > 50; x = <-c { for x := <-c; x < 10 || x > 50; x = <-c {
} }
} }
func ui4d(c <-chan uint8) { func ui4d(c <-chan uint8) {
// amd64:"CMPB\t.+, [$]2","ADDL\t[$]-126," // amd64:"CMPB .+, [$]2" "ADDL [$]-126,"
// s390x:"CLIJ\t[$]10, R[0-9]+, [$]2","ADDW\t[$]-126," // s390x:"CLIJ [$]10, R[0-9]+, [$]2" "ADDW [$]-126,"
for x := <-c; x < 126 || x >= 128; x = <-c { for x := <-c; x < 126 || x >= 128; x = <-c {
} }
} }
@ -205,8 +205,8 @@ func ui4d(c <-chan uint8) {
func f64NaNOrPosInf(c <-chan float64) { func f64NaNOrPosInf(c <-chan float64) {
// This test assumes IsInf(x, 1) is implemented as x > MaxFloat rather than x == Inf(1). // This test assumes IsInf(x, 1) is implemented as x > MaxFloat rather than x == Inf(1).
// amd64:"JCS",-"JNE",-"JPS",-"JPC" // amd64:"JCS" -"JNE" -"JPS" -"JPC"
// riscv64:"FCLASSD",-"FLED",-"FLTD",-"FNED",-"FEQD" // riscv64:"FCLASSD" -"FLED" -"FLTD" -"FNED" -"FEQD"
for x := <-c; math.IsNaN(x) || math.IsInf(x, 1); x = <-c { for x := <-c; math.IsNaN(x) || math.IsInf(x, 1); x = <-c {
} }
} }
@ -214,64 +214,64 @@ func f64NaNOrPosInf(c <-chan float64) {
func f64NaNOrNegInf(c <-chan float64) { func f64NaNOrNegInf(c <-chan float64) {
// This test assumes IsInf(x, -1) is implemented as x < -MaxFloat rather than x == Inf(-1). // This test assumes IsInf(x, -1) is implemented as x < -MaxFloat rather than x == Inf(-1).
// amd64:"JCS",-"JNE",-"JPS",-"JPC" // amd64:"JCS" -"JNE" -"JPS" -"JPC"
// riscv64:"FCLASSD",-"FLED",-"FLTD",-"FNED",-"FEQD" // riscv64:"FCLASSD" -"FLED" -"FLTD" -"FNED" -"FEQD"
for x := <-c; math.IsNaN(x) || math.IsInf(x, -1); x = <-c { for x := <-c; math.IsNaN(x) || math.IsInf(x, -1); x = <-c {
} }
} }
func f64NaNOrLtOne(c <-chan float64) { func f64NaNOrLtOne(c <-chan float64) {
// amd64:"JCS",-"JNE",-"JPS",-"JPC" // amd64:"JCS" -"JNE" -"JPS" -"JPC"
// riscv64:"FLED",-"FLTD",-"FNED",-"FEQD" // riscv64:"FLED" -"FLTD" -"FNED" -"FEQD"
for x := <-c; math.IsNaN(x) || x < 1; x = <-c { for x := <-c; math.IsNaN(x) || x < 1; x = <-c {
} }
} }
func f64NaNOrLteOne(c <-chan float64) { func f64NaNOrLteOne(c <-chan float64) {
// amd64:"JLS",-"JNE",-"JPS",-"JPC" // amd64:"JLS" -"JNE" -"JPS" -"JPC"
// riscv64:"FLTD",-"FLED",-"FNED",-"FEQD" // riscv64:"FLTD" -"FLED" -"FNED" -"FEQD"
for x := <-c; x <= 1 || math.IsNaN(x); x = <-c { for x := <-c; x <= 1 || math.IsNaN(x); x = <-c {
} }
} }
func f64NaNOrGtOne(c <-chan float64) { func f64NaNOrGtOne(c <-chan float64) {
// amd64:"JCS",-"JNE",-"JPS",-"JPC" // amd64:"JCS" -"JNE" -"JPS" -"JPC"
// riscv64:"FLED",-"FLTD",-"FNED",-"FEQD" // riscv64:"FLED" -"FLTD" -"FNED" -"FEQD"
for x := <-c; math.IsNaN(x) || x > 1; x = <-c { for x := <-c; math.IsNaN(x) || x > 1; x = <-c {
} }
} }
func f64NaNOrGteOne(c <-chan float64) { func f64NaNOrGteOne(c <-chan float64) {
// amd64:"JLS",-"JNE",-"JPS",-"JPC" // amd64:"JLS" -"JNE" -"JPS" -"JPC"
// riscv64:"FLTD",-"FLED",-"FNED",-"FEQD" // riscv64:"FLTD" -"FLED" -"FNED" -"FEQD"
for x := <-c; x >= 1 || math.IsNaN(x); x = <-c { for x := <-c; x >= 1 || math.IsNaN(x); x = <-c {
} }
} }
func f32NaNOrLtOne(c <-chan float32) { func f32NaNOrLtOne(c <-chan float32) {
// amd64:"JCS",-"JNE",-"JPS",-"JPC" // amd64:"JCS" -"JNE" -"JPS" -"JPC"
// riscv64:"FLES",-"FLTS",-"FNES",-"FEQS" // riscv64:"FLES" -"FLTS" -"FNES" -"FEQS"
for x := <-c; x < 1 || x != x; x = <-c { for x := <-c; x < 1 || x != x; x = <-c {
} }
} }
func f32NaNOrLteOne(c <-chan float32) { func f32NaNOrLteOne(c <-chan float32) {
// amd64:"JLS",-"JNE",-"JPS",-"JPC" // amd64:"JLS" -"JNE" -"JPS" -"JPC"
// riscv64:"FLTS",-"FLES",-"FNES",-"FEQS" // riscv64:"FLTS" -"FLES" -"FNES" -"FEQS"
for x := <-c; x != x || x <= 1; x = <-c { for x := <-c; x != x || x <= 1; x = <-c {
} }
} }
func f32NaNOrGtOne(c <-chan float32) { func f32NaNOrGtOne(c <-chan float32) {
// amd64:"JCS",-"JNE",-"JPS",-"JPC" // amd64:"JCS" -"JNE" -"JPS" -"JPC"
// riscv64:"FLES",-"FLTS",-"FNES",-"FEQS" // riscv64:"FLES" -"FLTS" -"FNES" -"FEQS"
for x := <-c; x > 1 || x != x; x = <-c { for x := <-c; x > 1 || x != x; x = <-c {
} }
} }
func f32NaNOrGteOne(c <-chan float32) { func f32NaNOrGteOne(c <-chan float32) {
// amd64:"JLS",-"JNE",-"JPS",-"JPC" // amd64:"JLS" -"JNE" -"JPS" -"JPC"
// riscv64:"FLTS",-"FLES",-"FNES",-"FEQS" // riscv64:"FLTS" -"FLES" -"FNES" -"FEQS"
for x := <-c; x != x || x >= 1; x = <-c { for x := <-c; x != x || x >= 1; x = <-c {
} }
} }
@ -291,8 +291,8 @@ func lt20(x uint64) bool {
func issue74915(c <-chan uint64) { func issue74915(c <-chan uint64) {
// Check that the optimization is not blocked by function inlining. // Check that the optimization is not blocked by function inlining.
// amd64:"CMPQ\t.+, [$]16","ADDQ\t[$]-4," // amd64:"CMPQ .+, [$]16" "ADDQ [$]-4,"
// s390x:"CLGIJ\t[$]4, R[0-9]+, [$]16","ADD\t[$]-4," // s390x:"CLGIJ [$]4, R[0-9]+, [$]16" "ADD [$]-4,"
for x := <-c; gte4(x) && lt20(x); x = <-c { for x := <-c; gte4(x) && lt20(x); x = <-c {
} }
} }

View file

@ -21,20 +21,20 @@ func NopConvertGeneric[T any](x T) T {
var NopConvertGenericIface = NopConvertGeneric[I] var NopConvertGenericIface = NopConvertGeneric[I]
func ConvToM(x any) I { func ConvToM(x any) I {
// amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(.*\)`,`MOVQ\t8\(.*\)(.*\*1)` // amd64:`CALL runtime.typeAssert`,`MOVL 16\(.*\)`,`MOVQ 8\(.*\)(.*\*1)`
// arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU`,`MOVD\t\(R.*\)\(R.*\)` // arm64:`CALL runtime.typeAssert`,`LDAR`,`MOVWU`,`MOVD \(R.*\)\(R.*\)`
return x.(I) return x.(I)
} }
func e1(x any, y *int) bool { func e1(x any, y *int) bool {
// amd64:-`.*faceeq`,`SETEQ` // amd64:-`.*faceeq`,`SETEQ`
// arm64:-`.*faceeq`,`CSET\tEQ` // arm64:-`.*faceeq`,`CSET EQ`
return x == y return x == y
} }
func e2(x any, y *int) bool { func e2(x any, y *int) bool {
// amd64:-`.*faceeq`,`SETEQ` // amd64:-`.*faceeq`,`SETEQ`
// arm64:-`.*faceeq`,`CSET\tEQ` // arm64:-`.*faceeq`,`CSET EQ`
return y == x return y == x
} }
@ -42,7 +42,7 @@ type E *int
func e3(x any, y E) bool { func e3(x any, y E) bool {
// amd64:-`.*faceeq`,`SETEQ` // amd64:-`.*faceeq`,`SETEQ`
// arm64:-`.*faceeq`,`CSET\tEQ` // arm64:-`.*faceeq`,`CSET EQ`
return x == y return x == y
} }
@ -52,12 +52,12 @@ func (t *T) M() {}
func i1(x I, y *T) bool { func i1(x I, y *T) bool {
// amd64:-`.*faceeq`,`SETEQ` // amd64:-`.*faceeq`,`SETEQ`
// arm64:-`.*faceeq`,`CSET\tEQ` // arm64:-`.*faceeq`,`CSET EQ`
return x == y return x == y
} }
func i2(x I, y *T) bool { func i2(x I, y *T) bool {
// amd64:-`.*faceeq`,`SETEQ` // amd64:-`.*faceeq`,`SETEQ`
// arm64:-`.*faceeq`,`CSET\tEQ` // arm64:-`.*faceeq`,`CSET EQ`
return y == x return y == x
} }

View file

@ -14,9 +14,9 @@ var wsp = [256]bool{
} }
func zeroExtArgByte(ch [2]byte) bool { func zeroExtArgByte(ch [2]byte) bool {
return wsp[ch[0]] // amd64:-"MOVBLZX\t..,.." return wsp[ch[0]] // amd64:-"MOVBLZX ..,.."
} }
func zeroExtArgUint16(ch [2]uint16) bool { func zeroExtArgUint16(ch [2]uint16) bool {
return wsp[ch[0]] // amd64:-"MOVWLZX\t..,.." return wsp[ch[0]] // amd64:-"MOVWLZX ..,.."
} }

View file

@ -17,31 +17,31 @@ type T struct {
func (t *T) f() { func (t *T) f() {
// amd64:-".*runtime.memclrNoHeapPointers" // amd64:-".*runtime.memclrNoHeapPointers"
// amd64:`MOVUPS\tX15,` // amd64:`MOVUPS X15,`
for i := range t.a { for i := range t.a {
t.a[i] = 0 t.a[i] = 0
} }
// amd64:-".*runtime.memclrNoHeapPointers" // amd64:-".*runtime.memclrNoHeapPointers"
// amd64:`MOVUPS\tX15,` // amd64:`MOVUPS X15,`
for i := range *t.a { for i := range *t.a {
t.a[i] = 0 t.a[i] = 0
} }
// amd64:-".*runtime.memclrNoHeapPointers" // amd64:-".*runtime.memclrNoHeapPointers"
// amd64:`MOVUPS\tX15,` // amd64:`MOVUPS X15,`
for i := range t.a { for i := range t.a {
(*t.a)[i] = 0 (*t.a)[i] = 0
} }
// amd64:-".*runtime.memclrNoHeapPointers" // amd64:-".*runtime.memclrNoHeapPointers"
// amd64:`MOVUPS\tX15,` // amd64:`MOVUPS X15,`
for i := range *t.a { for i := range *t.a {
(*t.a)[i] = 0 (*t.a)[i] = 0
} }
// amd64:-".*runtime.memclrNoHeapPointers" // amd64:-".*runtime.memclrNoHeapPointers"
// amd64:`MOVUPS\tX15,` // amd64:`MOVUPS X15,`
for i := range t.b { for i := range t.b {
t.b[i] = 0 t.b[i] = 0
} }

View file

@ -13,7 +13,7 @@ package codegen
func f(x []int) int { func f(x []int) int {
s := make([]int, 3) s := make([]int, 3)
s = append(s, 4, 5) s = append(s, 4, 5)
// amd64:`MOVQ\t40\(.*\),` // amd64:`MOVQ 40\(.*\),`
return x[len(s)] return x[len(s)]
} }
@ -26,7 +26,7 @@ func g(x []int, p *bool) int {
} }
s = append(s, 4, 5) s = append(s, 4, 5)
if *p { if *p {
// amd64:`MOVQ\t40\(.*\),` // amd64:`MOVQ 40\(.*\),`
return x[len(s)] return x[len(s)]
} }
} }

View file

@ -7,30 +7,30 @@
package codegen package codegen
func main() { func main() {
// amd64:"LEAQ\tcommand-line-arguments\\.main\\.f\\.g\\.h\\.func3" // amd64:"LEAQ command-line-arguments\\.main\\.f\\.g\\.h\\.func3"
f(1)() f(1)()
// amd64:"LEAQ\tcommand-line-arguments\\.main\\.g\\.h\\.func2" // amd64:"LEAQ command-line-arguments\\.main\\.g\\.h\\.func2"
g(2)() g(2)()
// amd64:"LEAQ\tcommand-line-arguments\\.main\\.h\\.func1" // amd64:"LEAQ command-line-arguments\\.main\\.h\\.func1"
h(3)() h(3)()
// amd64:"LEAQ\tcommand-line-arguments\\.main\\.f\\.g\\.h\\.func4" // amd64:"LEAQ command-line-arguments\\.main\\.f\\.g\\.h\\.func4"
f(4)() f(4)()
} }
func f(x int) func() { func f(x int) func() {
// amd64:"LEAQ\tcommand-line-arguments\\.f\\.g\\.h\\.func1" // amd64:"LEAQ command-line-arguments\\.f\\.g\\.h\\.func1"
return g(x) return g(x)
} }
func g(x int) func() { func g(x int) func() {
// amd64:"LEAQ\tcommand-line-arguments\\.g\\.h\\.func1" // amd64:"LEAQ command-line-arguments\\.g\\.h\\.func1"
return h(x) return h(x)
} }
func h(x int) func() { func h(x int) func() {
// amd64:"LEAQ\tcommand-line-arguments\\.h\\.func1" // amd64:"LEAQ command-line-arguments\\.h\\.func1"
return func() { recover() } return func() { recover() }
} }

View file

@ -19,6 +19,6 @@ func (*Impl) A() {}
func main() { func main() {
var a M = &Impl{} var a M = &Impl{}
// amd64:`LEAQ\ttype:.*Impl` // amd64:`LEAQ type:.*Impl`
a.(A).A() a.(A).A()
} }

View file

@ -28,14 +28,14 @@ func ornot(x, y int) int {
// Verify that (OR (NOT x) (NOT y)) rewrites to (NOT (AND x y)) // Verify that (OR (NOT x) (NOT y)) rewrites to (NOT (AND x y))
func orDemorgans(x, y int) int { func orDemorgans(x, y int) int {
// amd64:"AND",-"OR" // amd64:"AND" -"OR"
z := ^x | ^y z := ^x | ^y
return z return z
} }
// Verify that (AND (NOT x) (NOT y)) rewrites to (NOT (OR x y)) // Verify that (AND (NOT x) (NOT y)) rewrites to (NOT (OR x y))
func andDemorgans(x, y int) int { func andDemorgans(x, y int) int {
// amd64:"OR",-"AND" // amd64:"OR" -"AND"
z := ^x & ^y z := ^x & ^y
return z return z
} }

View file

@ -16,12 +16,12 @@ package codegen
// Direct use of constants in fast map access calls (Issue #19015). // Direct use of constants in fast map access calls (Issue #19015).
func AccessInt1(m map[int]int) int { func AccessInt1(m map[int]int) int {
// amd64:"MOV[LQ]\t[$]5" // amd64:"MOV[LQ] [$]5"
return m[5] return m[5]
} }
func AccessInt2(m map[int]int) bool { func AccessInt2(m map[int]int) bool {
// amd64:"MOV[LQ]\t[$]5" // amd64:"MOV[LQ] [$]5"
_, ok := m[5] _, ok := m[5]
return ok return ok
} }
@ -147,7 +147,7 @@ func MapClearSideEffect(m map[int]int) int {
func MapLiteralSizing(x int) (map[int]int, map[int]int) { func MapLiteralSizing(x int) (map[int]int, map[int]int) {
// This is tested for internal/abi/maps.go:MapBucketCountBits={3,4,5} // This is tested for internal/abi/maps.go:MapBucketCountBits={3,4,5}
// amd64:"MOVL\t[$]33," // amd64:"MOVL [$]33,"
m := map[int]int{ m := map[int]int{
0: 0, 0: 0,
1: 1, 1: 1,
@ -183,7 +183,7 @@ func MapLiteralSizing(x int) (map[int]int, map[int]int) {
31: 32, 31: 32,
32: 32, 32: 32,
} }
// amd64:"MOVL\t[$]33," // amd64:"MOVL [$]33,"
n := map[int]int{ n := map[int]int{
0: 0, 0: 0,
1: 1, 1: 1,

View file

@ -12,37 +12,37 @@ var sink64 [8]float64
func approx(x float64) { func approx(x float64) {
// amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41" // amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41"
// amd64:"ROUNDSD\t[$]2" // amd64:"ROUNDSD [$]2"
// s390x:"FIDBR\t[$]6" // s390x:"FIDBR [$]6"
// arm64:"FRINTPD" // arm64:"FRINTPD"
// ppc64x:"FRIP" // ppc64x:"FRIP"
// wasm:"F64Ceil" // wasm:"F64Ceil"
sink64[0] = math.Ceil(x) sink64[0] = math.Ceil(x)
// amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41" // amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41"
// amd64:"ROUNDSD\t[$]1" // amd64:"ROUNDSD [$]1"
// s390x:"FIDBR\t[$]7" // s390x:"FIDBR [$]7"
// arm64:"FRINTMD" // arm64:"FRINTMD"
// ppc64x:"FRIM" // ppc64x:"FRIM"
// wasm:"F64Floor" // wasm:"F64Floor"
sink64[1] = math.Floor(x) sink64[1] = math.Floor(x)
// s390x:"FIDBR\t[$]1" // s390x:"FIDBR [$]1"
// arm64:"FRINTAD" // arm64:"FRINTAD"
// ppc64x:"FRIN" // ppc64x:"FRIN"
sink64[2] = math.Round(x) sink64[2] = math.Round(x)
// amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41" // amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41"
// amd64:"ROUNDSD\t[$]3" // amd64:"ROUNDSD [$]3"
// s390x:"FIDBR\t[$]5" // s390x:"FIDBR [$]5"
// arm64:"FRINTZD" // arm64:"FRINTZD"
// ppc64x:"FRIZ" // ppc64x:"FRIZ"
// wasm:"F64Trunc" // wasm:"F64Trunc"
sink64[3] = math.Trunc(x) sink64[3] = math.Trunc(x)
// amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41" // amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41"
// amd64:"ROUNDSD\t[$]0" // amd64:"ROUNDSD [$]0"
// s390x:"FIDBR\t[$]4" // s390x:"FIDBR [$]4"
// arm64:"FRINTND" // arm64:"FRINTND"
// wasm:"F64Nearest" // wasm:"F64Nearest"
sink64[4] = math.RoundToEven(x) sink64[4] = math.RoundToEven(x)
@ -78,43 +78,43 @@ func sqrt32(x float32) float32 {
// Check that it's using integer registers // Check that it's using integer registers
func abs(x, y float64) { func abs(x, y float64) {
// amd64:"BTRQ\t[$]63" // amd64:"BTRQ [$]63"
// arm64:"FABSD\t" // arm64:"FABSD "
// loong64:"ABSD\t" // loong64:"ABSD "
// s390x:"LPDFR\t",-"MOVD\t" (no integer load/store) // s390x:"LPDFR " -"MOVD " (no integer load/store)
// ppc64x:"FABS\t" // ppc64x:"FABS "
// riscv64:"FABSD\t" // riscv64:"FABSD "
// wasm:"F64Abs" // wasm:"F64Abs"
// arm/6:"ABSD\t" // arm/6:"ABSD "
// mips64/hardfloat:"ABSD\t" // mips64/hardfloat:"ABSD "
// mips/hardfloat:"ABSD\t" // mips/hardfloat:"ABSD "
sink64[0] = math.Abs(x) sink64[0] = math.Abs(x)
// amd64:"BTRQ\t[$]63","PXOR" (TODO: this should be BTSQ) // amd64:"BTRQ [$]63" "PXOR" (TODO: this should be BTSQ)
// s390x:"LNDFR\t",-"MOVD\t" (no integer load/store) // s390x:"LNDFR " -"MOVD " (no integer load/store)
// ppc64x:"FNABS\t" // ppc64x:"FNABS "
sink64[1] = -math.Abs(y) sink64[1] = -math.Abs(y)
} }
// Check that it's using integer registers // Check that it's using integer registers
func abs32(x float32) float32 { func abs32(x float32) float32 {
// s390x:"LPDFR",-"LDEBR",-"LEDBR" (no float64 conversion) // s390x:"LPDFR" -"LDEBR" -"LEDBR" (no float64 conversion)
return float32(math.Abs(float64(x))) return float32(math.Abs(float64(x)))
} }
// Check that it's using integer registers // Check that it's using integer registers
func copysign(a, b, c float64) { func copysign(a, b, c float64) {
// amd64:"BTRQ\t[$]63","ANDQ","ORQ" // amd64:"BTRQ [$]63" "ANDQ" "ORQ"
// loong64:"FCOPYSGD" // loong64:"FCOPYSGD"
// s390x:"CPSDR",-"MOVD" (no integer load/store) // s390x:"CPSDR" -"MOVD" (no integer load/store)
// ppc64x:"FCPSGN" // ppc64x:"FCPSGN"
// riscv64:"FSGNJD" // riscv64:"FSGNJD"
// wasm:"F64Copysign" // wasm:"F64Copysign"
sink64[0] = math.Copysign(a, b) sink64[0] = math.Copysign(a, b)
// amd64:"BTSQ\t[$]63" // amd64:"BTSQ [$]63"
// loong64:"FCOPYSGD" // loong64:"FCOPYSGD"
// s390x:"LNDFR\t",-"MOVD\t" (no integer load/store) // s390x:"LNDFR " -"MOVD " (no integer load/store)
// ppc64x:"FCPSGN" // ppc64x:"FCPSGN"
// riscv64:"FSGNJD" // riscv64:"FSGNJD"
// arm64:"ORR", -"AND" // arm64:"ORR", -"AND"
@ -122,12 +122,12 @@ func copysign(a, b, c float64) {
// Like math.Copysign(c, -1), but with integer operations. Useful // Like math.Copysign(c, -1), but with integer operations. Useful
// for platforms that have a copysign opcode to see if it's detected. // for platforms that have a copysign opcode to see if it's detected.
// s390x:"LNDFR\t",-"MOVD\t" (no integer load/store) // s390x:"LNDFR " -"MOVD " (no integer load/store)
sink64[2] = math.Float64frombits(math.Float64bits(a) | 1<<63) sink64[2] = math.Float64frombits(math.Float64bits(a) | 1<<63)
// amd64:"ANDQ","ORQ" // amd64:"ANDQ" "ORQ"
// loong64:"FCOPYSGD" // loong64:"FCOPYSGD"
// s390x:"CPSDR\t",-"MOVD\t" (no integer load/store) // s390x:"CPSDR " -"MOVD " (no integer load/store)
// ppc64x:"FCPSGN" // ppc64x:"FCPSGN"
// riscv64:"FSGNJD" // riscv64:"FSGNJD"
sink64[3] = math.Copysign(-1, c) sink64[3] = math.Copysign(-1, c)
@ -151,12 +151,12 @@ func fms(x, y, z float64) float64 {
} }
func fnms(x, y, z float64) float64 { func fnms(x, y, z float64) float64 {
// riscv64:"FNMSUBD",-"FNMADDD" // riscv64:"FNMSUBD" -"FNMADDD"
return math.FMA(-x, y, z) return math.FMA(-x, y, z)
} }
func fnma(x, y, z float64) float64 { func fnma(x, y, z float64) float64 {
// riscv64:"FNMADDD",-"FNMSUBD" // riscv64:"FNMADDD" -"FNMSUBD"
return math.FMA(x, -y, -z) return math.FMA(x, -y, -z)
} }
@ -221,39 +221,39 @@ func isNotNegInfCmp(x float64) bool {
} }
func fromFloat64(f64 float64) uint64 { func fromFloat64(f64 float64) uint64 {
// amd64:"MOVQ\tX.*, [^X].*" // amd64:"MOVQ X.*, [^X].*"
// arm64:"FMOVD\tF.*, R.*" // arm64:"FMOVD F.*, R.*"
// loong64:"MOVV\tF.*, R.*" // loong64:"MOVV F.*, R.*"
// ppc64x:"MFVSRD" // ppc64x:"MFVSRD"
// mips64/hardfloat:"MOVV\tF.*, R.*" // mips64/hardfloat:"MOVV F.*, R.*"
// riscv64:"FMVXD" // riscv64:"FMVXD"
return math.Float64bits(f64+1) + 1 return math.Float64bits(f64+1) + 1
} }
func fromFloat32(f32 float32) uint32 { func fromFloat32(f32 float32) uint32 {
// amd64:"MOVL\tX.*, [^X].*" // amd64:"MOVL X.*, [^X].*"
// arm64:"FMOVS\tF.*, R.*" // arm64:"FMOVS F.*, R.*"
// loong64:"MOVW\tF.*, R.*" // loong64:"MOVW F.*, R.*"
// mips64/hardfloat:"MOVW\tF.*, R.*" // mips64/hardfloat:"MOVW F.*, R.*"
// riscv64:"FMVXW" // riscv64:"FMVXW"
return math.Float32bits(f32+1) + 1 return math.Float32bits(f32+1) + 1
} }
func toFloat64(u64 uint64) float64 { func toFloat64(u64 uint64) float64 {
// amd64:"MOVQ\t[^X].*, X.*" // amd64:"MOVQ [^X].*, X.*"
// arm64:"FMOVD\tR.*, F.*" // arm64:"FMOVD R.*, F.*"
// loong64:"MOVV\tR.*, F.*" // loong64:"MOVV R.*, F.*"
// ppc64x:"MTVSRD" // ppc64x:"MTVSRD"
// mips64/hardfloat:"MOVV\tR.*, F.*" // mips64/hardfloat:"MOVV R.*, F.*"
// riscv64:"FMVDX" // riscv64:"FMVDX"
return math.Float64frombits(u64+1) + 1 return math.Float64frombits(u64+1) + 1
} }
func toFloat32(u32 uint32) float32 { func toFloat32(u32 uint32) float32 {
// amd64:"MOVL\t[^X].*, X.*" // amd64:"MOVL [^X].*, X.*"
// arm64:"FMOVS\tR.*, F.*" // arm64:"FMOVS R.*, F.*"
// loong64:"MOVW\tR.*, F.*" // loong64:"MOVW R.*, F.*"
// mips64/hardfloat:"MOVW\tR.*, F.*" // mips64/hardfloat:"MOVW R.*, F.*"
// riscv64:"FMVWX" // riscv64:"FMVWX"
return math.Float32frombits(u32+1) + 1 return math.Float32frombits(u32+1) + 1
} }
@ -262,14 +262,14 @@ func toFloat32(u32 uint32) float32 {
// are evaluated at compile-time // are evaluated at compile-time
func constantCheck64() bool { func constantCheck64() bool {
// amd64:"(MOVB\t[$]0)|(XORL\t[A-Z][A-Z0-9]+, [A-Z][A-Z0-9]+)",-"FCMP",-"MOVB\t[$]1" // amd64:"(MOVB [$]0)|(XORL [A-Z][A-Z0-9]+, [A-Z][A-Z0-9]+)" -"FCMP" -"MOVB [$]1"
// s390x:"MOV(B|BZ|D)\t[$]0,",-"FCMPU",-"MOV(B|BZ|D)\t[$]1," // s390x:"MOV(B|BZ|D) [$]0," -"FCMPU" -"MOV(B|BZ|D) [$]1,"
return 0.5 == float64(uint32(1)) || 1.5 > float64(uint64(1<<63)) return 0.5 == float64(uint32(1)) || 1.5 > float64(uint64(1<<63))
} }
func constantCheck32() bool { func constantCheck32() bool {
// amd64:"MOV(B|L)\t[$]1",-"FCMP",-"MOV(B|L)\t[$]0" // amd64:"MOV(B|L) [$]1" -"FCMP" -"MOV(B|L) [$]0"
// s390x:"MOV(B|BZ|D)\t[$]1,",-"FCMPU",-"MOV(B|BZ|D)\t[$]0," // s390x:"MOV(B|BZ|D) [$]1," -"FCMPU" -"MOV(B|BZ|D) [$]0,"
return float32(0.5) <= float32(int64(1)) && float32(1.5) >= float32(int32(-1<<31)) return float32(0.5) <= float32(int64(1)) && float32(1.5) >= float32(int32(-1<<31))
} }
@ -277,12 +277,12 @@ func constantCheck32() bool {
// at compile-time // at compile-time
func constantConvert32(x float32) float32 { func constantConvert32(x float32) float32 {
// amd64:"MOVSS\t[$]f32.3f800000\\(SB\\)" // amd64:"MOVSS [$]f32.3f800000\\(SB\\)"
// s390x:"FMOVS\t[$]f32.3f800000\\(SB\\)" // s390x:"FMOVS [$]f32.3f800000\\(SB\\)"
// ppc64x/power8:"FMOVS\t[$]f32.3f800000\\(SB\\)" // ppc64x/power8:"FMOVS [$]f32.3f800000\\(SB\\)"
// ppc64x/power9:"FMOVS\t[$]f32.3f800000\\(SB\\)" // ppc64x/power9:"FMOVS [$]f32.3f800000\\(SB\\)"
// ppc64x/power10:"XXSPLTIDP\t[$]1065353216, VS0" // ppc64x/power10:"XXSPLTIDP [$]1065353216, VS0"
// arm64:"FMOVS\t[$]\\(1.0\\)" // arm64:"FMOVS [$]\\(1.0\\)"
if x > math.Float32frombits(0x3f800000) { if x > math.Float32frombits(0x3f800000) {
return -x return -x
} }
@ -343,7 +343,7 @@ func outOfBoundsConv(i32 *[2]int32, u32 *[2]uint32, i64 *[2]int64, u64 *[2]uint6
u32[0] = uint32(two41()) u32[0] = uint32(two41())
// on arm64, this uses an explicit <0 comparison, so it constant folds. // on arm64, this uses an explicit <0 comparison, so it constant folds.
// on amd64, this uses an explicit <0 comparison, so it constant folds. // on amd64, this uses an explicit <0 comparison, so it constant folds.
// amd64: "MOVL\t[$]0," // amd64: "MOVL [$]0,"
u32[1] = uint32(minus1()) u32[1] = uint32(minus1())
// arm64: "FCVTZSD" // arm64: "FCVTZSD"
// amd64: "CVTTSD2SQ" // amd64: "CVTTSD2SQ"
@ -356,7 +356,7 @@ func outOfBoundsConv(i32 *[2]int32, u32 *[2]uint32, i64 *[2]int64, u64 *[2]uint6
u64[0] = uint64(two81()) u64[0] = uint64(two81())
// arm64: "FCVTZUD" // arm64: "FCVTZUD"
// on amd64, this uses an explicit <0 comparison, so it constant folds. // on amd64, this uses an explicit <0 comparison, so it constant folds.
// amd64: "MOVQ\t[$]0," // amd64: "MOVQ [$]0,"
u64[1] = uint64(minus1()) u64[1] = uint64(minus1())
} }

View file

@ -20,10 +20,10 @@ func LeadingZeros(n uint) int {
// amd64/v3:"LZCNTQ", -"BSRQ" // amd64/v3:"LZCNTQ", -"BSRQ"
// arm64:"CLZ" // arm64:"CLZ"
// arm:"CLZ" // arm:"CLZ"
// loong64:"CLZV",-"SUB" // loong64:"CLZV" -"SUB"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"CNTLZD" // ppc64x:"CNTLZD"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t",-"SUB" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " -"SUB"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.LeadingZeros(n) return bits.LeadingZeros(n)
@ -34,52 +34,52 @@ func LeadingZeros64(n uint64) int {
// amd64/v3:"LZCNTQ", -"BSRQ" // amd64/v3:"LZCNTQ", -"BSRQ"
// arm:"CLZ" // arm:"CLZ"
// arm64:"CLZ" // arm64:"CLZ"
// loong64:"CLZV",-"SUB" // loong64:"CLZV" -"SUB"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"CNTLZD" // ppc64x:"CNTLZD"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t",-"ADDI" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " -"ADDI"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.LeadingZeros64(n) return bits.LeadingZeros64(n)
} }
func LeadingZeros32(n uint32) int { func LeadingZeros32(n uint32) int {
// amd64/v1,amd64/v2:"BSRQ","LEAQ",-"CMOVQEQ" // amd64/v1,amd64/v2:"BSRQ" "LEAQ" -"CMOVQEQ"
// amd64/v3: "LZCNTL",- "BSRL" // amd64/v3: "LZCNTL" - "BSRL"
// arm:"CLZ" // arm:"CLZ"
// arm64:"CLZW" // arm64:"CLZW"
// loong64:"CLZW",-"SUB" // loong64:"CLZW" -"SUB"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"CNTLZW" // ppc64x:"CNTLZW"
// riscv64/rva22u64,riscv64/rva23u64:"CLZW",-"ADDI" // riscv64/rva22u64,riscv64/rva23u64:"CLZW" -"ADDI"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.LeadingZeros32(n) return bits.LeadingZeros32(n)
} }
func LeadingZeros16(n uint16) int { func LeadingZeros16(n uint16) int {
// amd64/v1,amd64/v2:"BSRL","LEAL",-"CMOVQEQ" // amd64/v1,amd64/v2:"BSRL" "LEAL" -"CMOVQEQ"
// amd64/v3: "LZCNTL",- "BSRL" // amd64/v3: "LZCNTL" - "BSRL"
// arm64:"CLZ" // arm64:"CLZ"
// arm:"CLZ" // arm:"CLZ"
// loong64:"CLZV" // loong64:"CLZV"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"CNTLZD" // ppc64x:"CNTLZD"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t","ADDI\t\\$-48",-"NEG" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " "ADDI [$]-48" -"NEG"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.LeadingZeros16(n) return bits.LeadingZeros16(n)
} }
func LeadingZeros8(n uint8) int { func LeadingZeros8(n uint8) int {
// amd64/v1,amd64/v2:"BSRL","LEAL",-"CMOVQEQ" // amd64/v1,amd64/v2:"BSRL" "LEAL" -"CMOVQEQ"
// amd64/v3: "LZCNTL",- "BSRL" // amd64/v3: "LZCNTL" - "BSRL"
// arm64:"CLZ" // arm64:"CLZ"
// arm:"CLZ" // arm:"CLZ"
// loong64:"CLZV" // loong64:"CLZV"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"CNTLZD" // ppc64x:"CNTLZD"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t","ADDI\t\\$-56",-"NEG" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " "ADDI [$]-56" -"NEG"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.LeadingZeros8(n) return bits.LeadingZeros8(n)
@ -96,8 +96,8 @@ func Len(n uint) int {
// arm:"CLZ" // arm:"CLZ"
// loong64:"CLZV" // loong64:"CLZV"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"SUBC","CNTLZD" // ppc64x:"SUBC" "CNTLZD"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t","ADDI\t\\$-64" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " "ADDI [$]-64"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.Len(n) return bits.Len(n)
@ -110,62 +110,62 @@ func Len64(n uint64) int {
// arm:"CLZ" // arm:"CLZ"
// loong64:"CLZV" // loong64:"CLZV"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"SUBC","CNTLZD" // ppc64x:"SUBC" "CNTLZD"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t","ADDI\t\\$-64" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " "ADDI [$]-64"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.Len64(n) return bits.Len64(n)
} }
func SubFromLen64(n uint64) int { func SubFromLen64(n uint64) int {
// loong64:"CLZV",-"ADD" // loong64:"CLZV" -"ADD"
// ppc64x:"CNTLZD",-"SUBC" // ppc64x:"CNTLZD" -"SUBC"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t",-"ADDI",-"NEG" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " -"ADDI" -"NEG"
return 64 - bits.Len64(n) return 64 - bits.Len64(n)
} }
func CompareWithLen64(n uint64) bool { func CompareWithLen64(n uint64) bool {
// loong64:"CLZV",-"ADD",-"[$]64",-"[$]9" // loong64:"CLZV" -"ADD" -"[$]64" -"[$]9"
return bits.Len64(n) < 9 return bits.Len64(n) < 9
} }
func Len32(n uint32) int { func Len32(n uint32) int {
// amd64/v1,amd64/v2:"BSRQ","LEAQ",-"CMOVQEQ" // amd64/v1,amd64/v2:"BSRQ" "LEAQ" -"CMOVQEQ"
// amd64/v3: "LZCNTL" // amd64/v3: "LZCNTL"
// arm64:"CLZ" // arm64:"CLZ"
// arm:"CLZ" // arm:"CLZ"
// loong64:"CLZW" // loong64:"CLZW"
// mips:"CLZ" // mips:"CLZ"
// ppc64x: "CNTLZW" // ppc64x: "CNTLZW"
// riscv64/rva22u64,riscv64/rva23u64:"CLZW","ADDI\t\\$-32" // riscv64/rva22u64,riscv64/rva23u64:"CLZW" "ADDI [$]-32"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.Len32(n) return bits.Len32(n)
} }
func Len16(n uint16) int { func Len16(n uint16) int {
// amd64/v1,amd64/v2:"BSRL","LEAL",-"CMOVQEQ" // amd64/v1,amd64/v2:"BSRL" "LEAL" -"CMOVQEQ"
// amd64/v3: "LZCNTL" // amd64/v3: "LZCNTL"
// arm64:"CLZ" // arm64:"CLZ"
// arm:"CLZ" // arm:"CLZ"
// loong64:"CLZV" // loong64:"CLZV"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"SUBC","CNTLZD" // ppc64x:"SUBC" "CNTLZD"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t","ADDI\t\\$-64" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " "ADDI [$]-64"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.Len16(n) return bits.Len16(n)
} }
func Len8(n uint8) int { func Len8(n uint8) int {
// amd64/v1,amd64/v2:"BSRL","LEAL",-"CMOVQEQ" // amd64/v1,amd64/v2:"BSRL" "LEAL" -"CMOVQEQ"
// amd64/v3: "LZCNTL" // amd64/v3: "LZCNTL"
// arm64:"CLZ" // arm64:"CLZ"
// arm:"CLZ" // arm:"CLZ"
// loong64:"CLZV" // loong64:"CLZV"
// mips:"CLZ" // mips:"CLZ"
// ppc64x:"SUBC","CNTLZD" // ppc64x:"SUBC" "CNTLZD"
// riscv64/rva22u64,riscv64/rva23u64:"CLZ\t","ADDI\t\\$-64" // riscv64/rva22u64,riscv64/rva23u64:"CLZ " "ADDI [$]-64"
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Clz" // wasm:"I64Clz"
return bits.Len8(n) return bits.Len8(n)
@ -179,10 +179,10 @@ func Len8(n uint8) int {
func OnesCount(n uint) int { func OnesCount(n uint) int {
// amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT" // amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT"
// amd64:"POPCNTQ" // amd64:"POPCNTQ"
// arm64:"VCNT","VUADDLV" // arm64:"VCNT" "VUADDLV"
// loong64:"VPCNTV" // loong64:"VPCNTV"
// ppc64x:"POPCNTD" // ppc64x:"POPCNTD"
// riscv64:"CPOP\t" // riscv64:"CPOP "
// s390x:"POPCNT" // s390x:"POPCNT"
// wasm:"I64Popcnt" // wasm:"I64Popcnt"
return bits.OnesCount(n) return bits.OnesCount(n)
@ -191,10 +191,10 @@ func OnesCount(n uint) int {
func OnesCount64(n uint64) int { func OnesCount64(n uint64) int {
// amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT" // amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT"
// amd64:"POPCNTQ" // amd64:"POPCNTQ"
// arm64:"VCNT","VUADDLV" // arm64:"VCNT" "VUADDLV"
// loong64:"VPCNTV" // loong64:"VPCNTV"
// ppc64x:"POPCNTD" // ppc64x:"POPCNTD"
// riscv64:"CPOP\t" // riscv64:"CPOP "
// s390x:"POPCNT" // s390x:"POPCNT"
// wasm:"I64Popcnt" // wasm:"I64Popcnt"
return bits.OnesCount64(n) return bits.OnesCount64(n)
@ -203,7 +203,7 @@ func OnesCount64(n uint64) int {
func OnesCount32(n uint32) int { func OnesCount32(n uint32) int {
// amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT" // amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT"
// amd64:"POPCNTL" // amd64:"POPCNTL"
// arm64:"VCNT","VUADDLV" // arm64:"VCNT" "VUADDLV"
// loong64:"VPCNTW" // loong64:"VPCNTW"
// ppc64x:"POPCNTW" // ppc64x:"POPCNTW"
// riscv64:"CPOPW" // riscv64:"CPOPW"
@ -215,10 +215,10 @@ func OnesCount32(n uint32) int {
func OnesCount16(n uint16) int { func OnesCount16(n uint16) int {
// amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT" // amd64/v2:-".*x86HasPOPCNT" amd64/v3:-".*x86HasPOPCNT"
// amd64:"POPCNTL" // amd64:"POPCNTL"
// arm64:"VCNT","VUADDLV" // arm64:"VCNT" "VUADDLV"
// loong64:"VPCNTH" // loong64:"VPCNTH"
// ppc64x:"POPCNTW" // ppc64x:"POPCNTW"
// riscv64:"CPOP\t" // riscv64:"CPOP "
// s390x:"POPCNT" // s390x:"POPCNT"
// wasm:"I64Popcnt" // wasm:"I64Popcnt"
return bits.OnesCount16(n) return bits.OnesCount16(n)
@ -226,7 +226,7 @@ func OnesCount16(n uint16) int {
func OnesCount8(n uint8) int { func OnesCount8(n uint8) int {
// ppc64x:"POPCNTB" // ppc64x:"POPCNTB"
// riscv64/rva22u64,riscv64/rva23u64:"CPOP\t" // riscv64/rva22u64,riscv64/rva23u64:"CPOP "
// s390x:"POPCNT" // s390x:"POPCNT"
// wasm:"I64Popcnt" // wasm:"I64Popcnt"
return bits.OnesCount8(n) return bits.OnesCount8(n)
@ -252,7 +252,7 @@ func Reverse32(n uint32) uint32 {
} }
func Reverse16(n uint16) uint16 { func Reverse16(n uint16) uint16 {
// loong64:"BITREV4B","REVB2H" // loong64:"BITREV4B" "REVB2H"
return bits.Reverse16(n) return bits.Reverse16(n)
} }
@ -292,20 +292,20 @@ func ReverseBytes32(n uint32) uint32 {
// arm64:"REVW" // arm64:"REVW"
// loong64:"REVB2W" // loong64:"REVB2W"
// ppc64x/power10: "BRW" // ppc64x/power10: "BRW"
// riscv64/rva22u64,riscv64/rva23u64:"REV8","SRLI\t\\$32" // riscv64/rva22u64,riscv64/rva23u64:"REV8" "SRLI [$]32"
// s390x:"MOVWBR" // s390x:"MOVWBR"
return bits.ReverseBytes32(n) return bits.ReverseBytes32(n)
} }
func ReverseBytes16(n uint16) uint16 { func ReverseBytes16(n uint16) uint16 {
// amd64:"ROLW" // amd64:"ROLW"
// arm/5:"SLL","SRL","ORR" // arm/5:"SLL" "SRL" "ORR"
// arm/6:"REV16" // arm/6:"REV16"
// arm/7:"REV16" // arm/7:"REV16"
// arm64:"REV16W",-"UBFX",-"ORR" // arm64:"REV16W" -"UBFX" -"ORR"
// loong64:"REVB2H" // loong64:"REVB2H"
// ppc64x/power10: "BRH" // ppc64x/power10: "BRH"
// riscv64/rva22u64,riscv64/rva23u64:"REV8","SRLI\t\\$48" // riscv64/rva22u64,riscv64/rva23u64:"REV8" "SRLI [$]48"
return bits.ReverseBytes16(n) return bits.ReverseBytes16(n)
} }
@ -319,16 +319,16 @@ func RotateLeft64(n uint64) uint64 {
// loong64:"ROTRV" // loong64:"ROTRV"
// ppc64x:"ROTL" // ppc64x:"ROTL"
// riscv64:"RORI" // riscv64:"RORI"
// s390x:"RISBGZ\t[$]0, [$]63, [$]37, " // s390x:"RISBGZ [$]0, [$]63, [$]37, "
// wasm:"I64Rotl" // wasm:"I64Rotl"
return bits.RotateLeft64(n, 37) return bits.RotateLeft64(n, 37)
} }
func RotateLeft32(n uint32) uint32 { func RotateLeft32(n uint32) uint32 {
// amd64:"ROLL" 386:"ROLL" // amd64:"ROLL" 386:"ROLL"
// arm:`MOVW\tR[0-9]+@>23` // arm:`MOVW R[0-9]+@>23`
// arm64:"RORW" // arm64:"RORW"
// loong64:"ROTR\t" // loong64:"ROTR "
// ppc64x:"ROTLW" // ppc64x:"ROTLW"
// riscv64:"RORIW" // riscv64:"RORIW"
// s390x:"RLL" // s390x:"RLL"
@ -338,15 +338,15 @@ func RotateLeft32(n uint32) uint32 {
func RotateLeft16(n uint16, s int) uint16 { func RotateLeft16(n uint16, s int) uint16 {
// amd64:"ROLW" 386:"ROLW" // amd64:"ROLW" 386:"ROLW"
// arm64:"RORW",-"CSEL" // arm64:"RORW" -"CSEL"
// loong64:"ROTR\t","SLLV" // loong64:"ROTR " "SLLV"
return bits.RotateLeft16(n, s) return bits.RotateLeft16(n, s)
} }
func RotateLeft8(n uint8, s int) uint8 { func RotateLeft8(n uint8, s int) uint8 {
// amd64:"ROLB" 386:"ROLB" // amd64:"ROLB" 386:"ROLB"
// arm64:"LSL","LSR",-"CSEL" // arm64:"LSL" "LSR" -"CSEL"
// loong64:"OR","SLLV","SRLV" // loong64:"OR" "SLLV" "SRLV"
return bits.RotateLeft8(n, s) return bits.RotateLeft8(n, s)
} }
@ -373,10 +373,10 @@ func RotateLeftVariable64(n uint64, m int) uint64 {
} }
func RotateLeftVariable32(n uint32, m int) uint32 { func RotateLeftVariable32(n uint32, m int) uint32 {
// arm:`MOVW\tR[0-9]+@>R[0-9]+` // arm:`MOVW R[0-9]+@>R[0-9]+`
// amd64:"ROLL" // amd64:"ROLL"
// arm64:"RORW" // arm64:"RORW"
// loong64:"ROTR\t" // loong64:"ROTR "
// ppc64x:"ROTLW" // ppc64x:"ROTLW"
// riscv64:"ROLW" // riscv64:"ROLW"
// s390x:"RLL" // s390x:"RLL"
@ -390,78 +390,78 @@ func RotateLeftVariable32(n uint32, m int) uint32 {
func TrailingZeros(n uint) int { func TrailingZeros(n uint) int {
// 386:"BSFL" // 386:"BSFL"
// amd64/v1,amd64/v2:"BSFQ","MOVL\t\\$64","CMOVQEQ" // amd64/v1,amd64/v2:"BSFQ" "MOVL [$]64" "CMOVQEQ"
// amd64/v3:"TZCNTQ" // amd64/v3:"TZCNTQ"
// arm:"CLZ" // arm:"CLZ"
// arm64:"RBIT","CLZ" // arm64:"RBIT" "CLZ"
// loong64:"CTZV" // loong64:"CTZV"
// ppc64x/power8:"ANDN","POPCNTD" // ppc64x/power8:"ANDN" "POPCNTD"
// ppc64x/power9: "CNTTZD" // ppc64x/power9: "CNTTZD"
// riscv64/rva22u64,riscv64/rva23u64: "CTZ\t" // riscv64/rva22u64,riscv64/rva23u64: "CTZ "
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Ctz" // wasm:"I64Ctz"
return bits.TrailingZeros(n) return bits.TrailingZeros(n)
} }
func TrailingZeros64(n uint64) int { func TrailingZeros64(n uint64) int {
// 386:"BSFL","JNE" // 386:"BSFL" "JNE"
// amd64/v1,amd64/v2:"BSFQ","MOVL\t\\$64","CMOVQEQ" // amd64/v1,amd64/v2:"BSFQ" "MOVL [$]64" "CMOVQEQ"
// amd64/v3:"TZCNTQ" // amd64/v3:"TZCNTQ"
// arm64:"RBIT","CLZ" // arm64:"RBIT" "CLZ"
// loong64:"CTZV" // loong64:"CTZV"
// ppc64x/power8:"ANDN","POPCNTD" // ppc64x/power8:"ANDN" "POPCNTD"
// ppc64x/power9: "CNTTZD" // ppc64x/power9: "CNTTZD"
// riscv64/rva22u64,riscv64/rva23u64: "CTZ\t" // riscv64/rva22u64,riscv64/rva23u64: "CTZ "
// s390x:"FLOGR" // s390x:"FLOGR"
// wasm:"I64Ctz" // wasm:"I64Ctz"
return bits.TrailingZeros64(n) return bits.TrailingZeros64(n)
} }
func TrailingZeros64Subtract(n uint64) int { func TrailingZeros64Subtract(n uint64) int {
// ppc64x/power8:"NEG","SUBC","ANDN","POPCNTD" // ppc64x/power8:"NEG" "SUBC" "ANDN" "POPCNTD"
// ppc64x/power9:"SUBC","CNTTZD" // ppc64x/power9:"SUBC" "CNTTZD"
return bits.TrailingZeros64(1 - n) return bits.TrailingZeros64(1 - n)
} }
func TrailingZeros32(n uint32) int { func TrailingZeros32(n uint32) int {
// 386:"BSFL" // 386:"BSFL"
// amd64/v1,amd64/v2:"BTSQ\\t\\$32","BSFQ" // amd64/v1,amd64/v2:"BTSQ [$]32" "BSFQ"
// amd64/v3:"TZCNTL" // amd64/v3:"TZCNTL"
// arm:"CLZ" // arm:"CLZ"
// arm64:"RBITW","CLZW" // arm64:"RBITW" "CLZW"
// loong64:"CTZW" // loong64:"CTZW"
// ppc64x/power8:"ANDN","POPCNTW" // ppc64x/power8:"ANDN" "POPCNTW"
// ppc64x/power9: "CNTTZW" // ppc64x/power9: "CNTTZW"
// riscv64/rva22u64,riscv64/rva23u64: "CTZW" // riscv64/rva22u64,riscv64/rva23u64: "CTZW"
// s390x:"FLOGR","MOVWZ" // s390x:"FLOGR" "MOVWZ"
// wasm:"I64Ctz" // wasm:"I64Ctz"
return bits.TrailingZeros32(n) return bits.TrailingZeros32(n)
} }
func TrailingZeros16(n uint16) int { func TrailingZeros16(n uint16) int {
// 386:"BSFL\t" // 386:"BSFL "
// amd64:"BSFL","ORL\\t\\$65536" // amd64:"BSFL" "ORL [$]65536"
// arm:"ORR\t\\$65536","CLZ",-"MOVHU\tR" // arm:"ORR [$]65536" "CLZ" -"MOVHU R"
// arm64:"ORR\t\\$65536","RBITW","CLZW",-"MOVHU\tR",-"RBIT\t",-"CLZ\t" // arm64:"ORR [$]65536" "RBITW" "CLZW" -"MOVHU R" -"RBIT " -"CLZ "
// loong64:"CTZV" // loong64:"CTZV"
// ppc64x/power8:"POPCNTW","ADD\t\\$-1" // ppc64x/power8:"POPCNTW" "ADD [$]-1"
// ppc64x/power9:"CNTTZD","ORIS\\t\\$1" // ppc64x/power9:"CNTTZD" "ORIS [$]1"
// riscv64/rva22u64,riscv64/rva23u64: "ORI\t\\$65536","CTZW" // riscv64/rva22u64,riscv64/rva23u64: "ORI [$]65536" "CTZW"
// s390x:"FLOGR","OR\t\\$65536" // s390x:"FLOGR" "OR [$]65536"
// wasm:"I64Ctz" // wasm:"I64Ctz"
return bits.TrailingZeros16(n) return bits.TrailingZeros16(n)
} }
func TrailingZeros8(n uint8) int { func TrailingZeros8(n uint8) int {
// 386:"BSFL" // 386:"BSFL"
// amd64:"BSFL","ORL\\t\\$256" // amd64:"BSFL" "ORL [$]256"
// arm:"ORR\t\\$256","CLZ",-"MOVBU\tR" // arm:"ORR [$]256" "CLZ" -"MOVBU R"
// arm64:"ORR\t\\$256","RBITW","CLZW",-"MOVBU\tR",-"RBIT\t",-"CLZ\t" // arm64:"ORR [$]256" "RBITW" "CLZW" -"MOVBU R" -"RBIT " -"CLZ "
// loong64:"CTZV" // loong64:"CTZV"
// ppc64x/power8:"POPCNTB","ADD\t\\$-1" // ppc64x/power8:"POPCNTB" "ADD [$]-1"
// ppc64x/power9:"CNTTZD","OR\t\\$256" // ppc64x/power9:"CNTTZD" "OR [$]256"
// riscv64/rva22u64,riscv64/rva23u64: "ORI\t\\$256","CTZW" // riscv64/rva22u64,riscv64/rva23u64: "ORI [$]256" "CTZW"
// s390x:"FLOGR","OR\t\\$256" // s390x:"FLOGR" "OR [$]256"
// wasm:"I64Ctz" // wasm:"I64Ctz"
return bits.TrailingZeros8(n) return bits.TrailingZeros8(n)
} }
@ -471,7 +471,7 @@ func TrailingZeros8(n uint8) int {
func IterateBits(n uint) int { func IterateBits(n uint) int {
i := 0 i := 0
for n != 0 { for n != 0 {
// amd64/v1,amd64/v2:"BSFQ",-"CMOVEQ" // amd64/v1,amd64/v2:"BSFQ" -"CMOVEQ"
// amd64/v3:"TZCNTQ" // amd64/v3:"TZCNTQ"
i += bits.TrailingZeros(n) i += bits.TrailingZeros(n)
n &= n - 1 n &= n - 1
@ -482,9 +482,9 @@ func IterateBits(n uint) int {
func IterateBits64(n uint64) int { func IterateBits64(n uint64) int {
i := 0 i := 0
for n != 0 { for n != 0 {
// amd64/v1,amd64/v2:"BSFQ",-"CMOVEQ" // amd64/v1,amd64/v2:"BSFQ" -"CMOVEQ"
// amd64/v3:"TZCNTQ" // amd64/v3:"TZCNTQ"
// riscv64/rva22u64,riscv64/rva23u64: "CTZ\t" // riscv64/rva22u64,riscv64/rva23u64: "CTZ "
i += bits.TrailingZeros64(n) i += bits.TrailingZeros64(n)
n &= n - 1 n &= n - 1
} }
@ -494,9 +494,9 @@ func IterateBits64(n uint64) int {
func IterateBits32(n uint32) int { func IterateBits32(n uint32) int {
i := 0 i := 0
for n != 0 { for n != 0 {
// amd64/v1,amd64/v2:"BSFL",-"BTSQ" // amd64/v1,amd64/v2:"BSFL" -"BTSQ"
// amd64/v3:"TZCNTL" // amd64/v3:"TZCNTL"
// riscv64/rva22u64,riscv64/rva23u64: "CTZ\t" // riscv64/rva22u64,riscv64/rva23u64: "CTZ "
i += bits.TrailingZeros32(n) i += bits.TrailingZeros32(n)
n &= n - 1 n &= n - 1
} }
@ -506,10 +506,10 @@ func IterateBits32(n uint32) int {
func IterateBits16(n uint16) int { func IterateBits16(n uint16) int {
i := 0 i := 0
for n != 0 { for n != 0 {
// amd64/v1,amd64/v2:"BSFL",-"BTSL" // amd64/v1,amd64/v2:"BSFL" -"BTSL"
// amd64/v3:"TZCNTL" // amd64/v3:"TZCNTL"
// arm64:"RBITW","CLZW",-"ORR" // arm64:"RBITW" "CLZW" -"ORR"
// riscv64/rva22u64,riscv64/rva23u64: "CTZ\t",-"ORR" // riscv64/rva22u64,riscv64/rva23u64: "CTZ " -"ORR"
i += bits.TrailingZeros16(n) i += bits.TrailingZeros16(n)
n &= n - 1 n &= n - 1
} }
@ -519,10 +519,10 @@ func IterateBits16(n uint16) int {
func IterateBits8(n uint8) int { func IterateBits8(n uint8) int {
i := 0 i := 0
for n != 0 { for n != 0 {
// amd64/v1,amd64/v2:"BSFL",-"BTSL" // amd64/v1,amd64/v2:"BSFL" -"BTSL"
// amd64/v3:"TZCNTL" // amd64/v3:"TZCNTL"
// arm64:"RBITW","CLZW",-"ORR" // arm64:"RBITW" "CLZW" -"ORR"
// riscv64/rva22u64,riscv64/rva23u64: "CTZ\t",-"ORR" // riscv64/rva22u64,riscv64/rva23u64: "CTZ " -"ORR"
i += bits.TrailingZeros8(n) i += bits.TrailingZeros8(n)
n &= n - 1 n &= n - 1
} }
@ -534,44 +534,44 @@ func IterateBits8(n uint8) int {
// --------------- // // --------------- //
func Add(x, y, ci uint) (r, co uint) { func Add(x, y, ci uint) (r, co uint) {
// arm64:"ADDS","ADCS","ADC",-"ADD\t",-"CMP" // arm64:"ADDS" "ADCS" "ADC" -"ADD " -"CMP"
// amd64:"NEGL","ADCQ","SBBQ","NEGQ" // amd64:"NEGL" "ADCQ" "SBBQ" "NEGQ"
// ppc64x: "ADDC", "ADDE", "ADDZE" // ppc64x: "ADDC", "ADDE", "ADDZE"
// s390x:"ADDE","ADDC\t[$]-1," // s390x:"ADDE" "ADDC [$]-1,"
// riscv64: "ADD","SLTU" // riscv64: "ADD" "SLTU"
return bits.Add(x, y, ci) return bits.Add(x, y, ci)
} }
func AddC(x, ci uint) (r, co uint) { func AddC(x, ci uint) (r, co uint) {
// arm64:"ADDS","ADCS","ADC",-"ADD\t",-"CMP" // arm64:"ADDS" "ADCS" "ADC" -"ADD " -"CMP"
// amd64:"NEGL","ADCQ","SBBQ","NEGQ" // amd64:"NEGL" "ADCQ" "SBBQ" "NEGQ"
// loong64: "ADDV", "SGTU" // loong64: "ADDV", "SGTU"
// ppc64x: "ADDC", "ADDE", "ADDZE" // ppc64x: "ADDC", "ADDE", "ADDZE"
// s390x:"ADDE","ADDC\t[$]-1," // s390x:"ADDE" "ADDC [$]-1,"
// mips64:"ADDV","SGTU" // mips64:"ADDV" "SGTU"
// riscv64: "ADD","SLTU" // riscv64: "ADD" "SLTU"
return bits.Add(x, 7, ci) return bits.Add(x, 7, ci)
} }
func AddZ(x, y uint) (r, co uint) { func AddZ(x, y uint) (r, co uint) {
// arm64:"ADDS","ADC",-"ADCS",-"ADD\t",-"CMP" // arm64:"ADDS" "ADC" -"ADCS" -"ADD " -"CMP"
// amd64:"ADDQ","SBBQ","NEGQ",-"NEGL",-"ADCQ" // amd64:"ADDQ" "SBBQ" "NEGQ" -"NEGL" -"ADCQ"
// loong64: "ADDV", "SGTU" // loong64: "ADDV", "SGTU"
// ppc64x: "ADDC", -"ADDE", "ADDZE" // ppc64x: "ADDC", -"ADDE", "ADDZE"
// s390x:"ADDC",-"ADDC\t[$]-1," // s390x:"ADDC" -"ADDC [$]-1,"
// mips64:"ADDV","SGTU" // mips64:"ADDV" "SGTU"
// riscv64: "ADD","SLTU" // riscv64: "ADD" "SLTU"
return bits.Add(x, y, 0) return bits.Add(x, y, 0)
} }
func AddR(x, y, ci uint) uint { func AddR(x, y, ci uint) uint {
// arm64:"ADDS","ADCS",-"ADD\t",-"CMP" // arm64:"ADDS" "ADCS" -"ADD " -"CMP"
// amd64:"NEGL","ADCQ",-"SBBQ",-"NEGQ" // amd64:"NEGL" "ADCQ" -"SBBQ" -"NEGQ"
// loong64: "ADDV", -"SGTU" // loong64: "ADDV", -"SGTU"
// ppc64x: "ADDC", "ADDE", -"ADDZE" // ppc64x: "ADDC", "ADDE", -"ADDZE"
// s390x:"ADDE","ADDC\t[$]-1," // s390x:"ADDE" "ADDC [$]-1,"
// mips64:"ADDV",-"SGTU" // mips64:"ADDV" -"SGTU"
// riscv64: "ADD",-"SLTU" // riscv64: "ADD" -"SLTU"
r, _ := bits.Add(x, y, ci) r, _ := bits.Add(x, y, ci)
return r return r
} }
@ -579,54 +579,54 @@ func AddR(x, y, ci uint) uint {
func AddM(p, q, r *[3]uint) { func AddM(p, q, r *[3]uint) {
var c uint var c uint
r[0], c = bits.Add(p[0], q[0], c) r[0], c = bits.Add(p[0], q[0], c)
// arm64:"ADCS",-"ADD\t",-"CMP" // arm64:"ADCS" -"ADD " -"CMP"
// amd64:"ADCQ",-"NEGL",-"SBBQ",-"NEGQ" // amd64:"ADCQ" -"NEGL" -"SBBQ" -"NEGQ"
// s390x:"ADDE",-"ADDC\t[$]-1," // s390x:"ADDE" -"ADDC [$]-1,"
r[1], c = bits.Add(p[1], q[1], c) r[1], c = bits.Add(p[1], q[1], c)
r[2], c = bits.Add(p[2], q[2], c) r[2], c = bits.Add(p[2], q[2], c)
} }
func Add64(x, y, ci uint64) (r, co uint64) { func Add64(x, y, ci uint64) (r, co uint64) {
// arm64:"ADDS","ADCS","ADC",-"ADD\t",-"CMP" // arm64:"ADDS" "ADCS" "ADC" -"ADD " -"CMP"
// amd64:"NEGL","ADCQ","SBBQ","NEGQ" // amd64:"NEGL" "ADCQ" "SBBQ" "NEGQ"
// loong64: "ADDV", "SGTU" // loong64: "ADDV", "SGTU"
// ppc64x: "ADDC", "ADDE", "ADDZE" // ppc64x: "ADDC", "ADDE", "ADDZE"
// s390x:"ADDE","ADDC\t[$]-1," // s390x:"ADDE" "ADDC [$]-1,"
// mips64:"ADDV","SGTU" // mips64:"ADDV" "SGTU"
// riscv64: "ADD","SLTU" // riscv64: "ADD" "SLTU"
return bits.Add64(x, y, ci) return bits.Add64(x, y, ci)
} }
func Add64C(x, ci uint64) (r, co uint64) { func Add64C(x, ci uint64) (r, co uint64) {
// arm64:"ADDS","ADCS","ADC",-"ADD\t",-"CMP" // arm64:"ADDS" "ADCS" "ADC" -"ADD " -"CMP"
// amd64:"NEGL","ADCQ","SBBQ","NEGQ" // amd64:"NEGL" "ADCQ" "SBBQ" "NEGQ"
// loong64: "ADDV", "SGTU" // loong64: "ADDV", "SGTU"
// ppc64x: "ADDC", "ADDE", "ADDZE" // ppc64x: "ADDC", "ADDE", "ADDZE"
// s390x:"ADDE","ADDC\t[$]-1," // s390x:"ADDE" "ADDC [$]-1,"
// mips64:"ADDV","SGTU" // mips64:"ADDV" "SGTU"
// riscv64: "ADD","SLTU" // riscv64: "ADD" "SLTU"
return bits.Add64(x, 7, ci) return bits.Add64(x, 7, ci)
} }
func Add64Z(x, y uint64) (r, co uint64) { func Add64Z(x, y uint64) (r, co uint64) {
// arm64:"ADDS","ADC",-"ADCS",-"ADD\t",-"CMP" // arm64:"ADDS" "ADC" -"ADCS" -"ADD " -"CMP"
// amd64:"ADDQ","SBBQ","NEGQ",-"NEGL",-"ADCQ" // amd64:"ADDQ" "SBBQ" "NEGQ" -"NEGL" -"ADCQ"
// loong64: "ADDV", "SGTU" // loong64: "ADDV", "SGTU"
// ppc64x: "ADDC", -"ADDE", "ADDZE" // ppc64x: "ADDC", -"ADDE", "ADDZE"
// s390x:"ADDC",-"ADDC\t[$]-1," // s390x:"ADDC" -"ADDC [$]-1,"
// mips64:"ADDV","SGTU" // mips64:"ADDV" "SGTU"
// riscv64: "ADD","SLTU" // riscv64: "ADD" "SLTU"
return bits.Add64(x, y, 0) return bits.Add64(x, y, 0)
} }
func Add64R(x, y, ci uint64) uint64 { func Add64R(x, y, ci uint64) uint64 {
// arm64:"ADDS","ADCS",-"ADD\t",-"CMP" // arm64:"ADDS" "ADCS" -"ADD " -"CMP"
// amd64:"NEGL","ADCQ",-"SBBQ",-"NEGQ" // amd64:"NEGL" "ADCQ" -"SBBQ" -"NEGQ"
// loong64: "ADDV", -"SGTU" // loong64: "ADDV", -"SGTU"
// ppc64x: "ADDC", "ADDE", -"ADDZE" // ppc64x: "ADDC", "ADDE", -"ADDZE"
// s390x:"ADDE","ADDC\t[$]-1," // s390x:"ADDE" "ADDC [$]-1,"
// mips64:"ADDV",-"SGTU" // mips64:"ADDV" -"SGTU"
// riscv64: "ADD",-"SLTU" // riscv64: "ADD" -"SLTU"
r, _ := bits.Add64(x, y, ci) r, _ := bits.Add64(x, y, ci)
return r return r
} }
@ -634,10 +634,10 @@ func Add64R(x, y, ci uint64) uint64 {
func Add64M(p, q, r *[3]uint64) { func Add64M(p, q, r *[3]uint64) {
var c uint64 var c uint64
r[0], c = bits.Add64(p[0], q[0], c) r[0], c = bits.Add64(p[0], q[0], c)
// arm64:"ADCS",-"ADD\t",-"CMP" // arm64:"ADCS" -"ADD " -"CMP"
// amd64:"ADCQ",-"NEGL",-"SBBQ",-"NEGQ" // amd64:"ADCQ" -"NEGL" -"SBBQ" -"NEGQ"
// ppc64x: -"ADDC", "ADDE", -"ADDZE" // ppc64x: -"ADDC", "ADDE", -"ADDZE"
// s390x:"ADDE",-"ADDC\t[$]-1," // s390x:"ADDE" -"ADDC [$]-1,"
r[1], c = bits.Add64(p[1], q[1], c) r[1], c = bits.Add64(p[1], q[1], c)
r[2], c = bits.Add64(p[2], q[2], c) r[2], c = bits.Add64(p[2], q[2], c)
} }
@ -645,22 +645,22 @@ func Add64M(p, q, r *[3]uint64) {
func Add64M0(p, q, r *[3]uint64) { func Add64M0(p, q, r *[3]uint64) {
var c uint64 var c uint64
r[0], c = bits.Add64(p[0], q[0], 0) r[0], c = bits.Add64(p[0], q[0], 0)
// ppc64x: -"ADDC", -"ADDE", "ADDZE\tR[1-9]" // ppc64x: -"ADDC", -"ADDE", "ADDZE R[1-9]"
r[1], c = bits.Add64(p[1], 0, c) r[1], c = bits.Add64(p[1], 0, c)
// ppc64x: -"ADDC", "ADDE", -"ADDZE" // ppc64x: -"ADDC", "ADDE", -"ADDZE"
r[2], c = bits.Add64(p[2], p[2], c) r[2], c = bits.Add64(p[2], p[2], c)
} }
func Add64MSaveC(p, q, r, c *[2]uint64) { func Add64MSaveC(p, q, r, c *[2]uint64) {
// ppc64x: "ADDC\tR", "ADDZE" // ppc64x: "ADDC R", "ADDZE"
r[0], c[0] = bits.Add64(p[0], q[0], 0) r[0], c[0] = bits.Add64(p[0], q[0], 0)
// ppc64x: "ADDC\t[$]-1", "ADDE", "ADDZE" // ppc64x: "ADDC [$]-1", "ADDE", "ADDZE"
r[1], c[1] = bits.Add64(p[1], q[1], c[0]) r[1], c[1] = bits.Add64(p[1], q[1], c[0])
} }
func Add64PanicOnOverflowEQ(a, b uint64) uint64 { func Add64PanicOnOverflowEQ(a, b uint64) uint64 {
r, c := bits.Add64(a, b, 0) r, c := bits.Add64(a, b, 0)
// s390x:"BRC\t[$]3,",-"ADDE" // s390x:"BRC [$]3," -"ADDE"
if c == 1 { if c == 1 {
panic("overflow") panic("overflow")
} }
@ -669,7 +669,7 @@ func Add64PanicOnOverflowEQ(a, b uint64) uint64 {
func Add64PanicOnOverflowNE(a, b uint64) uint64 { func Add64PanicOnOverflowNE(a, b uint64) uint64 {
r, c := bits.Add64(a, b, 0) r, c := bits.Add64(a, b, 0)
// s390x:"BRC\t[$]3,",-"ADDE" // s390x:"BRC [$]3," -"ADDE"
if c != 0 { if c != 0 {
panic("overflow") panic("overflow")
} }
@ -678,7 +678,7 @@ func Add64PanicOnOverflowNE(a, b uint64) uint64 {
func Add64PanicOnOverflowGT(a, b uint64) uint64 { func Add64PanicOnOverflowGT(a, b uint64) uint64 {
r, c := bits.Add64(a, b, 0) r, c := bits.Add64(a, b, 0)
// s390x:"BRC\t[$]3,",-"ADDE" // s390x:"BRC [$]3," -"ADDE"
if c > 0 { if c > 0 {
panic("overflow") panic("overflow")
} }
@ -690,7 +690,7 @@ func Add64MPanicOnOverflowEQ(a, b [2]uint64) [2]uint64 {
var c uint64 var c uint64
r[0], c = bits.Add64(a[0], b[0], c) r[0], c = bits.Add64(a[0], b[0], c)
r[1], c = bits.Add64(a[1], b[1], c) r[1], c = bits.Add64(a[1], b[1], c)
// s390x:"BRC\t[$]3," // s390x:"BRC [$]3,"
if c == 1 { if c == 1 {
panic("overflow") panic("overflow")
} }
@ -702,7 +702,7 @@ func Add64MPanicOnOverflowNE(a, b [2]uint64) [2]uint64 {
var c uint64 var c uint64
r[0], c = bits.Add64(a[0], b[0], c) r[0], c = bits.Add64(a[0], b[0], c)
r[1], c = bits.Add64(a[1], b[1], c) r[1], c = bits.Add64(a[1], b[1], c)
// s390x:"BRC\t[$]3," // s390x:"BRC [$]3,"
if c != 0 { if c != 0 {
panic("overflow") panic("overflow")
} }
@ -714,7 +714,7 @@ func Add64MPanicOnOverflowGT(a, b [2]uint64) [2]uint64 {
var c uint64 var c uint64
r[0], c = bits.Add64(a[0], b[0], c) r[0], c = bits.Add64(a[0], b[0], c)
r[1], c = bits.Add64(a[1], b[1], c) r[1], c = bits.Add64(a[1], b[1], c)
// s390x:"BRC\t[$]3," // s390x:"BRC [$]3,"
if c > 0 { if c > 0 {
panic("overflow") panic("overflow")
} }
@ -737,14 +737,14 @@ func Add64MultipleChains(a, b, c, d [2]uint64) [2]uint64 {
b1, b2 := b[0], b[1] b1, b2 := b[0], b[1]
c1, c2 := c[0], c[1] c1, c2 := c[0], c[1]
// ppc64x: "ADDC\tR\\d+,", -"ADDE", -"MOVD\tXER" // ppc64x: "ADDC R\\d+,", -"ADDE", -"MOVD XER"
d1, cx = bits.Add64(a1, b1, 0) d1, cx = bits.Add64(a1, b1, 0)
// ppc64x: "ADDE", -"ADDC", -"MOVD\t.*, XER" // ppc64x: "ADDE", -"ADDC", -"MOVD .*, XER"
d2, _ = bits.Add64(a2, b2, cx) d2, _ = bits.Add64(a2, b2, cx)
// ppc64x: "ADDC\tR\\d+,", -"ADDE", -"MOVD\tXER" // ppc64x: "ADDC R\\d+,", -"ADDE", -"MOVD XER"
d1, cx = bits.Add64(c1, d1, 0) d1, cx = bits.Add64(c1, d1, 0)
// ppc64x: "ADDE", -"ADDC", -"MOVD\t.*, XER" // ppc64x: "ADDE", -"ADDC", -"MOVD .*, XER"
d2, _ = bits.Add64(c2, d2, cx) d2, _ = bits.Add64(c2, d2, cx)
d[0] = d1 d[0] = d1
d[1] = d2 d[1] = d2
@ -756,53 +756,53 @@ func Add64MultipleChains(a, b, c, d [2]uint64) [2]uint64 {
// --------------- // // --------------- //
func Sub(x, y, ci uint) (r, co uint) { func Sub(x, y, ci uint) (r, co uint) {
// amd64:"NEGL","SBBQ","NEGQ" // amd64:"NEGL" "SBBQ" "NEGQ"
// arm64:"NEGS","SBCS","NGC","NEG",-"ADD",-"SUB",-"CMP" // arm64:"NEGS" "SBCS" "NGC" "NEG" -"ADD" -"SUB" -"CMP"
// loong64:"SUBV","SGTU" // loong64:"SUBV" "SGTU"
// ppc64x:"SUBC", "SUBE", "SUBZE", "NEG" // ppc64x:"SUBC", "SUBE", "SUBZE", "NEG"
// s390x:"SUBE" // s390x:"SUBE"
// mips64:"SUBV","SGTU" // mips64:"SUBV" "SGTU"
// riscv64: "SUB","SLTU" // riscv64: "SUB" "SLTU"
return bits.Sub(x, y, ci) return bits.Sub(x, y, ci)
} }
func SubC(x, ci uint) (r, co uint) { func SubC(x, ci uint) (r, co uint) {
// amd64:"NEGL","SBBQ","NEGQ" // amd64:"NEGL" "SBBQ" "NEGQ"
// arm64:"NEGS","SBCS","NGC","NEG",-"ADD",-"SUB",-"CMP" // arm64:"NEGS" "SBCS" "NGC" "NEG" -"ADD" -"SUB" -"CMP"
// loong64:"SUBV","SGTU" // loong64:"SUBV" "SGTU"
// ppc64x:"SUBC", "SUBE", "SUBZE", "NEG" // ppc64x:"SUBC", "SUBE", "SUBZE", "NEG"
// s390x:"SUBE" // s390x:"SUBE"
// mips64:"SUBV","SGTU" // mips64:"SUBV" "SGTU"
// riscv64: "SUB","SLTU" // riscv64: "SUB" "SLTU"
return bits.Sub(x, 7, ci) return bits.Sub(x, 7, ci)
} }
func SubZ(x, y uint) (r, co uint) { func SubZ(x, y uint) (r, co uint) {
// amd64:"SUBQ","SBBQ","NEGQ",-"NEGL" // amd64:"SUBQ" "SBBQ" "NEGQ" -"NEGL"
// arm64:"SUBS","NGC","NEG",-"SBCS",-"ADD",-"SUB\t",-"CMP" // arm64:"SUBS" "NGC" "NEG" -"SBCS" -"ADD" -"SUB " -"CMP"
// loong64:"SUBV","SGTU" // loong64:"SUBV" "SGTU"
// ppc64x:"SUBC", -"SUBE", "SUBZE", "NEG" // ppc64x:"SUBC", -"SUBE", "SUBZE", "NEG"
// s390x:"SUBC" // s390x:"SUBC"
// mips64:"SUBV","SGTU" // mips64:"SUBV" "SGTU"
// riscv64: "SUB","SLTU" // riscv64: "SUB" "SLTU"
return bits.Sub(x, y, 0) return bits.Sub(x, y, 0)
} }
func SubR(x, y, ci uint) uint { func SubR(x, y, ci uint) uint {
// amd64:"NEGL","SBBQ",-"NEGQ" // amd64:"NEGL" "SBBQ" -"NEGQ"
// arm64:"NEGS","SBCS",-"NGC",-"NEG\t",-"ADD",-"SUB",-"CMP" // arm64:"NEGS" "SBCS" -"NGC" -"NEG " -"ADD" -"SUB" -"CMP"
// loong64:"SUBV",-"SGTU" // loong64:"SUBV" -"SGTU"
// ppc64x:"SUBC", "SUBE", -"SUBZE", -"NEG" // ppc64x:"SUBC", "SUBE", -"SUBZE", -"NEG"
// s390x:"SUBE" // s390x:"SUBE"
// riscv64: "SUB",-"SLTU" // riscv64: "SUB" -"SLTU"
r, _ := bits.Sub(x, y, ci) r, _ := bits.Sub(x, y, ci)
return r return r
} }
func SubM(p, q, r *[3]uint) { func SubM(p, q, r *[3]uint) {
var c uint var c uint
r[0], c = bits.Sub(p[0], q[0], c) r[0], c = bits.Sub(p[0], q[0], c)
// amd64:"SBBQ",-"NEGL",-"NEGQ" // amd64:"SBBQ" -"NEGL" -"NEGQ"
// arm64:"SBCS",-"NEGS",-"NGC",-"NEG",-"ADD",-"SUB",-"CMP" // arm64:"SBCS" -"NEGS" -"NGC" -"NEG" -"ADD" -"SUB" -"CMP"
// ppc64x:-"SUBC", "SUBE", -"SUBZE", -"NEG" // ppc64x:-"SUBC", "SUBE", -"SUBZE", -"NEG"
// s390x:"SUBE" // s390x:"SUBE"
r[1], c = bits.Sub(p[1], q[1], c) r[1], c = bits.Sub(p[1], q[1], c)
@ -810,68 +810,68 @@ func SubM(p, q, r *[3]uint) {
} }
func Sub64(x, y, ci uint64) (r, co uint64) { func Sub64(x, y, ci uint64) (r, co uint64) {
// amd64:"NEGL","SBBQ","NEGQ" // amd64:"NEGL" "SBBQ" "NEGQ"
// arm64:"NEGS","SBCS","NGC","NEG",-"ADD",-"SUB",-"CMP" // arm64:"NEGS" "SBCS" "NGC" "NEG" -"ADD" -"SUB" -"CMP"
// loong64:"SUBV","SGTU" // loong64:"SUBV" "SGTU"
// ppc64x:"SUBC", "SUBE", "SUBZE", "NEG" // ppc64x:"SUBC", "SUBE", "SUBZE", "NEG"
// s390x:"SUBE" // s390x:"SUBE"
// mips64:"SUBV","SGTU" // mips64:"SUBV" "SGTU"
// riscv64: "SUB","SLTU" // riscv64: "SUB" "SLTU"
return bits.Sub64(x, y, ci) return bits.Sub64(x, y, ci)
} }
func Sub64C(x, ci uint64) (r, co uint64) { func Sub64C(x, ci uint64) (r, co uint64) {
// amd64:"NEGL","SBBQ","NEGQ" // amd64:"NEGL" "SBBQ" "NEGQ"
// arm64:"NEGS","SBCS","NGC","NEG",-"ADD",-"SUB",-"CMP" // arm64:"NEGS" "SBCS" "NGC" "NEG" -"ADD" -"SUB" -"CMP"
// loong64:"SUBV","SGTU" // loong64:"SUBV" "SGTU"
// ppc64x:"SUBC", "SUBE", "SUBZE", "NEG" // ppc64x:"SUBC", "SUBE", "SUBZE", "NEG"
// s390x:"SUBE" // s390x:"SUBE"
// mips64:"SUBV","SGTU" // mips64:"SUBV" "SGTU"
// riscv64: "SUB","SLTU" // riscv64: "SUB" "SLTU"
return bits.Sub64(x, 7, ci) return bits.Sub64(x, 7, ci)
} }
func Sub64Z(x, y uint64) (r, co uint64) { func Sub64Z(x, y uint64) (r, co uint64) {
// amd64:"SUBQ","SBBQ","NEGQ",-"NEGL" // amd64:"SUBQ" "SBBQ" "NEGQ" -"NEGL"
// arm64:"SUBS","NGC","NEG",-"SBCS",-"ADD",-"SUB\t",-"CMP" // arm64:"SUBS" "NGC" "NEG" -"SBCS" -"ADD" -"SUB " -"CMP"
// loong64:"SUBV","SGTU" // loong64:"SUBV" "SGTU"
// ppc64x:"SUBC", -"SUBE", "SUBZE", "NEG" // ppc64x:"SUBC", -"SUBE", "SUBZE", "NEG"
// s390x:"SUBC" // s390x:"SUBC"
// mips64:"SUBV","SGTU" // mips64:"SUBV" "SGTU"
// riscv64: "SUB","SLTU" // riscv64: "SUB" "SLTU"
return bits.Sub64(x, y, 0) return bits.Sub64(x, y, 0)
} }
func Sub64R(x, y, ci uint64) uint64 { func Sub64R(x, y, ci uint64) uint64 {
// amd64:"NEGL","SBBQ",-"NEGQ" // amd64:"NEGL" "SBBQ" -"NEGQ"
// arm64:"NEGS","SBCS",-"NGC",-"NEG\t",-"ADD",-"SUB",-"CMP" // arm64:"NEGS" "SBCS" -"NGC" -"NEG " -"ADD" -"SUB" -"CMP"
// loong64:"SUBV",-"SGTU" // loong64:"SUBV" -"SGTU"
// ppc64x:"SUBC", "SUBE", -"SUBZE", -"NEG" // ppc64x:"SUBC", "SUBE", -"SUBZE", -"NEG"
// s390x:"SUBE" // s390x:"SUBE"
// riscv64: "SUB",-"SLTU" // riscv64: "SUB" -"SLTU"
r, _ := bits.Sub64(x, y, ci) r, _ := bits.Sub64(x, y, ci)
return r return r
} }
func Sub64M(p, q, r *[3]uint64) { func Sub64M(p, q, r *[3]uint64) {
var c uint64 var c uint64
r[0], c = bits.Sub64(p[0], q[0], c) r[0], c = bits.Sub64(p[0], q[0], c)
// amd64:"SBBQ",-"NEGL",-"NEGQ" // amd64:"SBBQ" -"NEGL" -"NEGQ"
// arm64:"SBCS",-"NEGS",-"NGC",-"NEG",-"ADD",-"SUB",-"CMP" // arm64:"SBCS" -"NEGS" -"NGC" -"NEG" -"ADD" -"SUB" -"CMP"
// s390x:"SUBE" // s390x:"SUBE"
r[1], c = bits.Sub64(p[1], q[1], c) r[1], c = bits.Sub64(p[1], q[1], c)
r[2], c = bits.Sub64(p[2], q[2], c) r[2], c = bits.Sub64(p[2], q[2], c)
} }
func Sub64MSaveC(p, q, r, c *[2]uint64) { func Sub64MSaveC(p, q, r, c *[2]uint64) {
// ppc64x:"SUBC\tR\\d+, R\\d+,", "SUBZE", "NEG" // ppc64x:"SUBC R\\d+, R\\d+,", "SUBZE", "NEG"
r[0], c[0] = bits.Sub64(p[0], q[0], 0) r[0], c[0] = bits.Sub64(p[0], q[0], 0)
// ppc64x:"SUBC\tR\\d+, [$]0,", "SUBE", "SUBZE", "NEG" // ppc64x:"SUBC R\\d+, [$]0,", "SUBE", "SUBZE", "NEG"
r[1], c[1] = bits.Sub64(p[1], q[1], c[0]) r[1], c[1] = bits.Sub64(p[1], q[1], c[0])
} }
func Sub64PanicOnOverflowEQ(a, b uint64) uint64 { func Sub64PanicOnOverflowEQ(a, b uint64) uint64 {
r, b := bits.Sub64(a, b, 0) r, b := bits.Sub64(a, b, 0)
// s390x:"BRC\t[$]12,",-"ADDE",-"SUBE" // s390x:"BRC [$]12," -"ADDE" -"SUBE"
if b == 1 { if b == 1 {
panic("overflow") panic("overflow")
} }
@ -880,7 +880,7 @@ func Sub64PanicOnOverflowEQ(a, b uint64) uint64 {
func Sub64PanicOnOverflowNE(a, b uint64) uint64 { func Sub64PanicOnOverflowNE(a, b uint64) uint64 {
r, b := bits.Sub64(a, b, 0) r, b := bits.Sub64(a, b, 0)
// s390x:"BRC\t[$]12,",-"ADDE",-"SUBE" // s390x:"BRC [$]12," -"ADDE" -"SUBE"
if b != 0 { if b != 0 {
panic("overflow") panic("overflow")
} }
@ -889,7 +889,7 @@ func Sub64PanicOnOverflowNE(a, b uint64) uint64 {
func Sub64PanicOnOverflowGT(a, b uint64) uint64 { func Sub64PanicOnOverflowGT(a, b uint64) uint64 {
r, b := bits.Sub64(a, b, 0) r, b := bits.Sub64(a, b, 0)
// s390x:"BRC\t[$]12,",-"ADDE",-"SUBE" // s390x:"BRC [$]12," -"ADDE" -"SUBE"
if b > 0 { if b > 0 {
panic("overflow") panic("overflow")
} }
@ -901,7 +901,7 @@ func Sub64MPanicOnOverflowEQ(a, b [2]uint64) [2]uint64 {
var c uint64 var c uint64
r[0], c = bits.Sub64(a[0], b[0], c) r[0], c = bits.Sub64(a[0], b[0], c)
r[1], c = bits.Sub64(a[1], b[1], c) r[1], c = bits.Sub64(a[1], b[1], c)
// s390x:"BRC\t[$]12," // s390x:"BRC [$]12,"
if c == 1 { if c == 1 {
panic("overflow") panic("overflow")
} }
@ -913,7 +913,7 @@ func Sub64MPanicOnOverflowNE(a, b [2]uint64) [2]uint64 {
var c uint64 var c uint64
r[0], c = bits.Sub64(a[0], b[0], c) r[0], c = bits.Sub64(a[0], b[0], c)
r[1], c = bits.Sub64(a[1], b[1], c) r[1], c = bits.Sub64(a[1], b[1], c)
// s390x:"BRC\t[$]12," // s390x:"BRC [$]12,"
if c != 0 { if c != 0 {
panic("overflow") panic("overflow")
} }
@ -925,7 +925,7 @@ func Sub64MPanicOnOverflowGT(a, b [2]uint64) [2]uint64 {
var c uint64 var c uint64
r[0], c = bits.Sub64(a[0], b[0], c) r[0], c = bits.Sub64(a[0], b[0], c)
r[1], c = bits.Sub64(a[1], b[1], c) r[1], c = bits.Sub64(a[1], b[1], c)
// s390x:"BRC\t[$]12," // s390x:"BRC [$]12,"
if c > 0 { if c > 0 {
panic("overflow") panic("overflow")
} }
@ -938,51 +938,51 @@ func Sub64MPanicOnOverflowGT(a, b [2]uint64) [2]uint64 {
func Mul(x, y uint) (hi, lo uint) { func Mul(x, y uint) (hi, lo uint) {
// amd64:"MULQ" // amd64:"MULQ"
// arm64:"UMULH","MUL" // arm64:"UMULH" "MUL"
// loong64:"MULV","MULHVU" // loong64:"MULV" "MULHVU"
// ppc64x:"MULHDU","MULLD" // ppc64x:"MULHDU" "MULLD"
// s390x:"MLGR" // s390x:"MLGR"
// mips64: "MULVU" // mips64: "MULVU"
// riscv64:"MULHU","MUL" // riscv64:"MULHU" "MUL"
return bits.Mul(x, y) return bits.Mul(x, y)
} }
func Mul64(x, y uint64) (hi, lo uint64) { func Mul64(x, y uint64) (hi, lo uint64) {
// amd64:"MULQ" // amd64:"MULQ"
// arm64:"UMULH","MUL" // arm64:"UMULH" "MUL"
// loong64:"MULV","MULHVU" // loong64:"MULV" "MULHVU"
// ppc64x:"MULHDU","MULLD" // ppc64x:"MULHDU" "MULLD"
// s390x:"MLGR" // s390x:"MLGR"
// mips64: "MULVU" // mips64: "MULVU"
// riscv64:"MULHU","MUL" // riscv64:"MULHU" "MUL"
return bits.Mul64(x, y) return bits.Mul64(x, y)
} }
func Mul64HiOnly(x, y uint64) uint64 { func Mul64HiOnly(x, y uint64) uint64 {
// arm64:"UMULH",-"MUL" // arm64:"UMULH" -"MUL"
// loong64:"MULHVU",-"MULV" // loong64:"MULHVU" -"MULV"
// riscv64:"MULHU",-"MUL\t" // riscv64:"MULHU" -"MUL "
hi, _ := bits.Mul64(x, y) hi, _ := bits.Mul64(x, y)
return hi return hi
} }
func Mul64LoOnly(x, y uint64) uint64 { func Mul64LoOnly(x, y uint64) uint64 {
// arm64:"MUL",-"UMULH" // arm64:"MUL" -"UMULH"
// loong64:"MULV",-"MULHVU" // loong64:"MULV" -"MULHVU"
// riscv64:"MUL\t",-"MULHU" // riscv64:"MUL " -"MULHU"
_, lo := bits.Mul64(x, y) _, lo := bits.Mul64(x, y)
return lo return lo
} }
func Mul64Const() (uint64, uint64) { func Mul64Const() (uint64, uint64) {
// 7133701809754865664 == 99<<56 // 7133701809754865664 == 99<<56
// arm64:"MOVD\t[$]7133701809754865664, R1", "MOVD\t[$]88, R0" // arm64:"MOVD [$]7133701809754865664, R1", "MOVD [$]88, R0"
// loong64:"MOVV\t[$]88, R4","MOVV\t[$]7133701809754865664, R5",-"MUL" // loong64:"MOVV [$]88, R4" "MOVV [$]7133701809754865664, R5" -"MUL"
return bits.Mul64(99+88<<8, 1<<56) return bits.Mul64(99+88<<8, 1<<56)
} }
func MulUintOverflow(p *uint64) []uint64 { func MulUintOverflow(p *uint64) []uint64 {
// arm64:"CMP\t[$]72" // arm64:"CMP [$]72"
return unsafe.Slice(p, 9) return unsafe.Slice(p, 9)
} }
@ -996,7 +996,7 @@ func Div(hi, lo, x uint) (q, r uint) {
} }
func Div32(hi, lo, x uint32) (q, r uint32) { func Div32(hi, lo, x uint32) (q, r uint32) {
// arm64:"ORR","UDIV","MSUB",-"UREM" // arm64:"ORR" "UDIV" "MSUB" -"UREM"
return bits.Div32(hi, lo, x) return bits.Div32(hi, lo, x)
} }

View file

@ -16,7 +16,7 @@ import (
// ------------- // // ------------- //
func load_le64(b []byte) uint64 { func load_le64(b []byte) uint64 {
// amd64:`MOVQ\s\(.*\),`,-`MOV[BWL]\t[^$]`,-`OR` // amd64:`MOVQ\s\(.*\),`,-`MOV[BWL] [^$]`,-`OR`
// s390x:`MOVDBR\s\(.*\),` // s390x:`MOVDBR\s\(.*\),`
// arm64:`MOVD\s\(R[0-9]+\),`,-`MOV[BHW]` // arm64:`MOVD\s\(R[0-9]+\),`,-`MOV[BHW]`
// loong64:`MOVV\s\(R[0-9]+\),` // loong64:`MOVV\s\(R[0-9]+\),`
@ -26,7 +26,7 @@ func load_le64(b []byte) uint64 {
} }
func load_le64_idx(b []byte, idx int) uint64 { func load_le64_idx(b []byte, idx int) uint64 {
// amd64:`MOVQ\s\(.*\)\(.*\*1\),`,-`MOV[BWL]\t[^$]`,-`OR` // amd64:`MOVQ\s\(.*\)\(.*\*1\),`,-`MOV[BWL] [^$]`,-`OR`
// s390x:`MOVDBR\s\(.*\)\(.*\*1\),` // s390x:`MOVDBR\s\(.*\)\(.*\*1\),`
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[BHW]` // arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[BHW]`
// loong64:`MOVV\s\(R[0-9]+\)\(R[0-9]+\),` // loong64:`MOVV\s\(R[0-9]+\)\(R[0-9]+\),`
@ -78,7 +78,7 @@ func load_le16_idx(b []byte, idx int) uint16 {
} }
func load_be64(b []byte) uint64 { func load_be64(b []byte) uint64 {
// amd64/v1,amd64/v2:`BSWAPQ`,-`MOV[BWL]\t[^$]`,-`OR` // amd64/v1,amd64/v2:`BSWAPQ`,-`MOV[BWL] [^$]`,-`OR`
// amd64/v3:`MOVBEQ` // amd64/v3:`MOVBEQ`
// s390x:`MOVD\s\(.*\),` // s390x:`MOVD\s\(.*\),`
// arm64:`REV`,`MOVD\s\(R[0-9]+\),`,-`MOV[BHW]`,-`REVW`,-`REV16W` // arm64:`REV`,`MOVD\s\(R[0-9]+\),`,-`MOV[BHW]`,-`REVW`,-`REV16W`
@ -88,8 +88,8 @@ func load_be64(b []byte) uint64 {
} }
func load_be64_idx(b []byte, idx int) uint64 { func load_be64_idx(b []byte, idx int) uint64 {
// amd64/v1,amd64/v2:`BSWAPQ`,-`MOV[BWL]\t[^$]`,-`OR` // amd64/v1,amd64/v2:`BSWAPQ`,-`MOV[BWL] [^$]`,-`OR`
// amd64/v3: `MOVBEQ\t\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*` // amd64/v3: `MOVBEQ \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*`
// s390x:`MOVD\s\(.*\)\(.*\*1\),` // s390x:`MOVD\s\(.*\)\(.*\*1\),`
// arm64:`REV`,`MOVD\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[WHB]`,-`REVW`,-`REV16W` // arm64:`REV`,`MOVD\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[WHB]`,-`REVW`,-`REV16W`
// ppc64le:`MOVDBR`,-`MOV[BHW]Z` // ppc64le:`MOVDBR`,-`MOV[BHW]Z`
@ -109,7 +109,7 @@ func load_be32(b []byte) uint32 {
func load_be32_idx(b []byte, idx int) uint32 { func load_be32_idx(b []byte, idx int) uint32 {
// amd64/v1,amd64/v2:`BSWAPL`,-`MOV[BW]`,-`OR` // amd64/v1,amd64/v2:`BSWAPL`,-`MOV[BW]`,-`OR`
// amd64/v3: `MOVBEL\t\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*` // amd64/v3: `MOVBEL \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*`
// s390x:`MOVWZ\s\(.*\)\(.*\*1\),` // s390x:`MOVWZ\s\(.*\)\(.*\*1\),`
// arm64:`REVW`,`MOVWU\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[HB]`,-`REV16W` // arm64:`REVW`,`MOVWU\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[HB]`,-`REV16W`
// ppc64le:`MOVWBR`,-`MOV[BH]Z` // ppc64le:`MOVWBR`,-`MOV[BH]Z`
@ -136,79 +136,79 @@ func load_be16_idx(b []byte, idx int) uint16 {
} }
func load_le_byte2_uint16(s []byte) uint16 { func load_le_byte2_uint16(s []byte) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,-`ORR`,-`MOVB` // arm64:`MOVHU \(R[0-9]+\)`,-`ORR`,-`MOVB`
// 386:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR` // 386:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR`
// amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR` // amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR`
// ppc64le:`MOVHZ\t\(R[0-9]+\)`,-`MOVBZ` // ppc64le:`MOVHZ \(R[0-9]+\)`,-`MOVBZ`
// ppc64:`MOVHBR`,-`MOVBZ` // ppc64:`MOVHBR`,-`MOVBZ`
return uint16(s[0]) | uint16(s[1])<<8 return uint16(s[0]) | uint16(s[1])<<8
} }
func load_le_byte2_uint16_inv(s []byte) uint16 { func load_le_byte2_uint16_inv(s []byte) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,-`ORR`,-`MOVB` // arm64:`MOVHU \(R[0-9]+\)`,-`ORR`,-`MOVB`
// 386:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR` // 386:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR`
// amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR` // amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR`
// ppc64le:`MOVHZ\t\(R[0-9]+\)`,-`MOVBZ` // ppc64le:`MOVHZ \(R[0-9]+\)`,-`MOVBZ`
// ppc64:`MOVHBR`,-`MOVBZ` // ppc64:`MOVHBR`,-`MOVBZ`
return uint16(s[1])<<8 | uint16(s[0]) return uint16(s[1])<<8 | uint16(s[0])
} }
func load_le_byte4_uint32(s []byte) uint32 { func load_le_byte4_uint32(s []byte) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,-`ORR`,-`MOV[BH]` // arm64:`MOVWU \(R[0-9]+\)`,-`ORR`,-`MOV[BH]`
// 386:`MOVL\s\([A-Z]+\)`,-`MOV[BW]`,-`OR` // 386:`MOVL\s\([A-Z]+\)`,-`MOV[BW]`,-`OR`
// amd64:`MOVL\s\([A-Z]+\)`,-`MOV[BW]`,-`OR` // amd64:`MOVL\s\([A-Z]+\)`,-`MOV[BW]`,-`OR`
// ppc64le:`MOVWZ\t\(R[0-9]+\)`,-`MOV[BH]Z` // ppc64le:`MOVWZ \(R[0-9]+\)`,-`MOV[BH]Z`
// ppc64:`MOVWBR`,-MOV[BH]Z` // ppc64:`MOVWBR`,-MOV[BH]Z`
return uint32(s[0]) | uint32(s[1])<<8 | uint32(s[2])<<16 | uint32(s[3])<<24 return uint32(s[0]) | uint32(s[1])<<8 | uint32(s[2])<<16 | uint32(s[3])<<24
} }
func load_le_byte4_uint32_inv(s []byte) uint32 { func load_le_byte4_uint32_inv(s []byte) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,-`ORR`,-`MOV[BH]` // arm64:`MOVWU \(R[0-9]+\)`,-`ORR`,-`MOV[BH]`
// ppc64le:`MOVWZ`,-`MOV[BH]Z` // ppc64le:`MOVWZ`,-`MOV[BH]Z`
// ppc64:`MOVWBR`,-`MOV[BH]Z` // ppc64:`MOVWBR`,-`MOV[BH]Z`
return uint32(s[3])<<24 | uint32(s[2])<<16 | uint32(s[1])<<8 | uint32(s[0]) return uint32(s[3])<<24 | uint32(s[2])<<16 | uint32(s[1])<<8 | uint32(s[0])
} }
func load_le_byte8_uint64(s []byte) uint64 { func load_le_byte8_uint64(s []byte) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]` // arm64:`MOVD \(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
// amd64:`MOVQ\s\([A-Z]+\),\s[A-Z]+`,-`MOV[BWL]\t[^$]`,-`OR` // amd64:`MOVQ\s\([A-Z]+\),\s[A-Z]+`,-`MOV[BWL] [^$]`,-`OR`
// ppc64le:`MOVD\t\(R[0-9]+\)`,-`MOV[BHW]Z` // ppc64le:`MOVD \(R[0-9]+\)`,-`MOV[BHW]Z`
// ppc64:`MOVDBR`,-`MOVW[WHB]Z` // ppc64:`MOVDBR`,-`MOVW[WHB]Z`
return uint64(s[0]) | uint64(s[1])<<8 | uint64(s[2])<<16 | uint64(s[3])<<24 | uint64(s[4])<<32 | uint64(s[5])<<40 | uint64(s[6])<<48 | uint64(s[7])<<56 return uint64(s[0]) | uint64(s[1])<<8 | uint64(s[2])<<16 | uint64(s[3])<<24 | uint64(s[4])<<32 | uint64(s[5])<<40 | uint64(s[6])<<48 | uint64(s[7])<<56
} }
func load_le_byte8_uint64_inv(s []byte) uint64 { func load_le_byte8_uint64_inv(s []byte) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]` // arm64:`MOVD \(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
// ppc64le:`MOVD`,-`MOV[WHB]Z` // ppc64le:`MOVD`,-`MOV[WHB]Z`
// ppc64:`MOVDBR`,-`MOV[WHB]Z` // ppc64:`MOVDBR`,-`MOV[WHB]Z`
return uint64(s[7])<<56 | uint64(s[6])<<48 | uint64(s[5])<<40 | uint64(s[4])<<32 | uint64(s[3])<<24 | uint64(s[2])<<16 | uint64(s[1])<<8 | uint64(s[0]) return uint64(s[7])<<56 | uint64(s[6])<<48 | uint64(s[5])<<40 | uint64(s[4])<<32 | uint64(s[3])<<24 | uint64(s[2])<<16 | uint64(s[1])<<8 | uint64(s[0])
} }
func load_be_byte2_uint16(s []byte) uint16 { func load_be_byte2_uint16(s []byte) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB` // arm64:`MOVHU \(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
// amd64:`MOVWLZX\s\([A-Z]+\)`,`ROLW`,-`MOVB`,-`OR` // amd64:`MOVWLZX\s\([A-Z]+\)`,`ROLW`,-`MOVB`,-`OR`
// ppc64le:`MOVHBR\t\(R[0-9]+\)`,-`MOVBZ` // ppc64le:`MOVHBR \(R[0-9]+\)`,-`MOVBZ`
// ppc64:`MOVHZ`,-`MOVBZ` // ppc64:`MOVHZ`,-`MOVBZ`
return uint16(s[0])<<8 | uint16(s[1]) return uint16(s[0])<<8 | uint16(s[1])
} }
func load_be_byte2_uint16_inv(s []byte) uint16 { func load_be_byte2_uint16_inv(s []byte) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB` // arm64:`MOVHU \(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
// amd64:`MOVWLZX\s\([A-Z]+\)`,`ROLW`,-`MOVB`,-`OR` // amd64:`MOVWLZX\s\([A-Z]+\)`,`ROLW`,-`MOVB`,-`OR`
// ppc64le:`MOVHBR\t\(R[0-9]+\)`,-`MOVBZ` // ppc64le:`MOVHBR \(R[0-9]+\)`,-`MOVBZ`
// ppc64:`MOVHZ`,-`MOVBZ` // ppc64:`MOVHZ`,-`MOVBZ`
return uint16(s[1]) | uint16(s[0])<<8 return uint16(s[1]) | uint16(s[0])<<8
} }
func load_be_byte4_uint32(s []byte) uint32 { func load_be_byte4_uint32(s []byte) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,`REVW`,-`ORR`,-`REV16W`,-`MOV[BH]` // arm64:`MOVWU \(R[0-9]+\)`,`REVW`,-`ORR`,-`REV16W`,-`MOV[BH]`
// ppc64le:`MOVWBR`,-`MOV[HB]Z` // ppc64le:`MOVWBR`,-`MOV[HB]Z`
// ppc64:`MOVWZ`,-`MOV[HB]Z` // ppc64:`MOVWZ`,-`MOV[HB]Z`
return uint32(s[0])<<24 | uint32(s[1])<<16 | uint32(s[2])<<8 | uint32(s[3]) return uint32(s[0])<<24 | uint32(s[1])<<16 | uint32(s[2])<<8 | uint32(s[3])
} }
func load_be_byte4_uint32_inv(s []byte) uint32 { func load_be_byte4_uint32_inv(s []byte) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,`REVW`,-`ORR`,-`REV16W`,-`MOV[BH]` // arm64:`MOVWU \(R[0-9]+\)`,`REVW`,-`ORR`,-`REV16W`,-`MOV[BH]`
// amd64/v1,amd64/v2:`MOVL\s\([A-Z]+\)`,`BSWAPL`,-`MOV[BW]`,-`OR` // amd64/v1,amd64/v2:`MOVL\s\([A-Z]+\)`,`BSWAPL`,-`MOV[BW]`,-`OR`
// amd64/v3: `MOVBEL` // amd64/v3: `MOVBEL`
// ppc64le:`MOVWBR`,-`MOV[HB]Z` // ppc64le:`MOVWBR`,-`MOV[HB]Z`
@ -217,17 +217,17 @@ func load_be_byte4_uint32_inv(s []byte) uint32 {
} }
func load_be_byte8_uint64(s []byte) uint64 { func load_be_byte8_uint64(s []byte) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,`REV`,-`ORR`,-`REVW`,-`REV16W`,-`MOV[BHW]` // arm64:`MOVD \(R[0-9]+\)`,`REV`,-`ORR`,-`REVW`,-`REV16W`,-`MOV[BHW]`
// ppc64le:`MOVDBR\t\(R[0-9]+\)`,-`MOV[BHW]Z` // ppc64le:`MOVDBR \(R[0-9]+\)`,-`MOV[BHW]Z`
// ppc64:`MOVD`,-`MOV[WHB]Z` // ppc64:`MOVD`,-`MOV[WHB]Z`
return uint64(s[0])<<56 | uint64(s[1])<<48 | uint64(s[2])<<40 | uint64(s[3])<<32 | uint64(s[4])<<24 | uint64(s[5])<<16 | uint64(s[6])<<8 | uint64(s[7]) return uint64(s[0])<<56 | uint64(s[1])<<48 | uint64(s[2])<<40 | uint64(s[3])<<32 | uint64(s[4])<<24 | uint64(s[5])<<16 | uint64(s[6])<<8 | uint64(s[7])
} }
func load_be_byte8_uint64_inv(s []byte) uint64 { func load_be_byte8_uint64_inv(s []byte) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,`REV`,-`ORR`,-`REVW`,-`REV16W`,-`MOV[BHW]` // arm64:`MOVD \(R[0-9]+\)`,`REV`,-`ORR`,-`REVW`,-`REV16W`,-`MOV[BHW]`
// amd64/v1,amd64/v2:`MOVQ\s\([A-Z]+\),\s[A-Z]+`,`BSWAPQ`,-`MOV[BWL]\t[^$]`,-`OR` // amd64/v1,amd64/v2:`MOVQ\s\([A-Z]+\),\s[A-Z]+`,`BSWAPQ`,-`MOV[BWL] [^$]`,-`OR`
// amd64/v3: `MOVBEQ` // amd64/v3: `MOVBEQ`
// ppc64le:`MOVDBR\t\(R[0-9]+\)`,-`MOV[BHW]Z` // ppc64le:`MOVDBR \(R[0-9]+\)`,-`MOV[BHW]Z`
// ppc64:`MOVD`,-`MOV[BHW]Z` // ppc64:`MOVD`,-`MOV[BHW]Z`
return uint64(s[7]) | uint64(s[6])<<8 | uint64(s[5])<<16 | uint64(s[4])<<24 | uint64(s[3])<<32 | uint64(s[2])<<40 | uint64(s[1])<<48 | uint64(s[0])<<56 return uint64(s[7]) | uint64(s[6])<<8 | uint64(s[5])<<16 | uint64(s[4])<<24 | uint64(s[3])<<32 | uint64(s[2])<<40 | uint64(s[1])<<48 | uint64(s[0])<<56
} }
@ -386,20 +386,20 @@ func fcall_uint32(a [2]uint32) [2]uint32 {
// We want to merge load+op in the first function, but not in the // We want to merge load+op in the first function, but not in the
// second. See Issue 19595. // second. See Issue 19595.
func load_op_merge(p, q *int) { func load_op_merge(p, q *int) {
x := *p // amd64:`ADDQ\t\(` x := *p // amd64:`ADDQ \(`
*q += x // The combined nilcheck and load would normally have this line number, but we want that combined operation to have the line number of the nil check instead (see #33724). *q += x // The combined nilcheck and load would normally have this line number, but we want that combined operation to have the line number of the nil check instead (see #33724).
} }
func load_op_no_merge(p, q *int) { func load_op_no_merge(p, q *int) {
x := *p x := *p
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
*q += x // amd64:`ADDQ\t[A-Z]` *q += x // amd64:`ADDQ [A-Z]`
} }
} }
func load_op_in_loop(a []int) int { func load_op_in_loop(a []int) int {
r := 0 r := 0
for _, x := range a { for _, x := range a {
// amd64:`ADDQ\t\([A-Z]+\)\([A-Z]+\*8\), [A-Z]+` // amd64:`ADDQ \([A-Z]+\)\([A-Z]+\*8\), [A-Z]+`
r += x r += x
} }
return r return r
@ -407,7 +407,7 @@ func load_op_in_loop(a []int) int {
// Make sure offsets are folded into loads and stores. // Make sure offsets are folded into loads and stores.
func offsets_fold(_, a [20]byte) (b [20]byte) { func offsets_fold(_, a [20]byte) (b [20]byte) {
// arm64:`MOVD\tcommand-line-arguments\.a\+[0-9]+\(FP\), R[0-9]+`,`MOVD\tR[0-9]+, command-line-arguments\.b\+[0-9]+\(FP\)` // arm64:`MOVD command-line-arguments\.a\+[0-9]+\(FP\), R[0-9]+`,`MOVD R[0-9]+, command-line-arguments\.b\+[0-9]+\(FP\)`
b = a b = a
return return
} }
@ -526,7 +526,7 @@ func store_be64(b []byte, x uint64) {
func store_be64_idx(b []byte, x uint64, idx int) { func store_be64_idx(b []byte, x uint64, idx int) {
// amd64/v1,amd64/v2:`BSWAPQ`,-`SHR.` // amd64/v1,amd64/v2:`BSWAPQ`,-`SHR.`
// amd64/v3:`MOVBEQ\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` // amd64/v3:`MOVBEQ [A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
// arm64:`REV`,`MOVD\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOV[BHW]`,-`REV16W`,-`REVW` // arm64:`REV`,`MOVD\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOV[BHW]`,-`REV16W`,-`REVW`
// ppc64le:`MOVDBR` // ppc64le:`MOVDBR`
// ppc64:`MOVD\s` // ppc64:`MOVD\s`
@ -558,7 +558,7 @@ func store_be32_load(b, x *[8]byte) {
func store_be32_idx(b []byte, x uint32, idx int) { func store_be32_idx(b []byte, x uint32, idx int) {
// amd64/v1,amd64/v2:`BSWAPL`,-`SHR.` // amd64/v1,amd64/v2:`BSWAPL`,-`SHR.`
// amd64/v3:`MOVBEL\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` // amd64/v3:`MOVBEL [A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
// arm64:`REVW`,`MOVW\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOV[BH]`,-`REV16W` // arm64:`REVW`,`MOVW\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOV[BH]`,-`REV16W`
// ppc64le:`MOVWBR` // ppc64le:`MOVWBR`
// ppc64:`MOVW\s` // ppc64:`MOVW\s`
@ -578,7 +578,7 @@ func store_be16(b []byte, x uint16) {
func store_be16_idx(b []byte, x uint16, idx int) { func store_be16_idx(b []byte, x uint16, idx int) {
// amd64/v1,amd64/v2:`ROLW\s\$8`,-`SHR.` // amd64/v1,amd64/v2:`ROLW\s\$8`,-`SHR.`
// amd64/v3:`MOVBEW\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` // amd64/v3:`MOVBEW [A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
// arm64:`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,`REV16W`,-`MOVB` // arm64:`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,`REV16W`,-`MOVB`
// ppc64le:`MOVHBR` // ppc64le:`MOVHBR`
// ppc64:`MOVH\s` // ppc64:`MOVH\s`
@ -736,12 +736,12 @@ func store_le_byte_4_idx4_inv(b []byte, idx int, val uint32) {
func zero_byte_2(b1, b2 []byte) { func zero_byte_2(b1, b2 []byte) {
// bounds checks to guarantee safety of writes below // bounds checks to guarantee safety of writes below
_, _ = b1[1], b2[1] _, _ = b1[1], b2[1]
// arm64:"MOVH\tZR",-"MOVB" // arm64:"MOVH ZR" -"MOVB"
// amd64:`MOVW\s[$]0,\s\([A-Z]+\)` // amd64:`MOVW\s[$]0,\s\([A-Z]+\)`
// 386:`MOVW\s[$]0,\s\([A-Z]+\)` // 386:`MOVW\s[$]0,\s\([A-Z]+\)`
// ppc64x:`MOVH\s` // ppc64x:`MOVH\s`
b1[0], b1[1] = 0, 0 b1[0], b1[1] = 0, 0
// arm64:"MOVH\tZR",-"MOVB" // arm64:"MOVH ZR" -"MOVB"
// 386:`MOVW\s[$]0,\s\([A-Z]+\)` // 386:`MOVW\s[$]0,\s\([A-Z]+\)`
// amd64:`MOVW\s[$]0,\s\([A-Z]+\)` // amd64:`MOVW\s[$]0,\s\([A-Z]+\)`
// ppc64x:`MOVH` // ppc64x:`MOVH`
@ -750,36 +750,36 @@ func zero_byte_2(b1, b2 []byte) {
func zero_byte_4(b1, b2 []byte) { func zero_byte_4(b1, b2 []byte) {
_, _ = b1[3], b2[3] _, _ = b1[3], b2[3]
// arm64:"MOVW\tZR",-"MOVB",-"MOVH" // arm64:"MOVW ZR" -"MOVB" -"MOVH"
// amd64:`MOVL\s[$]0,\s\([A-Z]+\)` // amd64:`MOVL\s[$]0,\s\([A-Z]+\)`
// 386:`MOVL\s[$]0,\s\([A-Z]+\)` // 386:`MOVL\s[$]0,\s\([A-Z]+\)`
// ppc64x:`MOVW\s` // ppc64x:`MOVW\s`
b1[0], b1[1], b1[2], b1[3] = 0, 0, 0, 0 b1[0], b1[1], b1[2], b1[3] = 0, 0, 0, 0
// arm64:"MOVW\tZR",-"MOVB",-"MOVH" // arm64:"MOVW ZR" -"MOVB" -"MOVH"
// ppc64x:`MOVW\s` // ppc64x:`MOVW\s`
b2[2], b2[3], b2[1], b2[0] = 0, 0, 0, 0 b2[2], b2[3], b2[1], b2[0] = 0, 0, 0, 0
} }
func zero_byte_8(b []byte) { func zero_byte_8(b []byte) {
_ = b[7] _ = b[7]
b[0], b[1], b[2], b[3] = 0, 0, 0, 0 // arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW" b[0], b[1], b[2], b[3] = 0, 0, 0, 0 // arm64:"MOVD ZR" -"MOVB" -"MOVH" -"MOVW"
b[4], b[5], b[6], b[7] = 0, 0, 0, 0 b[4], b[5], b[6], b[7] = 0, 0, 0, 0
} }
func zero_byte_16(b []byte) { func zero_byte_16(b []byte) {
_ = b[15] _ = b[15]
b[0], b[1], b[2], b[3] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH",-"MOVW" b[0], b[1], b[2], b[3] = 0, 0, 0, 0 // arm64:"STP" -"MOVB" -"MOVH" -"MOVW"
b[4], b[5], b[6], b[7] = 0, 0, 0, 0 b[4], b[5], b[6], b[7] = 0, 0, 0, 0
b[8], b[9], b[10], b[11] = 0, 0, 0, 0 b[8], b[9], b[10], b[11] = 0, 0, 0, 0
b[12], b[13], b[14], b[15] = 0, 0, 0, 0 b[12], b[13], b[14], b[15] = 0, 0, 0, 0
} }
func zero_byte_30(a *[30]byte) { func zero_byte_30(a *[30]byte) {
*a = [30]byte{} // arm64:"STP",-"MOVB",-"MOVH",-"MOVW" *a = [30]byte{} // arm64:"STP" -"MOVB" -"MOVH" -"MOVW"
} }
func zero_byte_39(a *[39]byte) { func zero_byte_39(a *[39]byte) {
*a = [39]byte{} // arm64:"MOVD",-"MOVB",-"MOVH",-"MOVW" *a = [39]byte{} // arm64:"MOVD" -"MOVB" -"MOVH" -"MOVW"
} }
func zero_byte_2_idx(b []byte, idx int) { func zero_byte_2_idx(b []byte, idx int) {
@ -798,12 +798,12 @@ func zero_byte_2_idx2(b []byte, idx int) {
func zero_uint16_2(h1, h2 []uint16) { func zero_uint16_2(h1, h2 []uint16) {
_, _ = h1[1], h2[1] _, _ = h1[1], h2[1]
// arm64:"MOVW\tZR",-"MOVB",-"MOVH" // arm64:"MOVW ZR" -"MOVB" -"MOVH"
// amd64:`MOVL\s[$]0,\s\([A-Z]+\)` // amd64:`MOVL\s[$]0,\s\([A-Z]+\)`
// 386:`MOVL\s[$]0,\s\([A-Z]+\)` // 386:`MOVL\s[$]0,\s\([A-Z]+\)`
// ppc64x:`MOVW\s` // ppc64x:`MOVW\s`
h1[0], h1[1] = 0, 0 h1[0], h1[1] = 0, 0
// arm64:"MOVW\tZR",-"MOVB",-"MOVH" // arm64:"MOVW ZR" -"MOVB" -"MOVH"
// amd64:`MOVL\s[$]0,\s\([A-Z]+\)` // amd64:`MOVL\s[$]0,\s\([A-Z]+\)`
// 386:`MOVL\s[$]0,\s\([A-Z]+\)` // 386:`MOVL\s[$]0,\s\([A-Z]+\)`
// ppc64x:`MOVW` // ppc64x:`MOVW`
@ -812,28 +812,28 @@ func zero_uint16_2(h1, h2 []uint16) {
func zero_uint16_4(h1, h2 []uint16) { func zero_uint16_4(h1, h2 []uint16) {
_, _ = h1[3], h2[3] _, _ = h1[3], h2[3]
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW" // arm64:"MOVD ZR" -"MOVB" -"MOVH" -"MOVW"
// amd64:`MOVQ\s[$]0,\s\([A-Z]+\)` // amd64:`MOVQ\s[$]0,\s\([A-Z]+\)`
// ppc64x:`MOVD\s` // ppc64x:`MOVD\s`
h1[0], h1[1], h1[2], h1[3] = 0, 0, 0, 0 h1[0], h1[1], h1[2], h1[3] = 0, 0, 0, 0
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW" // arm64:"MOVD ZR" -"MOVB" -"MOVH" -"MOVW"
// ppc64x:`MOVD\s` // ppc64x:`MOVD\s`
h2[2], h2[3], h2[1], h2[0] = 0, 0, 0, 0 h2[2], h2[3], h2[1], h2[0] = 0, 0, 0, 0
} }
func zero_uint16_8(h []uint16) { func zero_uint16_8(h []uint16) {
_ = h[7] _ = h[7]
h[0], h[1], h[2], h[3] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH" h[0], h[1], h[2], h[3] = 0, 0, 0, 0 // arm64:"STP" -"MOVB" -"MOVH"
h[4], h[5], h[6], h[7] = 0, 0, 0, 0 h[4], h[5], h[6], h[7] = 0, 0, 0, 0
} }
func zero_uint32_2(w1, w2 []uint32) { func zero_uint32_2(w1, w2 []uint32) {
_, _ = w1[1], w2[1] _, _ = w1[1], w2[1]
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW" // arm64:"MOVD ZR" -"MOVB" -"MOVH" -"MOVW"
// amd64:`MOVQ\s[$]0,\s\([A-Z]+\)` // amd64:`MOVQ\s[$]0,\s\([A-Z]+\)`
// ppc64x:`MOVD\s` // ppc64x:`MOVD\s`
w1[0], w1[1] = 0, 0 w1[0], w1[1] = 0, 0
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW" // arm64:"MOVD ZR" -"MOVB" -"MOVH" -"MOVW"
// amd64:`MOVQ\s[$]0,\s\([A-Z]+\)` // amd64:`MOVQ\s[$]0,\s\([A-Z]+\)`
// ppc64x:`MOVD\s` // ppc64x:`MOVD\s`
w2[1], w2[0] = 0, 0 w2[1], w2[0] = 0, 0
@ -841,22 +841,22 @@ func zero_uint32_2(w1, w2 []uint32) {
func zero_uint32_4(w1, w2 []uint32) { func zero_uint32_4(w1, w2 []uint32) {
_, _ = w1[3], w2[3] _, _ = w1[3], w2[3]
w1[0], w1[1], w1[2], w1[3] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH" w1[0], w1[1], w1[2], w1[3] = 0, 0, 0, 0 // arm64:"STP" -"MOVB" -"MOVH"
w2[2], w2[3], w2[1], w2[0] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH" w2[2], w2[3], w2[1], w2[0] = 0, 0, 0, 0 // arm64:"STP" -"MOVB" -"MOVH"
} }
func zero_uint64_2(d1, d2 []uint64) { func zero_uint64_2(d1, d2 []uint64) {
_, _ = d1[1], d2[1] _, _ = d1[1], d2[1]
d1[0], d1[1] = 0, 0 // arm64:"STP",-"MOVB",-"MOVH" d1[0], d1[1] = 0, 0 // arm64:"STP" -"MOVB" -"MOVH"
d2[1], d2[0] = 0, 0 // arm64:"STP",-"MOVB",-"MOVH" d2[1], d2[0] = 0, 0 // arm64:"STP" -"MOVB" -"MOVH"
} }
func loadstore(p, q *[4]uint8) { func loadstore(p, q *[4]uint8) {
// amd64:"MOVL",-"MOVB" // amd64:"MOVL" -"MOVB"
// arm64:"MOVWU",-"MOVBU" // arm64:"MOVWU" -"MOVBU"
x0, x1, x2, x3 := q[0], q[1], q[2], q[3] x0, x1, x2, x3 := q[0], q[1], q[2], q[3]
// amd64:"MOVL",-"MOVB" // amd64:"MOVL" -"MOVB"
// arm64:"MOVW",-"MOVB" // arm64:"MOVW" -"MOVB"
p[0], p[1], p[2], p[3] = x0, x1, x2, x3 p[0], p[1], p[2], p[3] = x0, x1, x2, x3
} }
@ -865,11 +865,11 @@ type S1 struct {
} }
func loadstore2(p, q *S1) { func loadstore2(p, q *S1) {
// amd64:"MOVL",-"MOVWLZX" // amd64:"MOVL" -"MOVWLZX"
// arm64:"MOVWU",-"MOVH" // arm64:"MOVWU" -"MOVH"
a, b := p.a, p.b a, b := p.a, p.b
// amd64:"MOVL",-"MOVW" // amd64:"MOVL" -"MOVW"
// arm64:"MOVW",-"MOVH" // arm64:"MOVW" -"MOVH"
q.a, q.b = a, b q.a, q.b = a, b
} }
@ -878,11 +878,11 @@ func wideStore(p *[8]uint64) {
return return
} }
// amd64:"MOVUPS",-"MOVQ" // amd64:"MOVUPS" -"MOVQ"
// arm64:"STP",-"MOVD" // arm64:"STP" -"MOVD"
p[0] = 0 p[0] = 0
// amd64:-"MOVUPS",-"MOVQ" // amd64:-"MOVUPS" -"MOVQ"
// arm64:-"STP",-"MOVD" // arm64:-"STP" -"MOVD"
p[1] = 0 p[1] = 0
} }
@ -893,52 +893,52 @@ func wideStore2(p *[8]uint64, x, y uint64) {
// s390x:"STMG" // s390x:"STMG"
p[0] = x p[0] = x
// s390x:-"STMG",-"MOVD" // s390x:-"STMG" -"MOVD"
p[1] = y p[1] = y
} }
func store32le(p *struct{ a, b uint32 }, x uint64) { func store32le(p *struct{ a, b uint32 }, x uint64) {
// amd64:"MOVQ",-"MOVL",-"SHRQ" // amd64:"MOVQ" -"MOVL" -"SHRQ"
// arm64:"MOVD",-"MOVW",-"LSR" // arm64:"MOVD" -"MOVW" -"LSR"
// ppc64le:"MOVD",-"MOVW",-"SRD" // ppc64le:"MOVD" -"MOVW" -"SRD"
p.a = uint32(x) p.a = uint32(x)
// amd64:-"MOVL",-"SHRQ" // amd64:-"MOVL" -"SHRQ"
// arm64:-"MOVW",-"LSR" // arm64:-"MOVW" -"LSR"
// ppc64le:-"MOVW",-"SRD" // ppc64le:-"MOVW" -"SRD"
p.b = uint32(x >> 32) p.b = uint32(x >> 32)
} }
func store32be(p *struct{ a, b uint32 }, x uint64) { func store32be(p *struct{ a, b uint32 }, x uint64) {
// arm64:"STPW" // arm64:"STPW"
// ppc64:"MOVD",-"MOVW",-"SRD" // ppc64:"MOVD" -"MOVW" -"SRD"
// s390x:"MOVD",-"MOVW",-"SRD" // s390x:"MOVD" -"MOVW" -"SRD"
p.a = uint32(x >> 32) p.a = uint32(x >> 32)
// arm64:-"STPW" // arm64:-"STPW"
// ppc64:-"MOVW",-"SRD" // ppc64:-"MOVW" -"SRD"
// s390x:-"MOVW",-"SRD" // s390x:-"MOVW" -"SRD"
p.b = uint32(x) p.b = uint32(x)
} }
func store16le(p *struct{ a, b uint16 }, x uint32) { func store16le(p *struct{ a, b uint16 }, x uint32) {
// amd64:"MOVL",-"MOVW",-"SHRL" // amd64:"MOVL" -"MOVW" -"SHRL"
// arm64:"MOVW",-"MOVH",-"UBFX" // arm64:"MOVW" -"MOVH" -"UBFX"
// ppc64le:"MOVW",-"MOVH",-"SRW" // ppc64le:"MOVW" -"MOVH" -"SRW"
p.a = uint16(x) p.a = uint16(x)
// amd64:-"MOVW",-"SHRL" // amd64:-"MOVW" -"SHRL"
// arm64:-"MOVH",-"UBFX" // arm64:-"MOVH" -"UBFX"
// ppc64le:-"MOVH",-"SRW" // ppc64le:-"MOVH" -"SRW"
p.b = uint16(x >> 16) p.b = uint16(x >> 16)
} }
func store16be(p *struct{ a, b uint16 }, x uint32) { func store16be(p *struct{ a, b uint16 }, x uint32) {
// ppc64:"MOVW",-"MOVH",-"SRW" // ppc64:"MOVW" -"MOVH" -"SRW"
// s390x:"MOVW",-"MOVH",-"SRW" // s390x:"MOVW" -"MOVH" -"SRW"
p.a = uint16(x >> 16) p.a = uint16(x >> 16)
// ppc64:-"MOVH",-"SRW" // ppc64:-"MOVH" -"SRW"
// s390x:-"MOVH",-"SRW" // s390x:-"MOVH" -"SRW"
p.b = uint16(x) p.b = uint16(x)
} }
func storeBoolConst(p *struct{ a, b bool }) { func storeBoolConst(p *struct{ a, b bool }) {
// amd64:"MOVW",-"MOVB" // amd64:"MOVW" -"MOVB"
// arm64:"MOVH",-"MOVB" // arm64:"MOVH" -"MOVB"
p.a = true p.a = true
p.b = true p.b = true
} }
@ -948,8 +948,8 @@ func issue66413(p *struct {
c bool c bool
d int8 d int8
}) { }) {
// amd64:"MOVL",-"MOVB" // amd64:"MOVL" -"MOVB"
// arm64:"MOVW",-"MOVB" // arm64:"MOVW" -"MOVB"
p.a = 31 p.a = 31
p.b = false p.b = false
p.c = true p.c = true
@ -957,7 +957,7 @@ func issue66413(p *struct {
} }
func issue70300(v uint64) (b [8]byte) { func issue70300(v uint64) (b [8]byte) {
// amd64:"MOVQ",-"MOVB" // amd64:"MOVQ" -"MOVB"
b[0] = byte(v) b[0] = byte(v)
b[1] = byte(v >> 8) b[1] = byte(v >> 8)
b[2] = byte(v >> 16) b[2] = byte(v >> 16)
@ -970,7 +970,7 @@ func issue70300(v uint64) (b [8]byte) {
} }
func issue70300Reverse(v uint64) (b [8]byte) { func issue70300Reverse(v uint64) (b [8]byte) {
// amd64:"MOVQ",-"MOVB" // amd64:"MOVQ" -"MOVB"
b[7] = byte(v >> 56) b[7] = byte(v >> 56)
b[6] = byte(v >> 48) b[6] = byte(v >> 48)
b[5] = byte(v >> 40) b[5] = byte(v >> 40)
@ -987,43 +987,43 @@ func issue70300Reverse(v uint64) (b [8]byte) {
// --------------------------------- // // --------------------------------- //
func dwloadI64(p *struct{ a, b int64 }) int64 { func dwloadI64(p *struct{ a, b int64 }) int64 {
// arm64:"LDP\t" // arm64:"LDP "
return p.a + p.b return p.a + p.b
} }
func dwloadI32(p *struct{ a, b int32 }) int32 { func dwloadI32(p *struct{ a, b int32 }) int32 {
// arm64:"LDPSW\t" // arm64:"LDPSW "
return p.a + p.b return p.a + p.b
} }
func dwloadU32(p *struct{ a, b uint32 }) uint32 { func dwloadU32(p *struct{ a, b uint32 }) uint32 {
// arm64:"LDPW\t" // arm64:"LDPW "
return p.a + p.b return p.a + p.b
} }
func dwloadF64(p *struct{ a, b float64 }) float64 { func dwloadF64(p *struct{ a, b float64 }) float64 {
// arm64:"FLDPD\t" // arm64:"FLDPD "
return p.a + p.b return p.a + p.b
} }
func dwloadF32(p *struct{ a, b float32 }) float32 { func dwloadF32(p *struct{ a, b float32 }) float32 {
// arm64:"FLDPS\t" // arm64:"FLDPS "
return p.a + p.b return p.a + p.b
} }
func dwloadBig(p *struct{ a, b, c, d, e, f int64 }) int64 { func dwloadBig(p *struct{ a, b, c, d, e, f int64 }) int64 {
// arm64:"LDP\t\\(", "LDP\t16", "LDP\t32" // arm64:"LDP \\(", "LDP 16", "LDP 32"
return p.c + p.f + p.a + p.e + p.d + p.b return p.c + p.f + p.a + p.e + p.d + p.b
} }
func dwloadArg(a [2]int64) int64 { func dwloadArg(a [2]int64) int64 {
// arm64:"LDP\t" // arm64:"LDP "
return a[0] + a[1] return a[0] + a[1]
} }
func dwloadResult1(p *string) string { func dwloadResult1(p *string) string {
// arm64:"LDP\t\\(R0\\), \\(R0, R1\\)" // arm64:"LDP \\(R0\\), \\(R0, R1\\)"
return *p return *p
} }
func dwloadResult2(p *[2]int64) (int64, int64) { func dwloadResult2(p *[2]int64) (int64, int64) {
// arm64:"LDP\t\\(R0\\), \\(R1, R0\\)" // arm64:"LDP \\(R0\\), \\(R1, R0\\)"
return p[1], p[0] return p[1], p[0]
} }
@ -1032,22 +1032,22 @@ func dwloadResult2(p *[2]int64) (int64, int64) {
// ---------------------------------- // // ---------------------------------- //
func dwstoreI64(p *struct{ a, b int64 }, x, y int64) { func dwstoreI64(p *struct{ a, b int64 }, x, y int64) {
// arm64:"STP\t" // arm64:"STP "
p.a = x p.a = x
p.b = y p.b = y
} }
func dwstoreI32(p *struct{ a, b int32 }, x, y int32) { func dwstoreI32(p *struct{ a, b int32 }, x, y int32) {
// arm64:"STPW\t" // arm64:"STPW "
p.a = x p.a = x
p.b = y p.b = y
} }
func dwstoreF64(p *struct{ a, b float64 }, x, y float64) { func dwstoreF64(p *struct{ a, b float64 }, x, y float64) {
// arm64:"FSTPD\t" // arm64:"FSTPD "
p.a = x p.a = x
p.b = y p.b = y
} }
func dwstoreF32(p *struct{ a, b float32 }, x, y float32) { func dwstoreF32(p *struct{ a, b float32 }, x, y float32) {
// arm64:"FSTPS\t" // arm64:"FSTPS "
p.a = x p.a = x
p.b = y p.b = y
} }
@ -1065,14 +1065,14 @@ func dwstoreBig(p *struct{ a, b, c, d, e, f int64 }, a, b, c, d, e, f int64) {
} }
func dwstoreRet() [2]int { func dwstoreRet() [2]int {
// arm64:"STP\t" // arm64:"STP "
return [2]int{5, 6} return [2]int{5, 6}
} }
func dwstoreLocal(i int) int64 { func dwstoreLocal(i int) int64 {
var a [2]int64 var a [2]int64
a[0] = 5 a[0] = 5
// arm64:"STP\t" // arm64:"STP "
a[1] = 6 a[1] = 6
return a[i] return a[i]
} }
@ -1081,7 +1081,7 @@ func dwstoreOrder(p *struct {
a, b int64 a, b int64
c, d, e, f bool c, d, e, f bool
}, a, b int64) { }, a, b int64) {
// arm64:"STP\t" // arm64:"STP "
p.a = a p.a = a
p.c = true p.c = true
p.e = true p.e = true

View file

@ -13,23 +13,23 @@ var x32 [2]uint32
var x64 [2]uint64 var x64 [2]uint64
func compMem1() int { func compMem1() int {
// amd64:`CMPB\tcommand-line-arguments.x\+1\(SB\), [$]0` // amd64:`CMPB command-line-arguments.x\+1\(SB\), [$]0`
if x[1] { if x[1] {
return 1 return 1
} }
// amd64:`CMPB\tcommand-line-arguments.x8\+1\(SB\), [$]7` // amd64:`CMPB command-line-arguments.x8\+1\(SB\), [$]7`
if x8[1] == 7 { if x8[1] == 7 {
return 1 return 1
} }
// amd64:`CMPW\tcommand-line-arguments.x16\+2\(SB\), [$]7` // amd64:`CMPW command-line-arguments.x16\+2\(SB\), [$]7`
if x16[1] == 7 { if x16[1] == 7 {
return 1 return 1
} }
// amd64:`CMPL\tcommand-line-arguments.x32\+4\(SB\), [$]7` // amd64:`CMPL command-line-arguments.x32\+4\(SB\), [$]7`
if x32[1] == 7 { if x32[1] == 7 {
return 1 return 1
} }
// amd64:`CMPQ\tcommand-line-arguments.x64\+8\(SB\), [$]7` // amd64:`CMPQ command-line-arguments.x64\+8\(SB\), [$]7`
if x64[1] == 7 { if x64[1] == 7 {
return 1 return 1
} }
@ -46,23 +46,23 @@ type T struct {
} }
func compMem2(t T) int { func compMem2(t T) int {
// amd64:`CMPB\t.*\(SP\), [$]0` // amd64:`CMPB .*\(SP\), [$]0`
if t.x { if t.x {
return 1 return 1
} }
// amd64:`CMPB\t.*\(SP\), [$]7` // amd64:`CMPB .*\(SP\), [$]7`
if t.x8 == 7 { if t.x8 == 7 {
return 1 return 1
} }
// amd64:`CMPW\t.*\(SP\), [$]7` // amd64:`CMPW .*\(SP\), [$]7`
if t.x16 == 7 { if t.x16 == 7 {
return 1 return 1
} }
// amd64:`CMPL\t.*\(SP\), [$]7` // amd64:`CMPL .*\(SP\), [$]7`
if t.x32 == 7 { if t.x32 == 7 {
return 1 return 1
} }
// amd64:`CMPQ\t.*\(SP\), [$]7` // amd64:`CMPQ .*\(SP\), [$]7`
if t.x64 == 7 { if t.x64 == 7 {
return 1 return 1
} }
@ -73,8 +73,8 @@ func compMem3(x, y *int) (int, bool) {
// We can do comparisons of a register with memory even if // We can do comparisons of a register with memory even if
// the register is used subsequently. // the register is used subsequently.
r := *x r := *x
// amd64:`CMPQ\t\(` // amd64:`CMPQ \(`
// 386:`CMPL\t\(` // 386:`CMPL \(`
return r, r < *y return r, r < *y
} }
@ -82,261 +82,261 @@ func compMem3(x, y *int) (int, bool) {
func idxInt8(x, y []int8, i int) { func idxInt8(x, y []int8, i int) {
var t int8 var t int8
// amd64: `MOVBL[SZ]X\t1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*` // amd64: `MOVBL[SZ]X 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*`
// 386: `MOVBL[SZ]X\t1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*` // 386: `MOVBL[SZ]X 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*`
t = x[i+1] t = x[i+1]
// amd64: `MOVB\t[A-Z]+[0-9]*, 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` // amd64: `MOVB [A-Z]+[0-9]*, 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
// 386: `MOVB\t[A-Z]+[0-9]*, 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` // 386: `MOVB [A-Z]+[0-9]*, 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
y[i+1] = t y[i+1] = t
// amd64: `MOVB\t[$]77, 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` // amd64: `MOVB [$]77, 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
// 386: `MOVB\t[$]77, 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` // 386: `MOVB [$]77, 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
x[i+1] = 77 x[i+1] = 77
} }
func idxInt16(x, y []int16, i int) { func idxInt16(x, y []int16, i int) {
var t int16 var t int16
// amd64: `MOVWL[SZ]X\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*` // amd64: `MOVWL[SZ]X 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*`
// 386: `MOVWL[SZ]X\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*` // 386: `MOVWL[SZ]X 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*`
t = x[i+1] t = x[i+1]
// amd64: `MOVW\t[A-Z]+[0-9]*, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\)` // amd64: `MOVW [A-Z]+[0-9]*, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\)`
// 386: `MOVW\t[A-Z]+[0-9]*, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\)` // 386: `MOVW [A-Z]+[0-9]*, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\)`
y[i+1] = t y[i+1] = t
// amd64: `MOVWL[SZ]X\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*` // amd64: `MOVWL[SZ]X 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*`
// 386: `MOVWL[SZ]X\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*` // 386: `MOVWL[SZ]X 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*`
t = x[16*i+1] t = x[16*i+1]
// amd64: `MOVW\t[A-Z]+[0-9]*, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\)` // amd64: `MOVW [A-Z]+[0-9]*, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\)`
// 386: `MOVW\t[A-Z]+[0-9]*, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\)` // 386: `MOVW [A-Z]+[0-9]*, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\)`
y[16*i+1] = t y[16*i+1] = t
// amd64: `MOVW\t[$]77, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\)` // amd64: `MOVW [$]77, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\)`
// 386: `MOVW\t[$]77, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\)` // 386: `MOVW [$]77, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\)`
x[i+1] = 77 x[i+1] = 77
// amd64: `MOVW\t[$]77, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\)` // amd64: `MOVW [$]77, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\)`
// 386: `MOVW\t[$]77, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\)` // 386: `MOVW [$]77, 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\)`
x[16*i+1] = 77 x[16*i+1] = 77
} }
func idxInt32(x, y []int32, i int) { func idxInt32(x, y []int32, i int) {
var t int32 var t int32
// amd64: `MOVL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64: `MOVL 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
// 386: `MOVL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // 386: `MOVL 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
t = x[i+1] t = x[i+1]
// amd64: `MOVL\t[A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `MOVL [A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
// 386: `MOVL\t[A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // 386: `MOVL [A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
y[i+1] = t y[i+1] = t
// amd64: `MOVL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `MOVL 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
t = x[2*i+1] t = x[2*i+1]
// amd64: `MOVL\t[A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `MOVL [A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
y[2*i+1] = t y[2*i+1] = t
// amd64: `MOVL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*` // amd64: `MOVL 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*`
// 386: `MOVL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*` // 386: `MOVL 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*`
t = x[16*i+1] t = x[16*i+1]
// amd64: `MOVL\t[A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)` // amd64: `MOVL [A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)`
// 386: `MOVL\t[A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)` // 386: `MOVL [A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)`
y[16*i+1] = t y[16*i+1] = t
// amd64: `MOVL\t[$]77, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `MOVL [$]77, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
// 386: `MOVL\t[$]77, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // 386: `MOVL [$]77, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+1] = 77 x[i+1] = 77
// amd64: `MOVL\t[$]77, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)` // amd64: `MOVL [$]77, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)`
// 386: `MOVL\t[$]77, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)` // 386: `MOVL [$]77, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)`
x[16*i+1] = 77 x[16*i+1] = 77
} }
func idxInt64(x, y []int64, i int) { func idxInt64(x, y []int64, i int) {
var t int64 var t int64
// amd64: `MOVQ\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `MOVQ 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
t = x[i+1] t = x[i+1]
// amd64: `MOVQ\t[A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `MOVQ [A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
y[i+1] = t y[i+1] = t
// amd64: `MOVQ\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), [A-Z]+[0-9]*` // amd64: `MOVQ 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), [A-Z]+[0-9]*`
t = x[16*i+1] t = x[16*i+1]
// amd64: `MOVQ\t[A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)` // amd64: `MOVQ [A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)`
y[16*i+1] = t y[16*i+1] = t
// amd64: `MOVQ\t[$]77, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `MOVQ [$]77, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+1] = 77 x[i+1] = 77
// amd64: `MOVQ\t[$]77, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)` // amd64: `MOVQ [$]77, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)`
x[16*i+1] = 77 x[16*i+1] = 77
} }
func idxFloat32(x, y []float32, i int) { func idxFloat32(x, y []float32, i int) {
var t float32 var t float32
// amd64: `MOVSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+` // amd64: `MOVSS 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+`
// 386/sse2: `MOVSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+` // 386/sse2: `MOVSS 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+`
// arm64: `FMOVS\t\(R[0-9]*\)\(R[0-9]*<<2\), F[0-9]+` // arm64: `FMOVS \(R[0-9]*\)\(R[0-9]*<<2\), F[0-9]+`
t = x[i+1] t = x[i+1]
// amd64: `MOVSS\tX[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `MOVSS X[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
// 386/sse2: `MOVSS\tX[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // 386/sse2: `MOVSS X[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
// arm64: `FMOVS\tF[0-9]+, \(R[0-9]*\)\(R[0-9]*<<2\)` // arm64: `FMOVS F[0-9]+, \(R[0-9]*\)\(R[0-9]*<<2\)`
y[i+1] = t y[i+1] = t
// amd64: `MOVSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), X[0-9]+` // amd64: `MOVSS 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), X[0-9]+`
// 386/sse2: `MOVSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), X[0-9]+` // 386/sse2: `MOVSS 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), X[0-9]+`
t = x[16*i+1] t = x[16*i+1]
// amd64: `MOVSS\tX[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)` // amd64: `MOVSS X[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)`
// 386/sse2: `MOVSS\tX[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)` // 386/sse2: `MOVSS X[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\)`
y[16*i+1] = t y[16*i+1] = t
} }
func idxFloat64(x, y []float64, i int) { func idxFloat64(x, y []float64, i int) {
var t float64 var t float64
// amd64: `MOVSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+` // amd64: `MOVSD 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+`
// 386/sse2: `MOVSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+` // 386/sse2: `MOVSD 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+`
// arm64: `FMOVD\t\(R[0-9]*\)\(R[0-9]*<<3\), F[0-9]+` // arm64: `FMOVD \(R[0-9]*\)\(R[0-9]*<<3\), F[0-9]+`
t = x[i+1] t = x[i+1]
// amd64: `MOVSD\tX[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `MOVSD X[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
// 386/sse2: `MOVSD\tX[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // 386/sse2: `MOVSD X[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
// arm64: `FMOVD\tF[0-9]+, \(R[0-9]*\)\(R[0-9]*<<3\)` // arm64: `FMOVD F[0-9]+, \(R[0-9]*\)\(R[0-9]*<<3\)`
y[i+1] = t y[i+1] = t
// amd64: `MOVSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), X[0-9]+` // amd64: `MOVSD 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), X[0-9]+`
// 386/sse2: `MOVSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), X[0-9]+` // 386/sse2: `MOVSD 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), X[0-9]+`
t = x[16*i+1] t = x[16*i+1]
// amd64: `MOVSD\tX[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)` // amd64: `MOVSD X[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)`
// 386/sse2: `MOVSD\tX[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)` // 386/sse2: `MOVSD X[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)`
y[16*i+1] = t y[16*i+1] = t
} }
func idxLoadPlusOp32(x []int32, i int) int32 { func idxLoadPlusOp32(x []int32, i int) int32 {
s := x[0] s := x[0]
// 386: `ADDL\t4\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+` // 386: `ADDL 4\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
// amd64: `ADDL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64: `ADDL 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s += x[i+1] s += x[i+1]
// 386: `SUBL\t8\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+` // 386: `SUBL 8\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
// amd64: `SUBL\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64: `SUBL 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s -= x[i+2] s -= x[i+2]
// 386: `IMULL\t12\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+` // 386: `IMULL 12\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
s *= x[i+3] s *= x[i+3]
// 386: `ANDL\t16\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+` // 386: `ANDL 16\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
// amd64: `ANDL\t16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64: `ANDL 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s &= x[i+4] s &= x[i+4]
// 386: `ORL\t20\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+` // 386: `ORL 20\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
// amd64: `ORL\t20\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64: `ORL 20\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s |= x[i+5] s |= x[i+5]
// 386: `XORL\t24\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+` // 386: `XORL 24\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
// amd64: `XORL\t24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64: `XORL 24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
s ^= x[i+6] s ^= x[i+6]
return s return s
} }
func idxLoadPlusOp64(x []int64, i int) int64 { func idxLoadPlusOp64(x []int64, i int) int64 {
s := x[0] s := x[0]
// amd64: `ADDQ\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `ADDQ 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s += x[i+1] s += x[i+1]
// amd64: `SUBQ\t16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `SUBQ 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s -= x[i+2] s -= x[i+2]
// amd64: `ANDQ\t24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `ANDQ 24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s &= x[i+3] s &= x[i+3]
// amd64: `ORQ\t32\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `ORQ 32\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s |= x[i+4] s |= x[i+4]
// amd64: `XORQ\t40\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `XORQ 40\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
s ^= x[i+5] s ^= x[i+5]
return s return s
} }
func idxStorePlusOp32(x []int32, i int, v int32) { func idxStorePlusOp32(x []int32, i int, v int32) {
// 386: `ADDL\t[A-Z]+, 4\([A-Z]+\)\([A-Z]+\*4\)` // 386: `ADDL [A-Z]+, 4\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `ADDL\t[A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `ADDL [A-Z]+[0-9]*, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+1] += v x[i+1] += v
// 386: `SUBL\t[A-Z]+, 8\([A-Z]+\)\([A-Z]+\*4\)` // 386: `SUBL [A-Z]+, 8\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `SUBL\t[A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `SUBL [A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+2] -= v x[i+2] -= v
// 386: `ANDL\t[A-Z]+, 12\([A-Z]+\)\([A-Z]+\*4\)` // 386: `ANDL [A-Z]+, 12\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `ANDL\t[A-Z]+[0-9]*, 12\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `ANDL [A-Z]+[0-9]*, 12\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+3] &= v x[i+3] &= v
// 386: `ORL\t[A-Z]+, 16\([A-Z]+\)\([A-Z]+\*4\)` // 386: `ORL [A-Z]+, 16\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `ORL\t[A-Z]+[0-9]*, 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `ORL [A-Z]+[0-9]*, 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+4] |= v x[i+4] |= v
// 386: `XORL\t[A-Z]+, 20\([A-Z]+\)\([A-Z]+\*4\)` // 386: `XORL [A-Z]+, 20\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `XORL\t[A-Z]+[0-9]*, 20\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `XORL [A-Z]+[0-9]*, 20\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+5] ^= v x[i+5] ^= v
// 386: `ADDL\t[$]77, 24\([A-Z]+\)\([A-Z]+\*4\)` // 386: `ADDL [$]77, 24\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `ADDL\t[$]77, 24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `ADDL [$]77, 24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+6] += 77 x[i+6] += 77
// 386: `ANDL\t[$]77, 28\([A-Z]+\)\([A-Z]+\*4\)` // 386: `ANDL [$]77, 28\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `ANDL\t[$]77, 28\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `ANDL [$]77, 28\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+7] &= 77 x[i+7] &= 77
// 386: `ORL\t[$]77, 32\([A-Z]+\)\([A-Z]+\*4\)` // 386: `ORL [$]77, 32\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `ORL\t[$]77, 32\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `ORL [$]77, 32\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+8] |= 77 x[i+8] |= 77
// 386: `XORL\t[$]77, 36\([A-Z]+\)\([A-Z]+\*4\)` // 386: `XORL [$]77, 36\([A-Z]+\)\([A-Z]+\*4\)`
// amd64: `XORL\t[$]77, 36\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)` // amd64: `XORL [$]77, 36\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
x[i+9] ^= 77 x[i+9] ^= 77
} }
func idxStorePlusOp64(x []int64, i int, v int64) { func idxStorePlusOp64(x []int64, i int, v int64) {
// amd64: `ADDQ\t[A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `ADDQ [A-Z]+[0-9]*, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+1] += v x[i+1] += v
// amd64: `SUBQ\t[A-Z]+[0-9]*, 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `SUBQ [A-Z]+[0-9]*, 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+2] -= v x[i+2] -= v
// amd64: `ANDQ\t[A-Z]+[0-9]*, 24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `ANDQ [A-Z]+[0-9]*, 24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+3] &= v x[i+3] &= v
// amd64: `ORQ\t[A-Z]+[0-9]*, 32\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `ORQ [A-Z]+[0-9]*, 32\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+4] |= v x[i+4] |= v
// amd64: `XORQ\t[A-Z]+[0-9]*, 40\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `XORQ [A-Z]+[0-9]*, 40\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+5] ^= v x[i+5] ^= v
// amd64: `ADDQ\t[$]77, 48\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `ADDQ [$]77, 48\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+6] += 77 x[i+6] += 77
// amd64: `ANDQ\t[$]77, 56\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `ANDQ [$]77, 56\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+7] &= 77 x[i+7] &= 77
// amd64: `ORQ\t[$]77, 64\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `ORQ [$]77, 64\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+8] |= 77 x[i+8] |= 77
// amd64: `XORQ\t[$]77, 72\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)` // amd64: `XORQ [$]77, 72\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
x[i+9] ^= 77 x[i+9] ^= 77
} }
func idxCompare(i int) int { func idxCompare(i int) int {
// amd64: `MOVBLZX\t1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*` // amd64: `MOVBLZX 1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*`
if x8[i+1] < x8[0] { if x8[i+1] < x8[0] {
return 0 return 0
} }
// amd64: `MOVWLZX\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*` // amd64: `MOVWLZX 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*`
if x16[i+1] < x16[0] { if x16[i+1] < x16[0] {
return 0 return 0
} }
// amd64: `MOVWLZX\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*` // amd64: `MOVWLZX 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*`
if x16[16*i+1] < x16[0] { if x16[16*i+1] < x16[0] {
return 0 return 0
} }
// amd64: `MOVL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64: `MOVL 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
if x32[i+1] < x32[0] { if x32[i+1] < x32[0] {
return 0 return 0
} }
// amd64: `MOVL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*` // amd64: `MOVL 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*`
if x32[16*i+1] < x32[0] { if x32[16*i+1] < x32[0] {
return 0 return 0
} }
// amd64: `MOVQ\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `MOVQ 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
if x64[i+1] < x64[0] { if x64[i+1] < x64[0] {
return 0 return 0
} }
// amd64: `MOVQ\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), [A-Z]+[0-9]*` // amd64: `MOVQ 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), [A-Z]+[0-9]*`
if x64[16*i+1] < x64[0] { if x64[16*i+1] < x64[0] {
return 0 return 0
} }
// amd64: `MOVBLZX\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*` // amd64: `MOVBLZX 2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*`
if x8[i+2] < 77 { if x8[i+2] < 77 {
return 0 return 0
} }
// amd64: `MOVWLZX\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*` // amd64: `MOVWLZX 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*`
if x16[i+2] < 77 { if x16[i+2] < 77 {
return 0 return 0
} }
// amd64: `MOVWLZX\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*` // amd64: `MOVWLZX 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*`
if x16[16*i+2] < 77 { if x16[16*i+2] < 77 {
return 0 return 0
} }
// amd64: `MOVL\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` // amd64: `MOVL 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*`
if x32[i+2] < 77 { if x32[i+2] < 77 {
return 0 return 0
} }
// amd64: `MOVL\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*` // amd64: `MOVL 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*`
if x32[16*i+2] < 77 { if x32[16*i+2] < 77 {
return 0 return 0
} }
// amd64: `MOVQ\t16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` // amd64: `MOVQ 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*`
if x64[i+2] < 77 { if x64[i+2] < 77 {
return 0 return 0
} }
// amd64: `MOVQ\t16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), [A-Z]+[0-9]*` // amd64: `MOVQ 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), [A-Z]+[0-9]*`
if x64[16*i+2] < 77 { if x64[16*i+2] < 77 {
return 0 return 0
} }
@ -345,59 +345,59 @@ func idxCompare(i int) int {
func idxFloatOps(a []float64, b []float32, i int) (float64, float32) { func idxFloatOps(a []float64, b []float32, i int) (float64, float32) {
c := float64(7) c := float64(7)
// amd64: `ADDSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+` // amd64: `ADDSD 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+`
c += a[i+1] c += a[i+1]
// amd64: `SUBSD\t16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+` // amd64: `SUBSD 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+`
c -= a[i+2] c -= a[i+2]
// amd64: `MULSD\t24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+` // amd64: `MULSD 24\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+`
c *= a[i+3] c *= a[i+3]
// amd64: `DIVSD\t32\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+` // amd64: `DIVSD 32\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+`
c /= a[i+4] c /= a[i+4]
d := float32(8) d := float32(8)
// amd64: `ADDSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+` // amd64: `ADDSS 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+`
d += b[i+1] d += b[i+1]
// amd64: `SUBSS\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+` // amd64: `SUBSS 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+`
d -= b[i+2] d -= b[i+2]
// amd64: `MULSS\t12\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+` // amd64: `MULSS 12\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+`
d *= b[i+3] d *= b[i+3]
// amd64: `DIVSS\t16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+` // amd64: `DIVSS 16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+`
d /= b[i+4] d /= b[i+4]
return c, d return c, d
} }
func storeTest(a []bool, v int, i int) { func storeTest(a []bool, v int, i int) {
// amd64: `BTL\t\$0,`,`SETCS\t4\([A-Z]+[0-9]*\)` // amd64: `BTL \$0,`,`SETCS 4\([A-Z]+[0-9]*\)`
a[4] = v&1 != 0 a[4] = v&1 != 0
// amd64: `BTL\t\$1,`,`SETCS\t3\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)` // amd64: `BTL \$1,`,`SETCS 3\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
a[3+i] = v&2 != 0 a[3+i] = v&2 != 0
} }
func bitOps(p *[12]uint64) { func bitOps(p *[12]uint64) {
// amd64: `ORQ\t\$8, \(AX\)` // amd64: `ORQ \$8, \(AX\)`
p[0] |= 8 p[0] |= 8
// amd64: `ORQ\t\$1073741824, 8\(AX\)` // amd64: `ORQ \$1073741824, 8\(AX\)`
p[1] |= 1 << 30 p[1] |= 1 << 30
// amd64: `BTSQ\t\$31, 16\(AX\)` // amd64: `BTSQ \$31, 16\(AX\)`
p[2] |= 1 << 31 p[2] |= 1 << 31
// amd64: `BTSQ\t\$63, 24\(AX\)` // amd64: `BTSQ \$63, 24\(AX\)`
p[3] |= 1 << 63 p[3] |= 1 << 63
// amd64: `ANDQ\t\$-9, 32\(AX\)` // amd64: `ANDQ \$-9, 32\(AX\)`
p[4] &^= 8 p[4] &^= 8
// amd64: `ANDQ\t\$-1073741825, 40\(AX\)` // amd64: `ANDQ \$-1073741825, 40\(AX\)`
p[5] &^= 1 << 30 p[5] &^= 1 << 30
// amd64: `BTRQ\t\$31, 48\(AX\)` // amd64: `BTRQ \$31, 48\(AX\)`
p[6] &^= 1 << 31 p[6] &^= 1 << 31
// amd64: `BTRQ\t\$63, 56\(AX\)` // amd64: `BTRQ \$63, 56\(AX\)`
p[7] &^= 1 << 63 p[7] &^= 1 << 63
// amd64: `XORQ\t\$8, 64\(AX\)` // amd64: `XORQ \$8, 64\(AX\)`
p[8] ^= 8 p[8] ^= 8
// amd64: `XORQ\t\$1073741824, 72\(AX\)` // amd64: `XORQ \$1073741824, 72\(AX\)`
p[9] ^= 1 << 30 p[9] ^= 1 << 30
// amd64: `BTCQ\t\$31, 80\(AX\)` // amd64: `BTCQ \$31, 80\(AX\)`
p[10] ^= 1 << 31 p[10] ^= 1 << 31
// amd64: `BTCQ\t\$63, 88\(AX\)` // amd64: `BTCQ \$63, 88\(AX\)`
p[11] ^= 1 << 63 p[11] ^= 1 << 63
} }

View file

@ -11,8 +11,8 @@ package codegen
func m0(x int64) int64 { func m0(x int64) int64 {
// amd64: "XORL" // amd64: "XORL"
// arm64: "MOVD\tZR" // arm64: "MOVD ZR"
// loong64: "MOVV\tR0" // loong64: "MOVV R0"
return x * 0 return x * 0
} }
func m2(x int64) int64 { func m2(x int64) int64 {
@ -22,351 +22,351 @@ func m2(x int64) int64 {
return x * 2 return x * 2
} }
func m3(x int64) int64 { func m3(x int64) int64 {
// amd64: "LEAQ\t.*[*]2" // amd64: "LEAQ .*[*]2"
// arm64: "ADD\tR[0-9]+<<1," // arm64: "ADD R[0-9]+<<1,"
// loong64: "ALSLV\t[$]1," // loong64: "ALSLV [$]1,"
return x * 3 return x * 3
} }
func m4(x int64) int64 { func m4(x int64) int64 {
// amd64: "SHLQ\t[$]2," // amd64: "SHLQ [$]2,"
// arm64: "LSL\t[$]2," // arm64: "LSL [$]2,"
// loong64: "SLLV\t[$]2," // loong64: "SLLV [$]2,"
return x * 4 return x * 4
} }
func m5(x int64) int64 { func m5(x int64) int64 {
// amd64: "LEAQ\t.*[*]4" // amd64: "LEAQ .*[*]4"
// arm64: "ADD\tR[0-9]+<<2," // arm64: "ADD R[0-9]+<<2,"
// loong64: "ALSLV\t[$]2," // loong64: "ALSLV [$]2,"
return x * 5 return x * 5
} }
func m6(x int64) int64 { func m6(x int64) int64 {
// amd64: "LEAQ\t.*[*]1", "LEAQ\t.*[*]2" // amd64: "LEAQ .*[*]1", "LEAQ .*[*]2"
// arm64: "ADD\tR[0-9]+,", "ADD\tR[0-9]+<<1," // arm64: "ADD R[0-9]+,", "ADD R[0-9]+<<1,"
// loong64: "ADDVU", "ADDVU", "ADDVU" // loong64: "ADDVU", "ADDVU", "ADDVU"
return x * 6 return x * 6
} }
func m7(x int64) int64 { func m7(x int64) int64 {
// amd64: "LEAQ\t.*[*]2" // amd64: "LEAQ .*[*]2"
// arm64: "LSL\t[$]3,", "SUB\tR[0-9]+," // arm64: "LSL [$]3,", "SUB R[0-9]+,"
// loong64: "ALSLV\t[$]1,", "ALSLV\t[$]1," // loong64: "ALSLV [$]1,", "ALSLV [$]1,"
return x * 7 return x * 7
} }
func m8(x int64) int64 { func m8(x int64) int64 {
// amd64: "SHLQ\t[$]3," // amd64: "SHLQ [$]3,"
// arm64: "LSL\t[$]3," // arm64: "LSL [$]3,"
// loong64: "SLLV\t[$]3," // loong64: "SLLV [$]3,"
return x * 8 return x * 8
} }
func m9(x int64) int64 { func m9(x int64) int64 {
// amd64: "LEAQ\t.*[*]8" // amd64: "LEAQ .*[*]8"
// arm64: "ADD\tR[0-9]+<<3," // arm64: "ADD R[0-9]+<<3,"
// loong64: "ALSLV\t[$]3," // loong64: "ALSLV [$]3,"
return x * 9 return x * 9
} }
func m10(x int64) int64 { func m10(x int64) int64 {
// amd64: "LEAQ\t.*[*]1", "LEAQ\t.*[*]4" // amd64: "LEAQ .*[*]1", "LEAQ .*[*]4"
// arm64: "ADD\tR[0-9]+,", "ADD\tR[0-9]+<<2," // arm64: "ADD R[0-9]+,", "ADD R[0-9]+<<2,"
// loong64: "ADDVU", "ALSLV\t[$]2," // loong64: "ADDVU", "ALSLV [$]2,"
return x * 10 return x * 10
} }
func m11(x int64) int64 { func m11(x int64) int64 {
// amd64: "LEAQ\t.*[*]4", "LEAQ\t.*[*]2" // amd64: "LEAQ .*[*]4", "LEAQ .*[*]2"
// arm64: "MOVD\t[$]11,", "MUL" // arm64: "MOVD [$]11,", "MUL"
// loong64: "ALSLV\t[$]2,", "ALSLV\t[$]1," // loong64: "ALSLV [$]2,", "ALSLV [$]1,"
return x * 11 return x * 11
} }
func m12(x int64) int64 { func m12(x int64) int64 {
// amd64: "LEAQ\t.*[*]2", "SHLQ\t[$]2," // amd64: "LEAQ .*[*]2", "SHLQ [$]2,"
// arm64: "LSL\t[$]2,", "ADD\tR[0-9]+<<1," // arm64: "LSL [$]2,", "ADD R[0-9]+<<1,"
// loong64: "SLLV", "ALSLV\t[$]1," // loong64: "SLLV", "ALSLV [$]1,"
return x * 12 return x * 12
} }
func m13(x int64) int64 { func m13(x int64) int64 {
// amd64: "LEAQ\t.*[*]2", "LEAQ\t.*[*]4" // amd64: "LEAQ .*[*]2", "LEAQ .*[*]4"
// arm64: "MOVD\t[$]13,", "MUL" // arm64: "MOVD [$]13,", "MUL"
// loong64: "ALSLV\t[$]1,", "ALSLV\t[$]2," // loong64: "ALSLV [$]1,", "ALSLV [$]2,"
return x * 13 return x * 13
} }
func m14(x int64) int64 { func m14(x int64) int64 {
// amd64: "IMUL3Q\t[$]14," // amd64: "IMUL3Q [$]14,"
// arm64: "LSL\t[$]4,", "SUB\tR[0-9]+<<1," // arm64: "LSL [$]4,", "SUB R[0-9]+<<1,"
// loong64: "ADDVU", "ALSLV\t[$]1", "ALSLV\t[$]2" // loong64: "ADDVU", "ALSLV [$]1", "ALSLV [$]2"
return x * 14 return x * 14
} }
func m15(x int64) int64 { func m15(x int64) int64 {
// amd64: "LEAQ\t.*[*]2", "LEAQ\t.*[*]4" // amd64: "LEAQ .*[*]2", "LEAQ .*[*]4"
// arm64: "LSL\t[$]4,", "SUB\tR[0-9]+," // arm64: "LSL [$]4,", "SUB R[0-9]+,"
// loong64: "ALSLV\t[$]1,", "ALSLV\t[$]2," // loong64: "ALSLV [$]1,", "ALSLV [$]2,"
return x * 15 return x * 15
} }
func m16(x int64) int64 { func m16(x int64) int64 {
// amd64: "SHLQ\t[$]4," // amd64: "SHLQ [$]4,"
// arm64: "LSL\t[$]4," // arm64: "LSL [$]4,"
// loong64: "SLLV\t[$]4," // loong64: "SLLV [$]4,"
return x * 16 return x * 16
} }
func m17(x int64) int64 { func m17(x int64) int64 {
// amd64: "LEAQ\t.*[*]1", "LEAQ\t.*[*]8" // amd64: "LEAQ .*[*]1", "LEAQ .*[*]8"
// arm64: "ADD\tR[0-9]+<<4," // arm64: "ADD R[0-9]+<<4,"
// loong64: "ALSLV\t[$]" // loong64: "ALSLV [$]"
return x * 17 return x * 17
} }
func m18(x int64) int64 { func m18(x int64) int64 {
// amd64: "LEAQ\t.*[*]1", "LEAQ\t.*[*]8" // amd64: "LEAQ .*[*]1", "LEAQ .*[*]8"
// arm64: "ADD\tR[0-9]+,", "ADD\tR[0-9]+<<3," // arm64: "ADD R[0-9]+,", "ADD R[0-9]+<<3,"
// loong64: "ADDVU", "ALSLV\t[$]3," // loong64: "ADDVU", "ALSLV [$]3,"
return x * 18 return x * 18
} }
func m19(x int64) int64 { func m19(x int64) int64 {
// amd64: "LEAQ\t.*[*]8", "LEAQ\t.*[*]2" // amd64: "LEAQ .*[*]8", "LEAQ .*[*]2"
// arm64: "MOVD\t[$]19,", "MUL" // arm64: "MOVD [$]19,", "MUL"
// loong64: "ALSLV\t[$]3,", "ALSLV\t[$]1," // loong64: "ALSLV [$]3,", "ALSLV [$]1,"
return x * 19 return x * 19
} }
func m20(x int64) int64 { func m20(x int64) int64 {
// amd64: "LEAQ\t.*[*]4", "SHLQ\t[$]2," // amd64: "LEAQ .*[*]4", "SHLQ [$]2,"
// arm64: "LSL\t[$]2,", "ADD\tR[0-9]+<<2," // arm64: "LSL [$]2,", "ADD R[0-9]+<<2,"
// loong64: "SLLV\t[$]2,", "ALSLV\t[$]2," // loong64: "SLLV [$]2,", "ALSLV [$]2,"
return x * 20 return x * 20
} }
func m21(x int64) int64 { func m21(x int64) int64 {
// amd64: "LEAQ\t.*[*]4", "LEAQ\t.*[*]4" // amd64: "LEAQ .*[*]4", "LEAQ .*[*]4"
// arm64: "MOVD\t[$]21,", "MUL" // arm64: "MOVD [$]21,", "MUL"
// loong64: "ALSLV\t[$]2,", "ALSLV\t[$]2," // loong64: "ALSLV [$]2,", "ALSLV [$]2,"
return x * 21 return x * 21
} }
func m22(x int64) int64 { func m22(x int64) int64 {
// amd64: "IMUL3Q\t[$]22," // amd64: "IMUL3Q [$]22,"
// arm64: "MOVD\t[$]22,", "MUL" // arm64: "MOVD [$]22,", "MUL"
// loong64: "ADDVU", "ALSLV\t[$]2,", "ALSLV\t[$]2," // loong64: "ADDVU", "ALSLV [$]2,", "ALSLV [$]2,"
return x * 22 return x * 22
} }
func m23(x int64) int64 { func m23(x int64) int64 {
// amd64: "IMUL3Q\t[$]23," // amd64: "IMUL3Q [$]23,"
// arm64: "MOVD\t[$]23,", "MUL" // arm64: "MOVD [$]23,", "MUL"
// loong64: "ALSLV\t[$]1,", "SUBVU", "ALSLV\t[$]3," // loong64: "ALSLV [$]1,", "SUBVU", "ALSLV [$]3,"
return x * 23 return x * 23
} }
func m24(x int64) int64 { func m24(x int64) int64 {
// amd64: "LEAQ\t.*[*]2", "SHLQ\t[$]3," // amd64: "LEAQ .*[*]2", "SHLQ [$]3,"
// arm64: "LSL\t[$]3,", "ADD\tR[0-9]+<<1," // arm64: "LSL [$]3,", "ADD R[0-9]+<<1,"
// loong64: "SLLV\t[$]3", "ALSLV\t[$]1," // loong64: "SLLV [$]3", "ALSLV [$]1,"
return x * 24 return x * 24
} }
func m25(x int64) int64 { func m25(x int64) int64 {
// amd64: "LEAQ\t.*[*]4", "LEAQ\t.*[*]4" // amd64: "LEAQ .*[*]4", "LEAQ .*[*]4"
// arm64: "MOVD\t[$]25,", "MUL" // arm64: "MOVD [$]25,", "MUL"
// loong64: "ALSLV\t[$]2,", "ALSLV\t[$]2," // loong64: "ALSLV [$]2,", "ALSLV [$]2,"
return x * 25 return x * 25
} }
func m26(x int64) int64 { func m26(x int64) int64 {
// amd64: "IMUL3Q\t[$]26," // amd64: "IMUL3Q [$]26,"
// arm64: "MOVD\t[$]26,", "MUL" // arm64: "MOVD [$]26,", "MUL"
// loong64: "ADDVU", "ALSLV\t[$]1,", "ALSLV\t[$]3," // loong64: "ADDVU", "ALSLV [$]1,", "ALSLV [$]3,"
return x * 26 return x * 26
} }
func m27(x int64) int64 { func m27(x int64) int64 {
// amd64: "LEAQ\t.*[*]2", "LEAQ\t.*[*]8" // amd64: "LEAQ .*[*]2", "LEAQ .*[*]8"
// arm64: "MOVD\t[$]27,", "MUL" // arm64: "MOVD [$]27,", "MUL"
// loong64: "ALSLV\t[$]1,", "ALSLV\t[$]3," // loong64: "ALSLV [$]1,", "ALSLV [$]3,"
return x * 27 return x * 27
} }
func m28(x int64) int64 { func m28(x int64) int64 {
// amd64: "IMUL3Q\t[$]28," // amd64: "IMUL3Q [$]28,"
// arm64: "LSL\t[$]5, "SUB\tR[0-9]+<<2," // arm64: "LSL [$]5, "SUB R[0-9]+<<2,"
// loong64: "ALSLV\t[$]1,","SLLV\t[$]2,","ALSLV\t[$]3," // loong64: "ALSLV [$]1," "SLLV [$]2," "ALSLV [$]3,"
return x * 28 return x * 28
} }
func m29(x int64) int64 { func m29(x int64) int64 {
// amd64: "IMUL3Q\t[$]29," // amd64: "IMUL3Q [$]29,"
// arm64: "MOVD\t[$]29,", "MUL" // arm64: "MOVD [$]29,", "MUL"
// loong64: "ALSLV\t[$]1,","SLLV\t[$]5,","SUBVU" // loong64: "ALSLV [$]1," "SLLV [$]5," "SUBVU"
return x * 29 return x * 29
} }
func m30(x int64) int64 { func m30(x int64) int64 {
// amd64: "IMUL3Q\t[$]30," // amd64: "IMUL3Q [$]30,"
// arm64: "LSL\t[$]5,", "SUB\tR[0-9]+<<1," // arm64: "LSL [$]5,", "SUB R[0-9]+<<1,"
// loong64: "ADDVU","SLLV\t[$]5,","SUBVU" // loong64: "ADDVU" "SLLV [$]5," "SUBVU"
return x * 30 return x * 30
} }
func m31(x int64) int64 { func m31(x int64) int64 {
// amd64: "SHLQ\t[$]5,", "SUBQ" // amd64: "SHLQ [$]5,", "SUBQ"
// arm64: "LSL\t[$]5,", "SUB\tR[0-9]+," // arm64: "LSL [$]5,", "SUB R[0-9]+,"
// loong64: "SLLV\t[$]5,","SUBVU" // loong64: "SLLV [$]5," "SUBVU"
return x * 31 return x * 31
} }
func m32(x int64) int64 { func m32(x int64) int64 {
// amd64: "SHLQ\t[$]5," // amd64: "SHLQ [$]5,"
// arm64: "LSL\t[$]5," // arm64: "LSL [$]5,"
// loong64: "SLLV\t[$]5," // loong64: "SLLV [$]5,"
return x * 32 return x * 32
} }
func m33(x int64) int64 { func m33(x int64) int64 {
// amd64: "SHLQ\t[$]2,", "LEAQ\t.*[*]8" // amd64: "SHLQ [$]2,", "LEAQ .*[*]8"
// arm64: "ADD\tR[0-9]+<<5," // arm64: "ADD R[0-9]+<<5,"
// loong64: "ADDVU", "ALSLV\t[$]4," // loong64: "ADDVU", "ALSLV [$]4,"
return x * 33 return x * 33
} }
func m34(x int64) int64 { func m34(x int64) int64 {
// amd64: "SHLQ\t[$]5,", "LEAQ\t.*[*]2" // amd64: "SHLQ [$]5,", "LEAQ .*[*]2"
// arm64: "ADD\tR[0-9]+,", "ADD\tR[0-9]+<<4," // arm64: "ADD R[0-9]+,", "ADD R[0-9]+<<4,"
// loong64: "ADDVU", "ALSLV\t[$]4," // loong64: "ADDVU", "ALSLV [$]4,"
return x * 34 return x * 34
} }
func m35(x int64) int64 { func m35(x int64) int64 {
// amd64: "IMUL3Q\t[$]35," // amd64: "IMUL3Q [$]35,"
// arm64: "MOVD\t[$]35,", "MUL" // arm64: "MOVD [$]35,", "MUL"
// loong64: "ALSLV\t[$]4,", "ALSLV\t[$]1," // loong64: "ALSLV [$]4,", "ALSLV [$]1,"
return x * 35 return x * 35
} }
func m36(x int64) int64 { func m36(x int64) int64 {
// amd64: "LEAQ\t.*[*]8", "SHLQ\t[$]2," // amd64: "LEAQ .*[*]8", "SHLQ [$]2,"
// arm64: "LSL\t[$]2,", "ADD\tR[0-9]+<<3," // arm64: "LSL [$]2,", "ADD R[0-9]+<<3,"
// loong64: "SLLV\t[$]2,", "ALSLV\t[$]3," // loong64: "SLLV [$]2,", "ALSLV [$]3,"
return x * 36 return x * 36
} }
func m37(x int64) int64 { func m37(x int64) int64 {
// amd64: "LEAQ\t.*[*]8", "LEAQ\t.*[*]4" // amd64: "LEAQ .*[*]8", "LEAQ .*[*]4"
// arm64: "MOVD\t[$]37,", "MUL" // arm64: "MOVD [$]37,", "MUL"
// loong64: "ALSLV\t[$]3,", "ALSLV\t[$]2," // loong64: "ALSLV [$]3,", "ALSLV [$]2,"
return x * 37 return x * 37
} }
func m38(x int64) int64 { func m38(x int64) int64 {
// amd64: "IMUL3Q\t[$]38," // amd64: "IMUL3Q [$]38,"
// arm64: "MOVD\t[$]38,", "MUL" // arm64: "MOVD [$]38,", "MUL"
// loong64: "ALSLV\t[$]3,", "ALSLV\t[$]2," // loong64: "ALSLV [$]3,", "ALSLV [$]2,"
return x * 38 return x * 38
} }
func m39(x int64) int64 { func m39(x int64) int64 {
// amd64: "IMUL3Q\t[$]39," // amd64: "IMUL3Q [$]39,"
// arm64: "MOVD\t[$]39,", "MUL" // arm64: "MOVD [$]39,", "MUL"
// loong64: "ALSLV\t[$]2,", "SUBVU", "ALSLV\t[$]3," // loong64: "ALSLV [$]2,", "SUBVU", "ALSLV [$]3,"
return x * 39 return x * 39
} }
func m40(x int64) int64 { func m40(x int64) int64 {
// amd64: "LEAQ\t.*[*]4", "SHLQ\t[$]3," // amd64: "LEAQ .*[*]4", "SHLQ [$]3,"
// arm64: "LSL\t[$]3,", "ADD\tR[0-9]+<<2," // arm64: "LSL [$]3,", "ADD R[0-9]+<<2,"
// loong64: "SLLV\t[$]3,", "ALSLV\t[$]2," // loong64: "SLLV [$]3,", "ALSLV [$]2,"
return x * 40 return x * 40
} }
func mn1(x int64) int64 { func mn1(x int64) int64 {
// amd64: "NEGQ\t" // amd64: "NEGQ "
// arm64: "NEG\tR[0-9]+," // arm64: "NEG R[0-9]+,"
// loong64: "SUBVU\tR[0-9], R0," // loong64: "SUBVU R[0-9], R0,"
return x * -1 return x * -1
} }
func mn2(x int64) int64 { func mn2(x int64) int64 {
// amd64: "NEGQ", "ADDQ" // amd64: "NEGQ", "ADDQ"
// arm64: "NEG\tR[0-9]+<<1," // arm64: "NEG R[0-9]+<<1,"
// loong64: "ADDVU","SUBVU\tR[0-9], R0," // loong64: "ADDVU" "SUBVU R[0-9], R0,"
return x * -2 return x * -2
} }
func mn3(x int64) int64 { func mn3(x int64) int64 {
// amd64: "NEGQ", "LEAQ\t.*[*]2" // amd64: "NEGQ", "LEAQ .*[*]2"
// arm64: "SUB\tR[0-9]+<<2," // arm64: "SUB R[0-9]+<<2,"
// loong64: "SUBVU", "ALSLV\t[$]1," // loong64: "SUBVU", "ALSLV [$]1,"
return x * -3 return x * -3
} }
func mn4(x int64) int64 { func mn4(x int64) int64 {
// amd64: "NEGQ", "SHLQ\t[$]2," // amd64: "NEGQ", "SHLQ [$]2,"
// arm64: "NEG\tR[0-9]+<<2," // arm64: "NEG R[0-9]+<<2,"
// loong64: "SLLV\t[$]2,","SUBVU\tR[0-9], R0," // loong64: "SLLV [$]2," "SUBVU R[0-9], R0,"
return x * -4 return x * -4
} }
func mn5(x int64) int64 { func mn5(x int64) int64 {
// amd64: "NEGQ", "LEAQ\t.*[*]4" // amd64: "NEGQ", "LEAQ .*[*]4"
// arm64: "NEG\tR[0-9]+,", "ADD\tR[0-9]+<<2," // arm64: "NEG R[0-9]+,", "ADD R[0-9]+<<2,"
// loong64: "SUBVU", "ALSLV\t[$]2," // loong64: "SUBVU", "ALSLV [$]2,"
return x * -5 return x * -5
} }
func mn6(x int64) int64 { func mn6(x int64) int64 {
// amd64: "IMUL3Q\t[$]-6," // amd64: "IMUL3Q [$]-6,"
// arm64: "ADD\tR[0-9]+,", "SUB\tR[0-9]+<<2," // arm64: "ADD R[0-9]+,", "SUB R[0-9]+<<2,"
// loong64: "ADDVU", "SUBVU", "ALSLV\t[$]3," // loong64: "ADDVU", "SUBVU", "ALSLV [$]3,"
return x * -6 return x * -6
} }
func mn7(x int64) int64 { func mn7(x int64) int64 {
// amd64: "NEGQ", "LEAQ\t.*[*]8" // amd64: "NEGQ", "LEAQ .*[*]8"
// arm64: "SUB\tR[0-9]+<<3," // arm64: "SUB R[0-9]+<<3,"
// loong64: "SUBVU", "ALSLV\t[$]3," // loong64: "SUBVU", "ALSLV [$]3,"
return x * -7 return x * -7
} }
func mn8(x int64) int64 { func mn8(x int64) int64 {
// amd64: "NEGQ", "SHLQ\t[$]3," // amd64: "NEGQ", "SHLQ [$]3,"
// arm64: "NEG\tR[0-9]+<<3," // arm64: "NEG R[0-9]+<<3,"
// loong64: "SLLV\t[$]3","SUBVU\tR[0-9], R0," // loong64: "SLLV [$]3" "SUBVU R[0-9], R0,"
return x * -8 return x * -8
} }
func mn9(x int64) int64 { func mn9(x int64) int64 {
// amd64: "NEGQ", "LEAQ\t.*[*]8" // amd64: "NEGQ", "LEAQ .*[*]8"
// arm64: "NEG\tR[0-9]+,", "ADD\tR[0-9]+<<3," // arm64: "NEG R[0-9]+,", "ADD R[0-9]+<<3,"
// loong64: "SUBVU", "ALSLV\t[$]3," // loong64: "SUBVU", "ALSLV [$]3,"
return x * -9 return x * -9
} }
func mn10(x int64) int64 { func mn10(x int64) int64 {
// amd64: "IMUL3Q\t[$]-10," // amd64: "IMUL3Q [$]-10,"
// arm64: "MOVD\t[$]-10,", "MUL" // arm64: "MOVD [$]-10,", "MUL"
// loong64: "ADDVU", "ALSLV\t[$]3", "SUBVU" // loong64: "ADDVU", "ALSLV [$]3", "SUBVU"
return x * -10 return x * -10
} }
func mn11(x int64) int64 { func mn11(x int64) int64 {
// amd64: "IMUL3Q\t[$]-11," // amd64: "IMUL3Q [$]-11,"
// arm64: "MOVD\t[$]-11,", "MUL" // arm64: "MOVD [$]-11,", "MUL"
// loong64: "ALSLV\t[$]2,", "SUBVU", "ALSLV\t[$]4," // loong64: "ALSLV [$]2,", "SUBVU", "ALSLV [$]4,"
return x * -11 return x * -11
} }
func mn12(x int64) int64 { func mn12(x int64) int64 {
// amd64: "IMUL3Q\t[$]-12," // amd64: "IMUL3Q [$]-12,"
// arm64: "LSL\t[$]2,", "SUB\tR[0-9]+<<2," // arm64: "LSL [$]2,", "SUB R[0-9]+<<2,"
// loong64: "SUBVU", "SLLV\t[$]2,", "ALSLV\t[$]4," // loong64: "SUBVU", "SLLV [$]2,", "ALSLV [$]4,"
return x * -12 return x * -12
} }
func mn13(x int64) int64 { func mn13(x int64) int64 {
// amd64: "IMUL3Q\t[$]-13," // amd64: "IMUL3Q [$]-13,"
// arm64: "MOVD\t[$]-13,", "MUL" // arm64: "MOVD [$]-13,", "MUL"
// loong64: "ALSLV\t[$]4,", "SLLV\t[$]2, ", "SUBVU" // loong64: "ALSLV [$]4,", "SLLV [$]2, ", "SUBVU"
return x * -13 return x * -13
} }
func mn14(x int64) int64 { func mn14(x int64) int64 {
// amd64: "IMUL3Q\t[$]-14," // amd64: "IMUL3Q [$]-14,"
// arm64: "ADD\tR[0-9]+,", "SUB\tR[0-9]+<<3," // arm64: "ADD R[0-9]+,", "SUB R[0-9]+<<3,"
// loong64: "ADDVU", "SUBVU", "ALSLV\t[$]4," // loong64: "ADDVU", "SUBVU", "ALSLV [$]4,"
return x * -14 return x * -14
} }
func mn15(x int64) int64 { func mn15(x int64) int64 {
// amd64: "SHLQ\t[$]4,", "SUBQ" // amd64: "SHLQ [$]4,", "SUBQ"
// arm64: "SUB\tR[0-9]+<<4," // arm64: "SUB R[0-9]+<<4,"
// loong64: "SUBVU", "ALSLV\t[$]4," // loong64: "SUBVU", "ALSLV [$]4,"
return x * -15 return x * -15
} }
func mn16(x int64) int64 { func mn16(x int64) int64 {
// amd64: "NEGQ", "SHLQ\t[$]4," // amd64: "NEGQ", "SHLQ [$]4,"
// arm64: "NEG\tR[0-9]+<<4," // arm64: "NEG R[0-9]+<<4,"
// loong64: "SLLV\t[$]4,","SUBVU\tR[0-9], R0," // loong64: "SLLV [$]4," "SUBVU R[0-9], R0,"
return x * -16 return x * -16
} }
func mn17(x int64) int64 { func mn17(x int64) int64 {
// amd64: "IMUL3Q\t[$]-17," // amd64: "IMUL3Q [$]-17,"
// arm64: "NEG\tR[0-9]+,", "ADD\tR[0-9]+<<4," // arm64: "NEG R[0-9]+,", "ADD R[0-9]+<<4,"
// loong64: "SUBVU", "ALSLV\t[$]4," // loong64: "SUBVU", "ALSLV [$]4,"
return x * -17 return x * -17
} }
func mn18(x int64) int64 { func mn18(x int64) int64 {
// amd64: "IMUL3Q\t[$]-18," // amd64: "IMUL3Q [$]-18,"
// arm64: "MOVD\t[$]-18,", "MUL" // arm64: "MOVD [$]-18,", "MUL"
// loong64: "ADDVU", "ALSLV\t[$]4,", "SUBVU" // loong64: "ADDVU", "ALSLV [$]4,", "SUBVU"
return x * -18 return x * -18
} }
func mn19(x int64) int64 { func mn19(x int64) int64 {
// amd64: "IMUL3Q\t[$]-19," // amd64: "IMUL3Q [$]-19,"
// arm64: "MOVD\t[$]-19,", "MUL" // arm64: "MOVD [$]-19,", "MUL"
// loong64: "ALSLV\t[$]1,", "ALSLV\t[$]4,", "SUBVU" // loong64: "ALSLV [$]1,", "ALSLV [$]4,", "SUBVU"
return x * -19 return x * -19
} }
func mn20(x int64) int64 { func mn20(x int64) int64 {
// amd64: "IMUL3Q\t[$]-20," // amd64: "IMUL3Q [$]-20,"
// arm64: "MOVD\t[$]-20,", "MUL" // arm64: "MOVD [$]-20,", "MUL"
// loong64: "SLLV\t[$]2,", "ALSLV\t[$]4,", "SUBVU" // loong64: "SLLV [$]2,", "ALSLV [$]4,", "SUBVU"
return x * -20 return x * -20
} }

View file

@ -26,7 +26,7 @@ var val8 [8]uint8
func set16(x8 int8, u8 *uint8, y8 int8, z8 uint8) { func set16(x8 int8, u8 *uint8, y8 int8, z8 uint8) {
// Truncate not needed, load does sign/zero extend // Truncate not needed, load does sign/zero extend
// ppc64x:-"MOVBZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVBZ R\\d+,\\sR\\d+"
val16[0] = uint16(*u8) val16[0] = uint16(*u8)
// AND not needed due to size // AND not needed due to size
@ -39,20 +39,20 @@ func set16(x8 int8, u8 *uint8, y8 int8, z8 uint8) {
} }
func shiftidx(u8 *uint8, x16 *int16, u16 *uint16) { func shiftidx(u8 *uint8, x16 *int16, u16 *uint16) {
// ppc64x:-"MOVBZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVBZ R\\d+,\\sR\\d+"
val16[0] = uint16(sval16[*u8>>2]) val16[0] = uint16(sval16[*u8>>2])
// ppc64x:-"MOVH\tR\\d+,\\sR\\d+" // ppc64x:-"MOVH R\\d+,\\sR\\d+"
sval16[1] = int16(val16[*x16>>1]) sval16[1] = int16(val16[*x16>>1])
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
val16[1] = uint16(sval16[*u16>>2]) val16[1] = uint16(sval16[*u16>>2])
} }
func setnox(x8 int8, u8 *uint8, y8 *int8, z8 *uint8, x16 *int16, u16 *uint16, x32 *int32, u32 *uint32) { func setnox(x8 int8, u8 *uint8, y8 *int8, z8 *uint8, x16 *int16, u16 *uint16, x32 *int32, u32 *uint32) {
// ppc64x:-"MOVBZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVBZ R\\d+,\\sR\\d+"
val16[0] = uint16(*u8) val16[0] = uint16(*u8)
// AND not needed due to size // AND not needed due to size
@ -62,65 +62,65 @@ func setnox(x8 int8, u8 *uint8, y8 *int8, z8 *uint8, x16 *int16, u16 *uint16, x3
// ppc64x:-"ANDCC" // ppc64x:-"ANDCC"
val16[1] = 255 & uint16(*u8+*z8) val16[1] = 255 & uint16(*u8+*z8)
// ppc64x:-"MOVH\tR\\d+,\\sR\\d+" // ppc64x:-"MOVH R\\d+,\\sR\\d+"
sval32[1] = int32(*x16) sval32[1] = int32(*x16)
// ppc64x:-"MOVBZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVBZ R\\d+,\\sR\\d+"
val32[0] = uint32(*u8) val32[0] = uint32(*u8)
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
val32[1] = uint32(*u16) val32[1] = uint32(*u16)
// ppc64x:-"MOVH\tR\\d+,\\sR\\d+" // ppc64x:-"MOVH R\\d+,\\sR\\d+"
sval64[1] = int64(*x16) sval64[1] = int64(*x16)
// ppc64x:-"MOVW\tR\\d+,\\sR\\d+" // ppc64x:-"MOVW R\\d+,\\sR\\d+"
sval64[2] = int64(*x32) sval64[2] = int64(*x32)
// ppc64x:-"MOVBZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVBZ R\\d+,\\sR\\d+"
val64[0] = uint64(*u8) val64[0] = uint64(*u8)
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
val64[1] = uint64(*u16) val64[1] = uint64(*u16)
// ppc64x:-"MOVWZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVWZ R\\d+,\\sR\\d+"
val64[2] = uint64(*u32) val64[2] = uint64(*u32)
} }
func cmp16(u8 *uint8, x32 *int32, u32 *uint32, x64 *int64, u64 *uint64) bool { func cmp16(u8 *uint8, x32 *int32, u32 *uint32, x64 *int64, u64 *uint64) bool {
// ppc64x:-"MOVBZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVBZ R\\d+,\\sR\\d+"
if uint16(*u8) == val16[0] { if uint16(*u8) == val16[0] {
return true return true
} }
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
if uint16(*u32>>16) == val16[0] { if uint16(*u32>>16) == val16[0] {
return true return true
} }
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
if uint16(*u64>>48) == val16[0] { if uint16(*u64>>48) == val16[0] {
return true return true
} }
// Verify the truncates are using the correct sign. // Verify the truncates are using the correct sign.
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
if int16(*x32) == sval16[0] { if int16(*x32) == sval16[0] {
return true return true
} }
// ppc64x:-"MOVH\tR\\d+,\\sR\\d+" // ppc64x:-"MOVH R\\d+,\\sR\\d+"
if uint16(*u32) == val16[0] { if uint16(*u32) == val16[0] {
return true return true
} }
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
if int16(*x64) == sval16[0] { if int16(*x64) == sval16[0] {
return true return true
} }
// ppc64x:-"MOVH\tR\\d+,\\sR\\d+" // ppc64x:-"MOVH R\\d+,\\sR\\d+"
if uint16(*u64) == val16[0] { if uint16(*u64) == val16[0] {
return true return true
} }
@ -130,28 +130,28 @@ func cmp16(u8 *uint8, x32 *int32, u32 *uint32, x64 *int64, u64 *uint64) bool {
func cmp32(u8 *uint8, x16 *int16, u16 *uint16, x64 *int64, u64 *uint64) bool { func cmp32(u8 *uint8, x16 *int16, u16 *uint16, x64 *int64, u64 *uint64) bool {
// ppc64x:-"MOVBZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVBZ R\\d+,\\sR\\d+"
if uint32(*u8) == val32[0] { if uint32(*u8) == val32[0] {
return true return true
} }
// ppc64x:-"MOVH\tR\\d+,\\sR\\d+" // ppc64x:-"MOVH R\\d+,\\sR\\d+"
if int32(*x16) == sval32[0] { if int32(*x16) == sval32[0] {
return true return true
} }
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
if uint32(*u16) == val32[0] { if uint32(*u16) == val32[0] {
return true return true
} }
// Verify the truncates are using the correct sign. // Verify the truncates are using the correct sign.
// ppc64x:-"MOVWZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVWZ R\\d+,\\sR\\d+"
if int32(*x64) == sval32[0] { if int32(*x64) == sval32[0] {
return true return true
} }
// ppc64x:-"MOVW\tR\\d+,\\sR\\d+" // ppc64x:-"MOVW R\\d+,\\sR\\d+"
if uint32(*u64) == val32[0] { if uint32(*u64) == val32[0] {
return true return true
} }
@ -161,27 +161,27 @@ func cmp32(u8 *uint8, x16 *int16, u16 *uint16, x64 *int64, u64 *uint64) bool {
func cmp64(u8 *uint8, x16 *int16, u16 *uint16, x32 *int32, u32 *uint32) bool { func cmp64(u8 *uint8, x16 *int16, u16 *uint16, x32 *int32, u32 *uint32) bool {
// ppc64x:-"MOVBZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVBZ R\\d+,\\sR\\d+"
if uint64(*u8) == val64[0] { if uint64(*u8) == val64[0] {
return true return true
} }
// ppc64x:-"MOVH\tR\\d+,\\sR\\d+" // ppc64x:-"MOVH R\\d+,\\sR\\d+"
if int64(*x16) == sval64[0] { if int64(*x16) == sval64[0] {
return true return true
} }
// ppc64x:-"MOVHZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVHZ R\\d+,\\sR\\d+"
if uint64(*u16) == val64[0] { if uint64(*u16) == val64[0] {
return true return true
} }
// ppc64x:-"MOVW\tR\\d+,\\sR\\d+" // ppc64x:-"MOVW R\\d+,\\sR\\d+"
if int64(*x32) == sval64[0] { if int64(*x32) == sval64[0] {
return true return true
} }
// ppc64x:-"MOVWZ\tR\\d+,\\sR\\d+" // ppc64x:-"MOVWZ R\\d+,\\sR\\d+"
if uint64(*u32) == val64[0] { if uint64(*u32) == val64[0] {
return true return true
} }
@ -193,40 +193,40 @@ func cmp64(u8 *uint8, x16 *int16, u16 *uint16, x32 *int32, u32 *uint32) bool {
func noUnsignEXT(t1, t2, t3, t4 uint32, k int64) uint64 { func noUnsignEXT(t1, t2, t3, t4 uint32, k int64) uint64 {
var ret uint64 var ret uint64
// arm64:"RORW",-"MOVWU" // arm64:"RORW" -"MOVWU"
ret += uint64(bits.RotateLeft32(t1, 7)) ret += uint64(bits.RotateLeft32(t1, 7))
// arm64:"MULW",-"MOVWU" // arm64:"MULW" -"MOVWU"
ret *= uint64(t1 * t2) ret *= uint64(t1 * t2)
// arm64:"MNEGW",-"MOVWU" // arm64:"MNEGW" -"MOVWU"
ret += uint64(-t1 * t3) ret += uint64(-t1 * t3)
// arm64:"UDIVW",-"MOVWU" // arm64:"UDIVW" -"MOVWU"
ret += uint64(t1 / t4) ret += uint64(t1 / t4)
// arm64:-"MOVWU" // arm64:-"MOVWU"
ret += uint64(t2 % t3) ret += uint64(t2 % t3)
// arm64:"MSUBW",-"MOVWU" // arm64:"MSUBW" -"MOVWU"
ret += uint64(t1 - t2*t3) ret += uint64(t1 - t2*t3)
// arm64:"MADDW",-"MOVWU" // arm64:"MADDW" -"MOVWU"
ret += uint64(t3*t4 + t2) ret += uint64(t3*t4 + t2)
// arm64:"REVW",-"MOVWU" // arm64:"REVW" -"MOVWU"
ret += uint64(bits.ReverseBytes32(t1)) ret += uint64(bits.ReverseBytes32(t1))
// arm64:"RBITW",-"MOVWU" // arm64:"RBITW" -"MOVWU"
ret += uint64(bits.Reverse32(t1)) ret += uint64(bits.Reverse32(t1))
// arm64:"CLZW",-"MOVWU" // arm64:"CLZW" -"MOVWU"
ret += uint64(bits.LeadingZeros32(t1)) ret += uint64(bits.LeadingZeros32(t1))
// arm64:"REV16W",-"MOVWU" // arm64:"REV16W" -"MOVWU"
ret += uint64(((t1 & 0xff00ff00) >> 8) | ((t1 & 0x00ff00ff) << 8)) ret += uint64(((t1 & 0xff00ff00) >> 8) | ((t1 & 0x00ff00ff) << 8))
// arm64:"EXTRW",-"MOVWU" // arm64:"EXTRW" -"MOVWU"
ret += uint64((t1 << 25) | (t2 >> 7)) ret += uint64((t1 << 25) | (t2 >> 7))
return ret return ret

View file

@ -9,13 +9,13 @@ package codegen
import "reflect" import "reflect"
func intPtrTypeSize() uintptr { func intPtrTypeSize() uintptr {
// amd64:"MOVL\t[$]8,",-"CALL" // amd64:"MOVL [$]8," -"CALL"
// arm64:"MOVD\t[$]8,",-"CALL" // arm64:"MOVD [$]8," -"CALL"
return reflect.TypeFor[*int]().Size() return reflect.TypeFor[*int]().Size()
} }
func intPtrTypeKind() reflect.Kind { func intPtrTypeKind() reflect.Kind {
// amd64:"MOVL\t[$]22,",-"CALL" // amd64:"MOVL [$]22," -"CALL"
// arm64:"MOVD\t[$]22,",-"CALL" // arm64:"MOVD [$]22," -"CALL"
return reflect.TypeFor[*int]().Kind() return reflect.TypeFor[*int]().Kind()
} }

View file

@ -8,13 +8,13 @@ package codegen
//go:registerparams //go:registerparams
func f1(a, b int) { func f1(a, b int) {
// amd64:"MOVQ\tBX, CX", "MOVQ\tAX, BX", "MOVL\t\\$1, AX", -"MOVQ\t.*DX" // amd64:"MOVQ BX, CX", "MOVQ AX, BX", "MOVL [$]1, AX", -"MOVQ .*DX"
g(1, a, b) g(1, a, b)
} }
//go:registerparams //go:registerparams
func f2(a, b int) { func f2(a, b int) {
// amd64:"MOVQ\tBX, AX", "MOVQ\t[AB]X, CX", -"MOVQ\t.*, BX" // amd64:"MOVQ BX, AX", "MOVQ [AB]X, CX", -"MOVQ .*, BX"
g(b, b, b) g(b, b, b)
} }

View file

@ -5,12 +5,12 @@
package codegen package codegen
func CallFunc(f func()) { func CallFunc(f func()) {
// amd64:`CALL\truntime.retpoline` // amd64:`CALL runtime.retpoline`
f() f()
} }
func CallInterface(x interface{ M() }) { func CallInterface(x interface{ M() }) {
// amd64:`CALL\truntime.retpoline` // amd64:`CALL runtime.retpoline`
x.M() x.M()
} }

View file

@ -15,36 +15,36 @@ import "math/bits"
func rot64(x uint64) uint64 { func rot64(x uint64) uint64 {
var a uint64 var a uint64
// amd64:"ROLQ\t[$]7" // amd64:"ROLQ [$]7"
// ppc64x:"ROTL\t[$]7" // ppc64x:"ROTL [$]7"
// loong64: "ROTRV\t[$]57" // loong64: "ROTRV [$]57"
// riscv64: "RORI\t[$]57" // riscv64: "RORI [$]57"
a += x<<7 | x>>57 a += x<<7 | x>>57
// amd64:"ROLQ\t[$]8" // amd64:"ROLQ [$]8"
// arm64:"ROR\t[$]56" // arm64:"ROR [$]56"
// s390x:"RISBGZ\t[$]0, [$]63, [$]8, " // s390x:"RISBGZ [$]0, [$]63, [$]8, "
// ppc64x:"ROTL\t[$]8" // ppc64x:"ROTL [$]8"
// loong64: "ROTRV\t[$]56" // loong64: "ROTRV [$]56"
// riscv64: "RORI\t[$]56" // riscv64: "RORI [$]56"
a += x<<8 + x>>56 a += x<<8 + x>>56
// amd64:"ROLQ\t[$]9" // amd64:"ROLQ [$]9"
// arm64:"ROR\t[$]55" // arm64:"ROR [$]55"
// s390x:"RISBGZ\t[$]0, [$]63, [$]9, " // s390x:"RISBGZ [$]0, [$]63, [$]9, "
// ppc64x:"ROTL\t[$]9" // ppc64x:"ROTL [$]9"
// loong64: "ROTRV\t[$]55" // loong64: "ROTRV [$]55"
// riscv64: "RORI\t[$]55" // riscv64: "RORI [$]55"
a += x<<9 ^ x>>55 a += x<<9 ^ x>>55
// amd64:"ROLQ\t[$]10" // amd64:"ROLQ [$]10"
// arm64:"ROR\t[$]54" // arm64:"ROR [$]54"
// s390x:"RISBGZ\t[$]0, [$]63, [$]10, " // s390x:"RISBGZ [$]0, [$]63, [$]10, "
// ppc64x:"ROTL\t[$]10" // ppc64x:"ROTL [$]10"
// arm64:"ROR\t[$]54" // arm64:"ROR [$]54"
// s390x:"RISBGZ\t[$]0, [$]63, [$]10, " // s390x:"RISBGZ [$]0, [$]63, [$]10, "
// loong64: "ROTRV\t[$]54" // loong64: "ROTRV [$]54"
// riscv64: "RORI\t[$]54" // riscv64: "RORI [$]54"
a += bits.RotateLeft64(x, 10) a += bits.RotateLeft64(x, 10)
return a return a
@ -53,40 +53,40 @@ func rot64(x uint64) uint64 {
func rot32(x uint32) uint32 { func rot32(x uint32) uint32 {
var a uint32 var a uint32
// amd64:"ROLL\t[$]7" // amd64:"ROLL [$]7"
// arm:"MOVW\tR\\d+@>25" // arm:"MOVW R\\d+@>25"
// ppc64x:"ROTLW\t[$]7" // ppc64x:"ROTLW [$]7"
// loong64: "ROTR\t[$]25" // loong64: "ROTR [$]25"
// riscv64: "RORIW\t[$]25" // riscv64: "RORIW [$]25"
a += x<<7 | x>>25 a += x<<7 | x>>25
// amd64:`ROLL\t[$]8` // amd64:`ROLL [$]8`
// arm:"MOVW\tR\\d+@>24" // arm:"MOVW R\\d+@>24"
// arm64:"RORW\t[$]24" // arm64:"RORW [$]24"
// s390x:"RLL\t[$]8" // s390x:"RLL [$]8"
// ppc64x:"ROTLW\t[$]8" // ppc64x:"ROTLW [$]8"
// loong64: "ROTR\t[$]24" // loong64: "ROTR [$]24"
// riscv64: "RORIW\t[$]24" // riscv64: "RORIW [$]24"
a += x<<8 + x>>24 a += x<<8 + x>>24
// amd64:"ROLL\t[$]9" // amd64:"ROLL [$]9"
// arm:"MOVW\tR\\d+@>23" // arm:"MOVW R\\d+@>23"
// arm64:"RORW\t[$]23" // arm64:"RORW [$]23"
// s390x:"RLL\t[$]9" // s390x:"RLL [$]9"
// ppc64x:"ROTLW\t[$]9" // ppc64x:"ROTLW [$]9"
// loong64: "ROTR\t[$]23" // loong64: "ROTR [$]23"
// riscv64: "RORIW\t[$]23" // riscv64: "RORIW [$]23"
a += x<<9 ^ x>>23 a += x<<9 ^ x>>23
// amd64:"ROLL\t[$]10" // amd64:"ROLL [$]10"
// arm:"MOVW\tR\\d+@>22" // arm:"MOVW R\\d+@>22"
// arm64:"RORW\t[$]22" // arm64:"RORW [$]22"
// s390x:"RLL\t[$]10" // s390x:"RLL [$]10"
// ppc64x:"ROTLW\t[$]10" // ppc64x:"ROTLW [$]10"
// arm64:"RORW\t[$]22" // arm64:"RORW [$]22"
// s390x:"RLL\t[$]10" // s390x:"RLL [$]10"
// loong64: "ROTR\t[$]22" // loong64: "ROTR [$]22"
// riscv64: "RORIW\t[$]22" // riscv64: "RORIW [$]22"
a += bits.RotateLeft32(x, 10) a += bits.RotateLeft32(x, 10)
return a return a
@ -95,16 +95,16 @@ func rot32(x uint32) uint32 {
func rot16(x uint16) uint16 { func rot16(x uint16) uint16 {
var a uint16 var a uint16
// amd64:"ROLW\t[$]7" // amd64:"ROLW [$]7"
// riscv64: "OR","SLLI","SRLI",-"AND" // riscv64: "OR" "SLLI" "SRLI" -"AND"
a += x<<7 | x>>9 a += x<<7 | x>>9
// amd64:`ROLW\t[$]8` // amd64:`ROLW [$]8`
// riscv64: "OR","SLLI","SRLI",-"AND" // riscv64: "OR" "SLLI" "SRLI" -"AND"
a += x<<8 + x>>8 a += x<<8 + x>>8
// amd64:"ROLW\t[$]9" // amd64:"ROLW [$]9"
// riscv64: "OR","SLLI","SRLI",-"AND" // riscv64: "OR" "SLLI" "SRLI" -"AND"
a += x<<9 ^ x>>7 a += x<<9 ^ x>>7
return a return a
@ -113,16 +113,16 @@ func rot16(x uint16) uint16 {
func rot8(x uint8) uint8 { func rot8(x uint8) uint8 {
var a uint8 var a uint8
// amd64:"ROLB\t[$]5" // amd64:"ROLB [$]5"
// riscv64: "OR","SLLI","SRLI",-"AND" // riscv64: "OR" "SLLI" "SRLI" -"AND"
a += x<<5 | x>>3 a += x<<5 | x>>3
// amd64:`ROLB\t[$]6` // amd64:`ROLB [$]6`
// riscv64: "OR","SLLI","SRLI",-"AND" // riscv64: "OR" "SLLI" "SRLI" -"AND"
a += x<<6 + x>>2 a += x<<6 + x>>2
// amd64:"ROLB\t[$]7" // amd64:"ROLB [$]7"
// riscv64: "OR","SLLI","SRLI",-"AND" // riscv64: "OR" "SLLI" "SRLI" -"AND"
a += x<<7 ^ x>>1 a += x<<7 ^ x>>1
return a return a
@ -137,18 +137,18 @@ func rot64nc(x uint64, z uint) uint64 {
z &= 63 z &= 63
// amd64:"ROLQ",-"AND" // amd64:"ROLQ" -"AND"
// arm64:"ROR","NEG",-"AND" // arm64:"ROR" "NEG" -"AND"
// ppc64x:"ROTL",-"NEG",-"AND" // ppc64x:"ROTL" -"NEG" -"AND"
// loong64: "ROTRV", -"AND" // loong64: "ROTRV", -"AND"
// riscv64: "ROL",-"AND" // riscv64: "ROL" -"AND"
a += x<<z | x>>(64-z) a += x<<z | x>>(64-z)
// amd64:"RORQ",-"AND" // amd64:"RORQ" -"AND"
// arm64:"ROR",-"NEG",-"AND" // arm64:"ROR" -"NEG" -"AND"
// ppc64x:"ROTL","NEG",-"AND" // ppc64x:"ROTL" "NEG" -"AND"
// loong64: "ROTRV", -"AND" // loong64: "ROTRV", -"AND"
// riscv64: "ROR",-"AND" // riscv64: "ROR" -"AND"
a += x>>z | x<<(64-z) a += x>>z | x<<(64-z)
return a return a
@ -159,18 +159,18 @@ func rot32nc(x uint32, z uint) uint32 {
z &= 31 z &= 31
// amd64:"ROLL",-"AND" // amd64:"ROLL" -"AND"
// arm64:"ROR","NEG",-"AND" // arm64:"ROR" "NEG" -"AND"
// ppc64x:"ROTLW",-"NEG",-"AND" // ppc64x:"ROTLW" -"NEG" -"AND"
// loong64: "ROTR", -"AND" // loong64: "ROTR", -"AND"
// riscv64: "ROLW",-"AND" // riscv64: "ROLW" -"AND"
a += x<<z | x>>(32-z) a += x<<z | x>>(32-z)
// amd64:"RORL",-"AND" // amd64:"RORL" -"AND"
// arm64:"ROR",-"NEG",-"AND" // arm64:"ROR" -"NEG" -"AND"
// ppc64x:"ROTLW","NEG",-"AND" // ppc64x:"ROTLW" "NEG" -"AND"
// loong64: "ROTR", -"AND" // loong64: "ROTR", -"AND"
// riscv64: "RORW",-"AND" // riscv64: "RORW" -"AND"
a += x>>z | x<<(32-z) a += x>>z | x<<(32-z)
return a return a
@ -181,12 +181,12 @@ func rot16nc(x uint16, z uint) uint16 {
z &= 15 z &= 15
// amd64:"ROLW",-"ANDQ" // amd64:"ROLW" -"ANDQ"
// riscv64: "OR","SLL","SRL",-"AND\t" // riscv64: "OR" "SLL" "SRL" -"AND "
a += x<<z | x>>(16-z) a += x<<z | x>>(16-z)
// amd64:"RORW",-"ANDQ" // amd64:"RORW" -"ANDQ"
// riscv64: "OR","SLL","SRL",-"AND\t" // riscv64: "OR" "SLL" "SRL" -"AND "
a += x>>z | x<<(16-z) a += x>>z | x<<(16-z)
return a return a
@ -197,12 +197,12 @@ func rot8nc(x uint8, z uint) uint8 {
z &= 7 z &= 7
// amd64:"ROLB",-"ANDQ" // amd64:"ROLB" -"ANDQ"
// riscv64: "OR","SLL","SRL",-"AND\t" // riscv64: "OR" "SLL" "SRL" -"AND "
a += x<<z | x>>(8-z) a += x<<z | x>>(8-z)
// amd64:"RORB",-"ANDQ" // amd64:"RORB" -"ANDQ"
// riscv64: "OR","SLL","SRL",-"AND\t" // riscv64: "OR" "SLL" "SRL" -"AND "
a += x>>z | x<<(8-z) a += x>>z | x<<(8-z)
return a return a
@ -210,14 +210,14 @@ func rot8nc(x uint8, z uint) uint8 {
// Issue 18254: rotate after inlining // Issue 18254: rotate after inlining
func f32(x uint32) uint32 { func f32(x uint32) uint32 {
// amd64:"ROLL\t[$]7" // amd64:"ROLL [$]7"
return rot32nc(x, 7) return rot32nc(x, 7)
} }
func doubleRotate(x uint64) uint64 { func doubleRotate(x uint64) uint64 {
x = (x << 5) | (x >> 59) x = (x << 5) | (x >> 59)
// amd64:"ROLQ\t[$]15" // amd64:"ROLQ [$]15"
// arm64:"ROR\t[$]49" // arm64:"ROR [$]49"
x = (x << 10) | (x >> 54) x = (x << 10) | (x >> 54)
return x return x
} }
@ -229,51 +229,51 @@ func doubleRotate(x uint64) uint64 {
func checkMaskedRotate32(a []uint32, r int) { func checkMaskedRotate32(a []uint32, r int) {
i := 0 i := 0
// ppc64x: "RLWNM\t[$]16, R[0-9]+, [$]8, [$]15, R[0-9]+" // ppc64x: "RLWNM [$]16, R[0-9]+, [$]8, [$]15, R[0-9]+"
a[i] = bits.RotateLeft32(a[i], 16) & 0xFF0000 a[i] = bits.RotateLeft32(a[i], 16) & 0xFF0000
i++ i++
// ppc64x: "RLWNM\t[$]16, R[0-9]+, [$]8, [$]15, R[0-9]+" // ppc64x: "RLWNM [$]16, R[0-9]+, [$]8, [$]15, R[0-9]+"
a[i] = bits.RotateLeft32(a[i]&0xFF, 16) a[i] = bits.RotateLeft32(a[i]&0xFF, 16)
i++ i++
// ppc64x: "RLWNM\t[$]4, R[0-9]+, [$]20, [$]27, R[0-9]+" // ppc64x: "RLWNM [$]4, R[0-9]+, [$]20, [$]27, R[0-9]+"
a[i] = bits.RotateLeft32(a[i], 4) & 0xFF0 a[i] = bits.RotateLeft32(a[i], 4) & 0xFF0
i++ i++
// ppc64x: "RLWNM\t[$]16, R[0-9]+, [$]24, [$]31, R[0-9]+" // ppc64x: "RLWNM [$]16, R[0-9]+, [$]24, [$]31, R[0-9]+"
a[i] = bits.RotateLeft32(a[i]&0xFF0000, 16) a[i] = bits.RotateLeft32(a[i]&0xFF0000, 16)
i++ i++
// ppc64x: "RLWNM\tR[0-9]+, R[0-9]+, [$]8, [$]15, R[0-9]+" // ppc64x: "RLWNM R[0-9]+, R[0-9]+, [$]8, [$]15, R[0-9]+"
a[i] = bits.RotateLeft32(a[i], r) & 0xFF0000 a[i] = bits.RotateLeft32(a[i], r) & 0xFF0000
i++ i++
// ppc64x: "RLWNM\tR[0-9]+, R[0-9]+, [$]16, [$]23, R[0-9]+" // ppc64x: "RLWNM R[0-9]+, R[0-9]+, [$]16, [$]23, R[0-9]+"
a[i] = bits.RotateLeft32(a[i], r) & 0xFF00 a[i] = bits.RotateLeft32(a[i], r) & 0xFF00
i++ i++
// ppc64x: "RLWNM\tR[0-9]+, R[0-9]+, [$]20, [$]11, R[0-9]+" // ppc64x: "RLWNM R[0-9]+, R[0-9]+, [$]20, [$]11, R[0-9]+"
a[i] = bits.RotateLeft32(a[i], r) & 0xFFF00FFF a[i] = bits.RotateLeft32(a[i], r) & 0xFFF00FFF
i++ i++
// ppc64x: "RLWNM\t[$]4, R[0-9]+, [$]20, [$]11, R[0-9]+" // ppc64x: "RLWNM [$]4, R[0-9]+, [$]20, [$]11, R[0-9]+"
a[i] = bits.RotateLeft32(a[i], 4) & 0xFFF00FFF a[i] = bits.RotateLeft32(a[i], 4) & 0xFFF00FFF
i++ i++
} }
// combined arithmetic and rotate on arm64 // combined arithmetic and rotate on arm64
func checkArithmeticWithRotate(a *[1000]uint64) { func checkArithmeticWithRotate(a *[1000]uint64) {
// arm64: "AND\tR[0-9]+@>51, R[0-9]+, R[0-9]+" // arm64: "AND R[0-9]+@>51, R[0-9]+, R[0-9]+"
a[2] = a[1] & bits.RotateLeft64(a[0], 13) a[2] = a[1] & bits.RotateLeft64(a[0], 13)
// arm64: "ORR\tR[0-9]+@>51, R[0-9]+, R[0-9]+" // arm64: "ORR R[0-9]+@>51, R[0-9]+, R[0-9]+"
a[5] = a[4] | bits.RotateLeft64(a[3], 13) a[5] = a[4] | bits.RotateLeft64(a[3], 13)
// arm64: "EOR\tR[0-9]+@>51, R[0-9]+, R[0-9]+" // arm64: "EOR R[0-9]+@>51, R[0-9]+, R[0-9]+"
a[8] = a[7] ^ bits.RotateLeft64(a[6], 13) a[8] = a[7] ^ bits.RotateLeft64(a[6], 13)
// arm64: "MVN\tR[0-9]+@>51, R[0-9]+" // arm64: "MVN R[0-9]+@>51, R[0-9]+"
a[10] = ^bits.RotateLeft64(a[9], 13) a[10] = ^bits.RotateLeft64(a[9], 13)
// arm64: "BIC\tR[0-9]+@>51, R[0-9]+, R[0-9]+" // arm64: "BIC R[0-9]+@>51, R[0-9]+, R[0-9]+"
a[13] = a[12] &^ bits.RotateLeft64(a[11], 13) a[13] = a[12] &^ bits.RotateLeft64(a[11], 13)
// arm64: "EON\tR[0-9]+@>51, R[0-9]+, R[0-9]+" // arm64: "EON R[0-9]+@>51, R[0-9]+, R[0-9]+"
a[16] = a[15] ^ ^bits.RotateLeft64(a[14], 13) a[16] = a[15] ^ ^bits.RotateLeft64(a[14], 13)
// arm64: "ORN\tR[0-9]+@>51, R[0-9]+, R[0-9]+" // arm64: "ORN R[0-9]+@>51, R[0-9]+, R[0-9]+"
a[19] = a[18] | ^bits.RotateLeft64(a[17], 13) a[19] = a[18] | ^bits.RotateLeft64(a[17], 13)
// arm64: "TST\tR[0-9]+@>51, R[0-9]+" // arm64: "TST R[0-9]+@>51, R[0-9]+"
if a[18]&bits.RotateLeft64(a[19], 13) == 0 { if a[18]&bits.RotateLeft64(a[19], 13) == 0 {
a[20] = 1 a[20] = 1
} }

View file

@ -8,8 +8,8 @@ package codegen
func f(n int) int { func f(n int) int {
r := 0 r := 0
// arm64:-"MOVD\t R" // arm64:-"MOVD R"
// amd64:-"LEAQ","INCQ" // amd64:-"LEAQ" "INCQ"
for i := range n { for i := range n {
r += i r += i
} }

View file

@ -10,7 +10,7 @@ func f() {
ch1 := make(chan int) ch1 := make(chan int)
ch2 := make(chan int) ch2 := make(chan int)
for { for {
// amd64:-`MOVQ\t[$]0, command-line-arguments..autotmp_3` // amd64:-`MOVQ [$]0, command-line-arguments..autotmp_3`
select { select {
case <-ch1: case <-ch1:
case <-ch2: case <-ch2:

View file

@ -13,57 +13,57 @@ package codegen
func lshConst64x64(v int64) int64 { func lshConst64x64(v int64) int64 {
// loong64:"SLLV" // loong64:"SLLV"
// ppc64x:"SLD" // ppc64x:"SLD"
// riscv64:"SLLI",-"AND",-"SLTIU" // riscv64:"SLLI" -"AND" -"SLTIU"
return v << uint64(33) return v << uint64(33)
} }
func rshConst64Ux64(v uint64) uint64 { func rshConst64Ux64(v uint64) uint64 {
// loong64:"SRLV" // loong64:"SRLV"
// ppc64x:"SRD" // ppc64x:"SRD"
// riscv64:"SRLI\t",-"AND",-"SLTIU" // riscv64:"SRLI " -"AND" -"SLTIU"
return v >> uint64(33) return v >> uint64(33)
} }
func rshConst64Ux64Overflow32(v uint32) uint64 { func rshConst64Ux64Overflow32(v uint32) uint64 {
// loong64:"MOVV\tR0,",-"SRL\t" // loong64:"MOVV R0," -"SRL "
// riscv64:"MOV\t\\$0,",-"SRL" // riscv64:"MOV [$]0," -"SRL"
return uint64(v) >> 32 return uint64(v) >> 32
} }
func rshConst64Ux64Overflow16(v uint16) uint64 { func rshConst64Ux64Overflow16(v uint16) uint64 {
// loong64:"MOVV\tR0,",-"SRLV" // loong64:"MOVV R0," -"SRLV"
// riscv64:"MOV\t\\$0,",-"SRL" // riscv64:"MOV [$]0," -"SRL"
return uint64(v) >> 16 return uint64(v) >> 16
} }
func rshConst64Ux64Overflow8(v uint8) uint64 { func rshConst64Ux64Overflow8(v uint8) uint64 {
// loong64:"MOVV\tR0,",-"SRLV" // loong64:"MOVV R0," -"SRLV"
// riscv64:"MOV\t\\$0,",-"SRL" // riscv64:"MOV [$]0," -"SRL"
return uint64(v) >> 8 return uint64(v) >> 8
} }
func rshConst64x64(v int64) int64 { func rshConst64x64(v int64) int64 {
// loong64:"SRAV" // loong64:"SRAV"
// ppc64x:"SRAD" // ppc64x:"SRAD"
// riscv64:"SRAI\t",-"OR",-"SLTIU" // riscv64:"SRAI " -"OR" -"SLTIU"
return v >> uint64(33) return v >> uint64(33)
} }
func rshConst64x64Overflow32(v int32) int64 { func rshConst64x64Overflow32(v int32) int64 {
// loong64:"SRA\t\\$31" // loong64:"SRA [$]31"
// riscv64:"SRAIW",-"SLLI",-"SRAI\t" // riscv64:"SRAIW" -"SLLI" -"SRAI "
return int64(v) >> 32 return int64(v) >> 32
} }
func rshConst64x64Overflow16(v int16) int64 { func rshConst64x64Overflow16(v int16) int64 {
// loong64:"SLLV\t\\$48","SRAV\t\\$63" // loong64:"SLLV [$]48" "SRAV [$]63"
// riscv64:"SLLI","SRAI",-"SRAIW" // riscv64:"SLLI" "SRAI" -"SRAIW"
return int64(v) >> 16 return int64(v) >> 16
} }
func rshConst64x64Overflow8(v int8) int64 { func rshConst64x64Overflow8(v int8) int64 {
// loong64:"SLLV\t\\$56","SRAV\t\\$63" // loong64:"SLLV [$]56" "SRAV [$]63"
// riscv64:"SLLI","SRAI",-"SRAIW" // riscv64:"SLLI" "SRAI" -"SRAIW"
return int64(v) >> 8 return int64(v) >> 8
} }
@ -78,84 +78,84 @@ func lshConst64x1(v int64) int64 {
} }
func lshConst32x64(v int32) int32 { func lshConst32x64(v int32) int32 {
// loong64:"SLL\t" // loong64:"SLL "
// ppc64x:"SLW" // ppc64x:"SLW"
// riscv64:"SLLI",-"AND",-"SLTIU", -"MOVW" // riscv64:"SLLI" -"AND" -"SLTIU", -"MOVW"
return v << uint64(29) return v << uint64(29)
} }
func rshConst32Ux64(v uint32) uint32 { func rshConst32Ux64(v uint32) uint32 {
// loong64:"SRL\t" // loong64:"SRL "
// ppc64x:"SRW" // ppc64x:"SRW"
// riscv64:"SRLIW",-"AND",-"SLTIU", -"MOVW" // riscv64:"SRLIW" -"AND" -"SLTIU", -"MOVW"
return v >> uint64(29) return v >> uint64(29)
} }
func rshConst32x64(v int32) int32 { func rshConst32x64(v int32) int32 {
// loong64:"SRA\t" // loong64:"SRA "
// ppc64x:"SRAW" // ppc64x:"SRAW"
// riscv64:"SRAIW",-"OR",-"SLTIU", -"MOVW" // riscv64:"SRAIW" -"OR" -"SLTIU", -"MOVW"
return v >> uint64(29) return v >> uint64(29)
} }
func lshConst64x32(v int64) int64 { func lshConst64x32(v int64) int64 {
// loong64:"SLLV" // loong64:"SLLV"
// ppc64x:"SLD" // ppc64x:"SLD"
// riscv64:"SLLI",-"AND",-"SLTIU" // riscv64:"SLLI" -"AND" -"SLTIU"
return v << uint32(33) return v << uint32(33)
} }
func rshConst64Ux32(v uint64) uint64 { func rshConst64Ux32(v uint64) uint64 {
// loong64:"SRLV" // loong64:"SRLV"
// ppc64x:"SRD" // ppc64x:"SRD"
// riscv64:"SRLI\t",-"AND",-"SLTIU" // riscv64:"SRLI " -"AND" -"SLTIU"
return v >> uint32(33) return v >> uint32(33)
} }
func rshConst64x32(v int64) int64 { func rshConst64x32(v int64) int64 {
// loong64:"SRAV" // loong64:"SRAV"
// ppc64x:"SRAD" // ppc64x:"SRAD"
// riscv64:"SRAI\t",-"OR",-"SLTIU" // riscv64:"SRAI " -"OR" -"SLTIU"
return v >> uint32(33) return v >> uint32(33)
} }
func lshConst32x1Add(x int32) int32 { func lshConst32x1Add(x int32) int32 {
// amd64:"SHLL\t[$]2" // amd64:"SHLL [$]2"
// loong64:"SLL\t[$]2" // loong64:"SLL [$]2"
// riscv64:"SLLI\t[$]2" // riscv64:"SLLI [$]2"
return (x + x) << 1 return (x + x) << 1
} }
func lshConst64x1Add(x int64) int64 { func lshConst64x1Add(x int64) int64 {
// amd64:"SHLQ\t[$]2" // amd64:"SHLQ [$]2"
// loong64:"SLLV\t[$]2" // loong64:"SLLV [$]2"
// riscv64:"SLLI\t[$]2" // riscv64:"SLLI [$]2"
return (x + x) << 1 return (x + x) << 1
} }
func lshConst32x2Add(x int32) int32 { func lshConst32x2Add(x int32) int32 {
// amd64:"SHLL\t[$]3" // amd64:"SHLL [$]3"
// loong64:"SLL\t[$]3" // loong64:"SLL [$]3"
// riscv64:"SLLI\t[$]3" // riscv64:"SLLI [$]3"
return (x + x) << 2 return (x + x) << 2
} }
func lshConst64x2Add(x int64) int64 { func lshConst64x2Add(x int64) int64 {
// amd64:"SHLQ\t[$]3" // amd64:"SHLQ [$]3"
// loong64:"SLLV\t[$]3" // loong64:"SLLV [$]3"
// riscv64:"SLLI\t[$]3" // riscv64:"SLLI [$]3"
return (x + x) << 2 return (x + x) << 2
} }
func lshConst32x31Add(x int32) int32 { func lshConst32x31Add(x int32) int32 {
// loong64:-"SLL\t","MOVV\tR0" // loong64:-"SLL " "MOVV R0"
// riscv64:-"SLLI","MOV\t[$]0" // riscv64:-"SLLI" "MOV [$]0"
return (x + x) << 31 return (x + x) << 31
} }
func lshConst64x63Add(x int64) int64 { func lshConst64x63Add(x int64) int64 {
// loong64:-"SLLV","MOVV\tR0" // loong64:-"SLLV" "MOVV R0"
// riscv64:-"SLLI","MOV\t[$]0" // riscv64:-"SLLI" "MOV [$]0"
return (x + x) << 63 return (x + x) << 63
} }
@ -164,121 +164,121 @@ func lshConst64x63Add(x int64) int64 {
// ------------------ // // ------------------ //
func lshMask64x64(v int64, s uint64) int64 { func lshMask64x64(v int64, s uint64) int64 {
// arm64:"LSL",-"AND" // arm64:"LSL" -"AND"
// loong64:"SLLV",-"AND" // loong64:"SLLV" -"AND"
// ppc64x:"RLDICL",-"ORN",-"ISEL" // ppc64x:"RLDICL" -"ORN" -"ISEL"
// riscv64:"SLL",-"AND\t",-"SLTIU" // riscv64:"SLL" -"AND " -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v << (s & 63) return v << (s & 63)
} }
func rshMask64Ux64(v uint64, s uint64) uint64 { func rshMask64Ux64(v uint64, s uint64) uint64 {
// arm64:"LSR",-"AND",-"CSEL" // arm64:"LSR" -"AND" -"CSEL"
// loong64:"SRLV",-"AND" // loong64:"SRLV" -"AND"
// ppc64x:"RLDICL",-"ORN",-"ISEL" // ppc64x:"RLDICL" -"ORN" -"ISEL"
// riscv64:"SRL\t",-"AND\t",-"SLTIU" // riscv64:"SRL " -"AND " -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v >> (s & 63) return v >> (s & 63)
} }
func rshMask64x64(v int64, s uint64) int64 { func rshMask64x64(v int64, s uint64) int64 {
// arm64:"ASR",-"AND",-"CSEL" // arm64:"ASR" -"AND" -"CSEL"
// loong64:"SRAV",-"AND" // loong64:"SRAV" -"AND"
// ppc64x:"RLDICL",-"ORN",-"ISEL" // ppc64x:"RLDICL" -"ORN" -"ISEL"
// riscv64:"SRA\t",-"OR",-"SLTIU" // riscv64:"SRA " -"OR" -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v >> (s & 63) return v >> (s & 63)
} }
func lshMask32x64(v int32, s uint64) int32 { func lshMask32x64(v int32, s uint64) int32 {
// arm64:"LSL",-"AND" // arm64:"LSL" -"AND"
// loong64:"SLL\t","AND","SGTU","MASKEQZ" // loong64:"SLL " "AND" "SGTU" "MASKEQZ"
// ppc64x:"ISEL",-"ORN" // ppc64x:"ISEL" -"ORN"
// riscv64:"SLL",-"AND\t",-"SLTIU" // riscv64:"SLL" -"AND " -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v << (s & 63) return v << (s & 63)
} }
func lsh5Mask32x64(v int32, s uint64) int32 { func lsh5Mask32x64(v int32, s uint64) int32 {
// loong64:"SLL\t",-"AND" // loong64:"SLL " -"AND"
return v << (s & 31) return v << (s & 31)
} }
func rshMask32Ux64(v uint32, s uint64) uint32 { func rshMask32Ux64(v uint32, s uint64) uint32 {
// arm64:"LSR",-"AND" // arm64:"LSR" -"AND"
// loong64:"SRL\t","AND","SGTU","MASKEQZ" // loong64:"SRL " "AND" "SGTU" "MASKEQZ"
// ppc64x:"ISEL",-"ORN" // ppc64x:"ISEL" -"ORN"
// riscv64:"SRLW","SLTIU","NEG","AND\t",-"SRL\t" // riscv64:"SRLW" "SLTIU" "NEG" "AND " -"SRL "
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v >> (s & 63) return v >> (s & 63)
} }
func rsh5Mask32Ux64(v uint32, s uint64) uint32 { func rsh5Mask32Ux64(v uint32, s uint64) uint32 {
// loong64:"SRL\t",-"AND" // loong64:"SRL " -"AND"
// riscv64:"SRLW",-"AND\t",-"SLTIU",-"SRL\t" // riscv64:"SRLW" -"AND " -"SLTIU" -"SRL "
return v >> (s & 31) return v >> (s & 31)
} }
func rshMask32x64(v int32, s uint64) int32 { func rshMask32x64(v int32, s uint64) int32 {
// arm64:"ASR",-"AND" // arm64:"ASR" -"AND"
// loong64:"SRA\t","AND","SGTU","SUBVU","OR" // loong64:"SRA " "AND" "SGTU" "SUBVU" "OR"
// ppc64x:"ISEL",-"ORN" // ppc64x:"ISEL" -"ORN"
// riscv64:"SRAW","OR","SLTIU" // riscv64:"SRAW" "OR" "SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v >> (s & 63) return v >> (s & 63)
} }
func rsh5Mask32x64(v int32, s uint64) int32 { func rsh5Mask32x64(v int32, s uint64) int32 {
// loong64:"SRA\t",-"AND" // loong64:"SRA " -"AND"
// riscv64:"SRAW",-"OR",-"SLTIU" // riscv64:"SRAW" -"OR" -"SLTIU"
return v >> (s & 31) return v >> (s & 31)
} }
func lshMask64x32(v int64, s uint32) int64 { func lshMask64x32(v int64, s uint32) int64 {
// arm64:"LSL",-"AND" // arm64:"LSL" -"AND"
// loong64:"SLLV",-"AND" // loong64:"SLLV" -"AND"
// ppc64x:"RLDICL",-"ORN" // ppc64x:"RLDICL" -"ORN"
// riscv64:"SLL",-"AND\t",-"SLTIU" // riscv64:"SLL" -"AND " -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v << (s & 63) return v << (s & 63)
} }
func rshMask64Ux32(v uint64, s uint32) uint64 { func rshMask64Ux32(v uint64, s uint32) uint64 {
// arm64:"LSR",-"AND",-"CSEL" // arm64:"LSR" -"AND" -"CSEL"
// loong64:"SRLV",-"AND" // loong64:"SRLV" -"AND"
// ppc64x:"RLDICL",-"ORN" // ppc64x:"RLDICL" -"ORN"
// riscv64:"SRL\t",-"AND\t",-"SLTIU" // riscv64:"SRL " -"AND " -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v >> (s & 63) return v >> (s & 63)
} }
func rshMask64x32(v int64, s uint32) int64 { func rshMask64x32(v int64, s uint32) int64 {
// arm64:"ASR",-"AND",-"CSEL" // arm64:"ASR" -"AND" -"CSEL"
// loong64:"SRAV",-"AND" // loong64:"SRAV" -"AND"
// ppc64x:"RLDICL",-"ORN",-"ISEL" // ppc64x:"RLDICL" -"ORN" -"ISEL"
// riscv64:"SRA\t",-"OR",-"SLTIU" // riscv64:"SRA " -"OR" -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v >> (s & 63) return v >> (s & 63)
} }
func lshMask64x32Ext(v int64, s int32) int64 { func lshMask64x32Ext(v int64, s int32) int64 {
// ppc64x:"RLDICL",-"ORN",-"ISEL" // ppc64x:"RLDICL" -"ORN" -"ISEL"
// riscv64:"SLL",-"AND\t",-"SLTIU" // riscv64:"SLL" -"AND " -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v << uint(s&63) return v << uint(s&63)
} }
func rshMask64Ux32Ext(v uint64, s int32) uint64 { func rshMask64Ux32Ext(v uint64, s int32) uint64 {
// ppc64x:"RLDICL",-"ORN",-"ISEL" // ppc64x:"RLDICL" -"ORN" -"ISEL"
// riscv64:"SRL\t",-"AND\t",-"SLTIU" // riscv64:"SRL " -"AND " -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v >> uint(s&63) return v >> uint(s&63)
} }
func rshMask64x32Ext(v int64, s int32) int64 { func rshMask64x32Ext(v int64, s int32) int64 {
// ppc64x:"RLDICL",-"ORN",-"ISEL" // ppc64x:"RLDICL" -"ORN" -"ISEL"
// riscv64:"SRA\t",-"OR",-"SLTIU" // riscv64:"SRA " -"OR" -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
return v >> uint(s&63) return v >> uint(s&63)
} }
@ -316,10 +316,10 @@ func lshSignedMasked(v8 int8, v16 int16, v32 int32, v64 int64, x int) {
func lshGuarded64(v int64, s uint) int64 { func lshGuarded64(v int64, s uint) int64 {
if s < 64 { if s < 64 {
// riscv64:"SLL",-"AND",-"SLTIU" // riscv64:"SLL" -"AND" -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
// wasm:-"Select",-".*LtU" // wasm:-"Select" -".*LtU"
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
return v << s return v << s
} }
panic("shift too large") panic("shift too large")
@ -327,10 +327,10 @@ func lshGuarded64(v int64, s uint) int64 {
func rshGuarded64U(v uint64, s uint) uint64 { func rshGuarded64U(v uint64, s uint) uint64 {
if s < 64 { if s < 64 {
// riscv64:"SRL\t",-"AND",-"SLTIU" // riscv64:"SRL " -"AND" -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
// wasm:-"Select",-".*LtU" // wasm:-"Select" -".*LtU"
// arm64:"LSR",-"CSEL" // arm64:"LSR" -"CSEL"
return v >> s return v >> s
} }
panic("shift too large") panic("shift too large")
@ -338,10 +338,10 @@ func rshGuarded64U(v uint64, s uint) uint64 {
func rshGuarded64(v int64, s uint) int64 { func rshGuarded64(v int64, s uint) int64 {
if s < 64 { if s < 64 {
// riscv64:"SRA\t",-"OR",-"SLTIU" // riscv64:"SRA " -"OR" -"SLTIU"
// s390x:-"RISBGZ",-"AND",-"LOCGR" // s390x:-"RISBGZ" -"AND" -"LOCGR"
// wasm:-"Select",-".*LtU" // wasm:-"Select" -".*LtU"
// arm64:"ASR",-"CSEL" // arm64:"ASR" -"CSEL"
return v >> s return v >> s
} }
panic("shift too large") panic("shift too large")
@ -349,19 +349,19 @@ func rshGuarded64(v int64, s uint) int64 {
func provedUnsignedShiftLeft(val64 uint64, val32 uint32, val16 uint16, val8 uint8, shift int) (r1 uint64, r2 uint32, r3 uint16, r4 uint8) { func provedUnsignedShiftLeft(val64 uint64, val32 uint32, val16 uint16, val8 uint8, shift int) (r1 uint64, r2 uint32, r3 uint16, r4 uint8) {
if shift >= 0 && shift < 64 { if shift >= 0 && shift < 64 {
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
r1 = val64 << shift r1 = val64 << shift
} }
if shift >= 0 && shift < 32 { if shift >= 0 && shift < 32 {
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
r2 = val32 << shift r2 = val32 << shift
} }
if shift >= 0 && shift < 16 { if shift >= 0 && shift < 16 {
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
r3 = val16 << shift r3 = val16 << shift
} }
if shift >= 0 && shift < 8 { if shift >= 0 && shift < 8 {
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
r4 = val8 << shift r4 = val8 << shift
} }
return r1, r2, r3, r4 return r1, r2, r3, r4
@ -369,19 +369,19 @@ func provedUnsignedShiftLeft(val64 uint64, val32 uint32, val16 uint16, val8 uint
func provedSignedShiftLeft(val64 int64, val32 int32, val16 int16, val8 int8, shift int) (r1 int64, r2 int32, r3 int16, r4 int8) { func provedSignedShiftLeft(val64 int64, val32 int32, val16 int16, val8 int8, shift int) (r1 int64, r2 int32, r3 int16, r4 int8) {
if shift >= 0 && shift < 64 { if shift >= 0 && shift < 64 {
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
r1 = val64 << shift r1 = val64 << shift
} }
if shift >= 0 && shift < 32 { if shift >= 0 && shift < 32 {
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
r2 = val32 << shift r2 = val32 << shift
} }
if shift >= 0 && shift < 16 { if shift >= 0 && shift < 16 {
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
r3 = val16 << shift r3 = val16 << shift
} }
if shift >= 0 && shift < 8 { if shift >= 0 && shift < 8 {
// arm64:"LSL",-"CSEL" // arm64:"LSL" -"CSEL"
r4 = val8 << shift r4 = val8 << shift
} }
return r1, r2, r3, r4 return r1, r2, r3, r4
@ -389,19 +389,19 @@ func provedSignedShiftLeft(val64 int64, val32 int32, val16 int16, val8 int8, shi
func provedUnsignedShiftRight(val64 uint64, val32 uint32, val16 uint16, val8 uint8, shift int) (r1 uint64, r2 uint32, r3 uint16, r4 uint8) { func provedUnsignedShiftRight(val64 uint64, val32 uint32, val16 uint16, val8 uint8, shift int) (r1 uint64, r2 uint32, r3 uint16, r4 uint8) {
if shift >= 0 && shift < 64 { if shift >= 0 && shift < 64 {
// arm64:"LSR",-"CSEL" // arm64:"LSR" -"CSEL"
r1 = val64 >> shift r1 = val64 >> shift
} }
if shift >= 0 && shift < 32 { if shift >= 0 && shift < 32 {
// arm64:"LSR",-"CSEL" // arm64:"LSR" -"CSEL"
r2 = val32 >> shift r2 = val32 >> shift
} }
if shift >= 0 && shift < 16 { if shift >= 0 && shift < 16 {
// arm64:"LSR",-"CSEL" // arm64:"LSR" -"CSEL"
r3 = val16 >> shift r3 = val16 >> shift
} }
if shift >= 0 && shift < 8 { if shift >= 0 && shift < 8 {
// arm64:"LSR",-"CSEL" // arm64:"LSR" -"CSEL"
r4 = val8 >> shift r4 = val8 >> shift
} }
return r1, r2, r3, r4 return r1, r2, r3, r4
@ -409,19 +409,19 @@ func provedUnsignedShiftRight(val64 uint64, val32 uint32, val16 uint16, val8 uin
func provedSignedShiftRight(val64 int64, val32 int32, val16 int16, val8 int8, shift int) (r1 int64, r2 int32, r3 int16, r4 int8) { func provedSignedShiftRight(val64 int64, val32 int32, val16 int16, val8 int8, shift int) (r1 int64, r2 int32, r3 int16, r4 int8) {
if shift >= 0 && shift < 64 { if shift >= 0 && shift < 64 {
// arm64:"ASR",-"CSEL" // arm64:"ASR" -"CSEL"
r1 = val64 >> shift r1 = val64 >> shift
} }
if shift >= 0 && shift < 32 { if shift >= 0 && shift < 32 {
// arm64:"ASR",-"CSEL" // arm64:"ASR" -"CSEL"
r2 = val32 >> shift r2 = val32 >> shift
} }
if shift >= 0 && shift < 16 { if shift >= 0 && shift < 16 {
// arm64:"ASR",-"CSEL" // arm64:"ASR" -"CSEL"
r3 = val16 >> shift r3 = val16 >> shift
} }
if shift >= 0 && shift < 8 { if shift >= 0 && shift < 8 {
// arm64:"ASR",-"CSEL" // arm64:"ASR" -"CSEL"
r4 = val8 >> shift r4 = val8 >> shift
} }
return r1, r2, r3, r4 return r1, r2, r3, r4
@ -429,36 +429,36 @@ func provedSignedShiftRight(val64 int64, val32 int32, val16 int16, val8 int8, sh
func checkUnneededTrunc(tab *[100000]uint32, d uint64, v uint32, h uint16, b byte) (uint32, uint64) { func checkUnneededTrunc(tab *[100000]uint32, d uint64, v uint32, h uint16, b byte) (uint32, uint64) {
// ppc64x:-".*RLWINM",-".*RLDICR",".*CLRLSLDI" // ppc64x:-".*RLWINM" -".*RLDICR" ".*CLRLSLDI"
f := tab[byte(v)^b] f := tab[byte(v)^b]
// ppc64x:-".*RLWINM",-".*RLDICR",".*CLRLSLDI" // ppc64x:-".*RLWINM" -".*RLDICR" ".*CLRLSLDI"
f += tab[byte(v)&b] f += tab[byte(v)&b]
// ppc64x:-".*RLWINM",-".*RLDICR",".*CLRLSLDI" // ppc64x:-".*RLWINM" -".*RLDICR" ".*CLRLSLDI"
f += tab[byte(v)|b] f += tab[byte(v)|b]
// ppc64x:-".*RLWINM",-".*RLDICR",".*CLRLSLDI" // ppc64x:-".*RLWINM" -".*RLDICR" ".*CLRLSLDI"
f += tab[uint16(v)&h] f += tab[uint16(v)&h]
// ppc64x:-".*RLWINM",-".*RLDICR",".*CLRLSLDI" // ppc64x:-".*RLWINM" -".*RLDICR" ".*CLRLSLDI"
f += tab[uint16(v)^h] f += tab[uint16(v)^h]
// ppc64x:-".*RLWINM",-".*RLDICR",".*CLRLSLDI" // ppc64x:-".*RLWINM" -".*RLDICR" ".*CLRLSLDI"
f += tab[uint16(v)|h] f += tab[uint16(v)|h]
// ppc64x:-".*AND",-"RLDICR",".*CLRLSLDI" // ppc64x:-".*AND" -"RLDICR" ".*CLRLSLDI"
f += tab[v&0xff] f += tab[v&0xff]
// ppc64x:-".*AND",".*CLRLSLWI" // ppc64x:-".*AND" ".*CLRLSLWI"
f += 2 * uint32(uint16(d)) f += 2 * uint32(uint16(d))
// ppc64x:-".*AND",-"RLDICR",".*CLRLSLDI" // ppc64x:-".*AND" -"RLDICR" ".*CLRLSLDI"
g := 2 * uint64(uint32(d)) g := 2 * uint64(uint32(d))
return f, g return f, g
} }
func checkCombinedShifts(v8 uint8, v16 uint16, v32 uint32, x32 int32, v64 uint64) (uint8, uint16, uint32, uint64, int64) { func checkCombinedShifts(v8 uint8, v16 uint16, v32 uint32, x32 int32, v64 uint64) (uint8, uint16, uint32, uint64, int64) {
// ppc64x:-"AND","CLRLSLWI" // ppc64x:-"AND" "CLRLSLWI"
f := (v8 & 0xF) << 2 f := (v8 & 0xF) << 2
// ppc64x:"CLRLSLWI" // ppc64x:"CLRLSLWI"
f += byte(v16) << 3 f += byte(v16) << 3
// ppc64x:-"AND","CLRLSLWI" // ppc64x:-"AND" "CLRLSLWI"
g := (v16 & 0xFF) << 3 g := (v16 & 0xFF) << 3
// ppc64x:-"AND","CLRLSLWI" // ppc64x:-"AND" "CLRLSLWI"
h := (v32 & 0xFFFFF) << 2 h := (v32 & 0xFFFFF) << 2
// ppc64x:"CLRLSLDI" // ppc64x:"CLRLSLDI"
i := (v64 & 0xFFFFFFFF) << 5 i := (v64 & 0xFFFFFFFF) << 5
@ -466,7 +466,7 @@ func checkCombinedShifts(v8 uint8, v16 uint16, v32 uint32, x32 int32, v64 uint64
i += (v64 & 0xFFFFFFF) << 38 i += (v64 & 0xFFFFFFF) << 38
// ppc64x/power9:-"CLRLSLDI" // ppc64x/power9:-"CLRLSLDI"
i += (v64 & 0xFFFF00) << 10 i += (v64 & 0xFFFF00) << 10
// ppc64x/power9:-"SLD","EXTSWSLI" // ppc64x/power9:-"SLD" "EXTSWSLI"
j := int64(x32+32) * 8 j := int64(x32+32) * 8
return f, g, h, i, j return f, g, h, i, j
} }
@ -497,71 +497,71 @@ func checkWidenAfterShift(v int64, u uint64) (int64, uint64) {
func checkShiftAndMask32(v []uint32) { func checkShiftAndMask32(v []uint32) {
i := 0 i := 0
// ppc64x: "RLWNM\t[$]24, R[0-9]+, [$]12, [$]19, R[0-9]+" // ppc64x: "RLWNM [$]24, R[0-9]+, [$]12, [$]19, R[0-9]+"
v[i] = (v[i] & 0xFF00000) >> 8 v[i] = (v[i] & 0xFF00000) >> 8
i++ i++
// ppc64x: "RLWNM\t[$]26, R[0-9]+, [$]22, [$]29, R[0-9]+" // ppc64x: "RLWNM [$]26, R[0-9]+, [$]22, [$]29, R[0-9]+"
v[i] = (v[i] & 0xFF00) >> 6 v[i] = (v[i] & 0xFF00) >> 6
i++ i++
// ppc64x: "MOVW\tR0" // ppc64x: "MOVW R0"
v[i] = (v[i] & 0xFF) >> 8 v[i] = (v[i] & 0xFF) >> 8
i++ i++
// ppc64x: "MOVW\tR0" // ppc64x: "MOVW R0"
v[i] = (v[i] & 0xF000000) >> 28 v[i] = (v[i] & 0xF000000) >> 28
i++ i++
// ppc64x: "RLWNM\t[$]26, R[0-9]+, [$]24, [$]31, R[0-9]+" // ppc64x: "RLWNM [$]26, R[0-9]+, [$]24, [$]31, R[0-9]+"
v[i] = (v[i] >> 6) & 0xFF v[i] = (v[i] >> 6) & 0xFF
i++ i++
// ppc64x: "RLWNM\t[$]26, R[0-9]+, [$]12, [$]19, R[0-9]+" // ppc64x: "RLWNM [$]26, R[0-9]+, [$]12, [$]19, R[0-9]+"
v[i] = (v[i] >> 6) & 0xFF000 v[i] = (v[i] >> 6) & 0xFF000
i++ i++
// ppc64x: "MOVW\tR0" // ppc64x: "MOVW R0"
v[i] = (v[i] >> 20) & 0xFF000 v[i] = (v[i] >> 20) & 0xFF000
i++ i++
// ppc64x: "MOVW\tR0" // ppc64x: "MOVW R0"
v[i] = (v[i] >> 24) & 0xFF00 v[i] = (v[i] >> 24) & 0xFF00
i++ i++
} }
func checkMergedShifts32(a [256]uint32, b [256]uint64, u uint32, v uint32) { func checkMergedShifts32(a [256]uint32, b [256]uint64, u uint32, v uint32) {
// ppc64x: -"CLRLSLDI", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]29, R[0-9]+" // ppc64x: -"CLRLSLDI", "RLWNM [$]10, R[0-9]+, [$]22, [$]29, R[0-9]+"
a[0] = a[uint8(v>>24)] a[0] = a[uint8(v>>24)]
// ppc64x: -"CLRLSLDI", "RLWNM\t[$]11, R[0-9]+, [$]21, [$]28, R[0-9]+" // ppc64x: -"CLRLSLDI", "RLWNM [$]11, R[0-9]+, [$]21, [$]28, R[0-9]+"
b[0] = b[uint8(v>>24)] b[0] = b[uint8(v>>24)]
// ppc64x: -"CLRLSLDI", "RLWNM\t[$]15, R[0-9]+, [$]21, [$]28, R[0-9]+" // ppc64x: -"CLRLSLDI", "RLWNM [$]15, R[0-9]+, [$]21, [$]28, R[0-9]+"
b[1] = b[(v>>20)&0xFF] b[1] = b[(v>>20)&0xFF]
// ppc64x: -"SLD", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]28, R[0-9]+" // ppc64x: -"SLD", "RLWNM [$]10, R[0-9]+, [$]22, [$]28, R[0-9]+"
b[2] = b[v>>25] b[2] = b[v>>25]
} }
func checkMergedShifts64(a [256]uint32, b [256]uint64, c [256]byte, v uint64) { func checkMergedShifts64(a [256]uint32, b [256]uint64, c [256]byte, v uint64) {
// ppc64x: -"CLRLSLDI", "RLWNM\t[$]10, R[0-9]+, [$]22, [$]29, R[0-9]+" // ppc64x: -"CLRLSLDI", "RLWNM [$]10, R[0-9]+, [$]22, [$]29, R[0-9]+"
a[0] = a[uint8(v>>24)] a[0] = a[uint8(v>>24)]
// ppc64x: "SRD", "CLRLSLDI", -"RLWNM" // ppc64x: "SRD", "CLRLSLDI", -"RLWNM"
a[1] = a[uint8(v>>25)] a[1] = a[uint8(v>>25)]
// ppc64x: -"CLRLSLDI", "RLWNM\t[$]9, R[0-9]+, [$]23, [$]29, R[0-9]+" // ppc64x: -"CLRLSLDI", "RLWNM [$]9, R[0-9]+, [$]23, [$]29, R[0-9]+"
a[2] = a[v>>25&0x7F] a[2] = a[v>>25&0x7F]
// ppc64x: -"CLRLSLDI", "RLWNM\t[$]3, R[0-9]+, [$]29, [$]29, R[0-9]+" // ppc64x: -"CLRLSLDI", "RLWNM [$]3, R[0-9]+, [$]29, [$]29, R[0-9]+"
a[3] = a[(v>>31)&0x01] a[3] = a[(v>>31)&0x01]
// ppc64x: -"CLRLSLDI", "RLWNM\t[$]12, R[0-9]+, [$]21, [$]28, R[0-9]+" // ppc64x: -"CLRLSLDI", "RLWNM [$]12, R[0-9]+, [$]21, [$]28, R[0-9]+"
b[0] = b[uint8(v>>23)] b[0] = b[uint8(v>>23)]
// ppc64x: -"CLRLSLDI", "RLWNM\t[$]15, R[0-9]+, [$]21, [$]28, R[0-9]+" // ppc64x: -"CLRLSLDI", "RLWNM [$]15, R[0-9]+, [$]21, [$]28, R[0-9]+"
b[1] = b[(v>>20)&0xFF] b[1] = b[(v>>20)&0xFF]
// ppc64x: "RLWNM", -"SLD" // ppc64x: "RLWNM", -"SLD"
b[2] = b[((uint64((uint32(v) >> 21)) & 0x3f) << 4)] b[2] = b[((uint64((uint32(v) >> 21)) & 0x3f) << 4)]
// ppc64x: -"RLWNM" // ppc64x: -"RLWNM"
b[3] = (b[3] << 24) & 0xFFFFFF000000 b[3] = (b[3] << 24) & 0xFFFFFF000000
// ppc64x: "RLWNM\t[$]24, R[0-9]+, [$]0, [$]7," // ppc64x: "RLWNM [$]24, R[0-9]+, [$]0, [$]7,"
b[4] = (b[4] << 24) & 0xFF000000 b[4] = (b[4] << 24) & 0xFF000000
// ppc64x: "RLWNM\t[$]24, R[0-9]+, [$]0, [$]7," // ppc64x: "RLWNM [$]24, R[0-9]+, [$]0, [$]7,"
b[5] = (b[5] << 24) & 0xFF00000F b[5] = (b[5] << 24) & 0xFF00000F
// ppc64x: -"RLWNM" // ppc64x: -"RLWNM"
b[6] = (b[6] << 0) & 0xFF00000F b[6] = (b[6] << 0) & 0xFF00000F
// ppc64x: "RLWNM\t[$]4, R[0-9]+, [$]28, [$]31," // ppc64x: "RLWNM [$]4, R[0-9]+, [$]28, [$]31,"
b[7] = (b[7] >> 28) & 0xF b[7] = (b[7] >> 28) & 0xF
// ppc64x: "RLWNM\t[$]11, R[0-9]+, [$]10, [$]15" // ppc64x: "RLWNM [$]11, R[0-9]+, [$]10, [$]15"
c[0] = c[((v>>5)&0x3F)<<16] c[0] = c[((v>>5)&0x3F)<<16]
// ppc64x: "ANDCC\t[$]8064," // ppc64x: "ANDCC [$]8064,"
c[1] = c[((v>>7)&0x3F)<<7] c[1] = c[((v>>7)&0x3F)<<7]
} }
@ -572,7 +572,7 @@ func checkShiftMask(a uint32, b uint64, z []uint32, y []uint64) {
z[0] = uint32(uint8(a >> 5)) z[0] = uint32(uint8(a >> 5))
// ppc64x: -"MOVBZ", -"SRW", "RLWNM" // ppc64x: -"MOVBZ", -"SRW", "RLWNM"
z[1] = uint32(uint8((a >> 4) & 0x7e)) z[1] = uint32(uint8((a >> 4) & 0x7e))
// ppc64x: "RLWNM\t[$]25, R[0-9]+, [$]27, [$]29, R[0-9]+" // ppc64x: "RLWNM [$]25, R[0-9]+, [$]27, [$]29, R[0-9]+"
z[2] = uint32(uint8(a>>7)) & 0x1c z[2] = uint32(uint8(a>>7)) & 0x1c
// ppc64x: -"MOVWZ" // ppc64x: -"MOVWZ"
y[0] = uint64((a >> 6) & 0x1c) y[0] = uint64((a >> 6) & 0x1c)
@ -598,11 +598,11 @@ func check128bitShifts(x, y uint64, bits uint) (uint64, uint64) {
} }
func checkShiftToMask(u []uint64, s []int64) { func checkShiftToMask(u []uint64, s []int64) {
// amd64:-"SHR",-"SHL","ANDQ" // amd64:-"SHR" -"SHL" "ANDQ"
u[0] = u[0] >> 5 << 5 u[0] = u[0] >> 5 << 5
// amd64:-"SAR",-"SHL","ANDQ" // amd64:-"SAR" -"SHL" "ANDQ"
s[0] = s[0] >> 5 << 5 s[0] = s[0] >> 5 << 5
// amd64:-"SHR",-"SHL","ANDQ" // amd64:-"SHR" -"SHL" "ANDQ"
u[1] = u[1] << 5 >> 5 u[1] = u[1] << 5 >> 5
} }
@ -611,13 +611,13 @@ func checkShiftToMask(u []uint64, s []int64) {
// //
func checkLeftShiftWithAddition(a int64, b int64) int64 { func checkLeftShiftWithAddition(a int64, b int64) int64 {
// riscv64/rva20u64: "SLLI","ADD" // riscv64/rva20u64: "SLLI" "ADD"
// riscv64/rva22u64,riscv64/rva23u64: "SH1ADD" // riscv64/rva22u64,riscv64/rva23u64: "SH1ADD"
a = a + b<<1 a = a + b<<1
// riscv64/rva20u64: "SLLI","ADD" // riscv64/rva20u64: "SLLI" "ADD"
// riscv64/rva22u64,riscv64/rva23u64: "SH2ADD" // riscv64/rva22u64,riscv64/rva23u64: "SH2ADD"
a = a + b<<2 a = a + b<<2
// riscv64/rva20u64: "SLLI","ADD" // riscv64/rva20u64: "SLLI" "ADD"
// riscv64/rva22u64,riscv64/rva23u64: "SH3ADD" // riscv64/rva22u64,riscv64/rva23u64: "SH3ADD"
a = a + b<<3 a = a + b<<3
return a return a
@ -631,7 +631,7 @@ func rsh64Uto32U(v uint64) uint32 {
x := uint32(v) x := uint32(v)
// riscv64:"MOVWU" // riscv64:"MOVWU"
if x > 8 { if x > 8 {
// riscv64:"SRLIW",-"MOVWU",-"SLLI" // riscv64:"SRLIW" -"MOVWU" -"SLLI"
x >>= 2 x >>= 2
} }
return x return x
@ -641,7 +641,7 @@ func rsh64Uto16U(v uint64) uint16 {
x := uint16(v) x := uint16(v)
// riscv64:"MOVHU" // riscv64:"MOVHU"
if x > 8 { if x > 8 {
// riscv64:"SLLI","SRLI" // riscv64:"SLLI" "SRLI"
x >>= 2 x >>= 2
} }
return x return x
@ -651,7 +651,7 @@ func rsh64Uto8U(v uint64) uint8 {
x := uint8(v) x := uint8(v)
// riscv64:"MOVBU" // riscv64:"MOVBU"
if x > 8 { if x > 8 {
// riscv64:"SLLI","SRLI" // riscv64:"SLLI" "SRLI"
x >>= 2 x >>= 2
} }
return x return x
@ -661,7 +661,7 @@ func rsh64to32(v int64) int32 {
x := int32(v) x := int32(v)
// riscv64:"MOVW" // riscv64:"MOVW"
if x > 8 { if x > 8 {
// riscv64:"SRAIW",-"MOVW",-"SLLI" // riscv64:"SRAIW" -"MOVW" -"SLLI"
x >>= 2 x >>= 2
} }
return x return x
@ -671,7 +671,7 @@ func rsh64to16(v int64) int16 {
x := int16(v) x := int16(v)
// riscv64:"MOVH" // riscv64:"MOVH"
if x > 8 { if x > 8 {
// riscv64:"SLLI","SRAI" // riscv64:"SLLI" "SRAI"
x >>= 2 x >>= 2
} }
return x return x
@ -681,7 +681,7 @@ func rsh64to8(v int64) int8 {
x := int8(v) x := int8(v)
// riscv64:"MOVB" // riscv64:"MOVB"
if x > 8 { if x > 8 {
// riscv64:"SLLI","SRAI" // riscv64:"SLLI" "SRAI"
x >>= 2 x >>= 2
} }
return x return x
@ -692,6 +692,6 @@ func rsh64to8(v int64) int8 {
// (There is still a negative shift test, but // (There is still a negative shift test, but
// no shift-too-big test.) // no shift-too-big test.)
func signedModShift(i int) int64 { func signedModShift(i int) int64 {
// arm64:-"CMP",-"CSEL" // arm64:-"CMP" -"CSEL"
return 1 << (i % 64) return 1 << (i % 64)
} }

View file

@ -46,7 +46,7 @@ func SliceExtensionConst(s []int) []int {
// amd64:-`.*runtime\.memclrNoHeapPointers` // amd64:-`.*runtime\.memclrNoHeapPointers`
// amd64:-`.*runtime\.makeslice` // amd64:-`.*runtime\.makeslice`
// amd64:-`.*runtime\.panicmakeslicelen` // amd64:-`.*runtime\.panicmakeslicelen`
// amd64:"MOVUPS\tX15" // amd64:"MOVUPS X15"
// loong64:-`.*runtime\.memclrNoHeapPointers` // loong64:-`.*runtime\.memclrNoHeapPointers`
// ppc64x:-`.*runtime\.memclrNoHeapPointers` // ppc64x:-`.*runtime\.memclrNoHeapPointers`
// ppc64x:-`.*runtime\.makeslice` // ppc64x:-`.*runtime\.makeslice`
@ -58,7 +58,7 @@ func SliceExtensionConstInt64(s []int) []int {
// amd64:-`.*runtime\.memclrNoHeapPointers` // amd64:-`.*runtime\.memclrNoHeapPointers`
// amd64:-`.*runtime\.makeslice` // amd64:-`.*runtime\.makeslice`
// amd64:-`.*runtime\.panicmakeslicelen` // amd64:-`.*runtime\.panicmakeslicelen`
// amd64:"MOVUPS\tX15" // amd64:"MOVUPS X15"
// loong64:-`.*runtime\.memclrNoHeapPointers` // loong64:-`.*runtime\.memclrNoHeapPointers`
// ppc64x:-`.*runtime\.memclrNoHeapPointers` // ppc64x:-`.*runtime\.memclrNoHeapPointers`
// ppc64x:-`.*runtime\.makeslice` // ppc64x:-`.*runtime\.makeslice`
@ -70,7 +70,7 @@ func SliceExtensionConstUint64(s []int) []int {
// amd64:-`.*runtime\.memclrNoHeapPointers` // amd64:-`.*runtime\.memclrNoHeapPointers`
// amd64:-`.*runtime\.makeslice` // amd64:-`.*runtime\.makeslice`
// amd64:-`.*runtime\.panicmakeslicelen` // amd64:-`.*runtime\.panicmakeslicelen`
// amd64:"MOVUPS\tX15" // amd64:"MOVUPS X15"
// loong64:-`.*runtime\.memclrNoHeapPointers` // loong64:-`.*runtime\.memclrNoHeapPointers`
// ppc64x:-`.*runtime\.memclrNoHeapPointers` // ppc64x:-`.*runtime\.memclrNoHeapPointers`
// ppc64x:-`.*runtime\.makeslice` // ppc64x:-`.*runtime\.makeslice`
@ -82,7 +82,7 @@ func SliceExtensionConstUint(s []int) []int {
// amd64:-`.*runtime\.memclrNoHeapPointers` // amd64:-`.*runtime\.memclrNoHeapPointers`
// amd64:-`.*runtime\.makeslice` // amd64:-`.*runtime\.makeslice`
// amd64:-`.*runtime\.panicmakeslicelen` // amd64:-`.*runtime\.panicmakeslicelen`
// amd64:"MOVUPS\tX15" // amd64:"MOVUPS X15"
// loong64:-`.*runtime\.memclrNoHeapPointers` // loong64:-`.*runtime\.memclrNoHeapPointers`
// ppc64x:-`.*runtime\.memclrNoHeapPointers` // ppc64x:-`.*runtime\.memclrNoHeapPointers`
// ppc64x:-`.*runtime\.makeslice` // ppc64x:-`.*runtime\.makeslice`
@ -352,12 +352,12 @@ func SliceNilCheck(s []int) {
// ---------------------- // // ---------------------- //
// See issue 21561 // See issue 21561
func InitSmallSliceLiteral() []int { func InitSmallSliceLiteral() []int {
// amd64:`MOVQ\t[$]42` // amd64:`MOVQ [$]42`
return []int{42} return []int{42}
} }
func InitNotSmallSliceLiteral() []int { func InitNotSmallSliceLiteral() []int {
// amd64:`LEAQ\t.*stmp_` // amd64:`LEAQ .*stmp_`
return []int{ return []int{
42, 42,
42, 42,
@ -413,7 +413,7 @@ func SliceWithConstCompare(a []int, b int) []int {
} }
func SliceWithSubtractBound(a []int, b int) []int { func SliceWithSubtractBound(a []int, b int) []int {
// ppc64x:"SUBC",-"NEG" // ppc64x:"SUBC" -"NEG"
return a[(3 - b):] return a[(3 - b):]
} }
@ -422,7 +422,7 @@ func SliceWithSubtractBound(a []int, b int) []int {
// --------------------------------------- // // --------------------------------------- //
func SliceAndIndex(a []int, b int) int { func SliceAndIndex(a []int, b int) int {
// arm64:"AND\tR[0-9]+->63","ADD\tR[0-9]+<<3" // arm64:"AND R[0-9]+->63" "ADD R[0-9]+<<3"
return a[b:][b] return a[b:][b]
} }
@ -445,12 +445,12 @@ func Slice0(p *struct{}, i int) []struct{} {
// --------------------------------------- // // --------------------------------------- //
func SlicePut(a []byte, c uint8) []byte { func SlicePut(a []byte, c uint8) []byte {
// arm64:`CBZ\tR1` // arm64:`CBZ R1`
a[0] = c a[0] = c
// arm64:`CMP\t\$1, R1` // arm64:`CMP \$1, R1`
a = a[1:] a = a[1:]
a[0] = c a[0] = c
// arm64:`CMP\t\$2, R1` // arm64:`CMP \$2, R1`
a = a[1:] a = a[1:]
a[0] = c a[0] = c
a = a[1:] a = a[1:]

View file

@ -7,16 +7,16 @@ package codegen
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
func booliface() interface{} { func booliface() interface{} {
// amd64:`LEAQ\truntime.staticuint64s\+8\(SB\)` // amd64:`LEAQ runtime.staticuint64s\+8\(SB\)`
return true return true
} }
func smallint8iface() interface{} { func smallint8iface() interface{} {
// amd64:`LEAQ\truntime.staticuint64s\+2024\(SB\)` // amd64:`LEAQ runtime.staticuint64s\+2024\(SB\)`
return int8(-3) return int8(-3)
} }
func smalluint8iface() interface{} { func smalluint8iface() interface{} {
// amd64:`LEAQ\truntime.staticuint64s\+24\(SB\)` // amd64:`LEAQ runtime.staticuint64s\+24\(SB\)`
return uint8(3) return uint8(3)
} }

View file

@ -16,13 +16,13 @@ import (
// Check that stack stores are optimized away. // Check that stack stores are optimized away.
// 386:"TEXT\t.*, [$]0-" // 386:"TEXT .*, [$]0-"
// amd64:"TEXT\t.*, [$]0-" // amd64:"TEXT .*, [$]0-"
// arm:"TEXT\t.*, [$]-4-" // arm:"TEXT .*, [$]-4-"
// arm64:"TEXT\t.*, [$]0-" // arm64:"TEXT .*, [$]0-"
// mips:"TEXT\t.*, [$]-4-" // mips:"TEXT .*, [$]-4-"
// ppc64x:"TEXT\t.*, [$]0-" // ppc64x:"TEXT .*, [$]0-"
// s390x:"TEXT\t.*, [$]0-" // s390x:"TEXT .*, [$]0-"
func StackStore() int { func StackStore() int {
var x int var x int
return *(&x) return *(&x)
@ -35,13 +35,13 @@ type T struct {
// Check that large structs are cleared directly (issue #24416). // Check that large structs are cleared directly (issue #24416).
// 386:"TEXT\t.*, [$]0-" // 386:"TEXT .*, [$]0-"
// amd64:"TEXT\t.*, [$]0-" // amd64:"TEXT .*, [$]0-"
// arm:"TEXT\t.*, [$]0-" (spills return address) // arm:"TEXT .*, [$]0-" (spills return address)
// arm64:"TEXT\t.*, [$]0-" // arm64:"TEXT .*, [$]0-"
// mips:"TEXT\t.*, [$]-4-" // mips:"TEXT .*, [$]-4-"
// ppc64x:"TEXT\t.*, [$]0-" // ppc64x:"TEXT .*, [$]0-"
// s390x:"TEXT\t.*, [$]0-" // s390x:"TEXT .*, [$]0-"
func ZeroLargeStruct(x *T) { func ZeroLargeStruct(x *T) {
t := T{} t := T{}
*x = t *x = t
@ -51,11 +51,11 @@ func ZeroLargeStruct(x *T) {
// Notes: // Notes:
// - 386 fails due to spilling a register // - 386 fails due to spilling a register
// amd64:"TEXT\t.*, [$]0-" // amd64:"TEXT .*, [$]0-"
// arm:"TEXT\t.*, [$]0-" (spills return address) // arm:"TEXT .*, [$]0-" (spills return address)
// arm64:"TEXT\t.*, [$]0-" // arm64:"TEXT .*, [$]0-"
// ppc64x:"TEXT\t.*, [$]0-" // ppc64x:"TEXT .*, [$]0-"
// s390x:"TEXT\t.*, [$]0-" // s390x:"TEXT .*, [$]0-"
// Note: that 386 currently has to spill a register. // Note: that 386 currently has to spill a register.
func KeepWanted(t *T) { func KeepWanted(t *T) {
*t = T{A: t.A, B: t.B, C: t.C, D: t.D} *t = T{A: t.A, B: t.B, C: t.C, D: t.D}
@ -66,23 +66,23 @@ func KeepWanted(t *T) {
// Notes: // Notes:
// - 386 fails due to spilling a register // - 386 fails due to spilling a register
// - arm & mips fail due to softfloat calls // - arm & mips fail due to softfloat calls
// amd64:"TEXT\t.*, [$]0-" // amd64:"TEXT .*, [$]0-"
// arm64:"TEXT\t.*, [$]0-" // arm64:"TEXT .*, [$]0-"
// ppc64x:"TEXT\t.*, [$]0-" // ppc64x:"TEXT .*, [$]0-"
// s390x:"TEXT\t.*, [$]0-" // s390x:"TEXT .*, [$]0-"
func ArrayAdd64(a, b [4]float64) [4]float64 { func ArrayAdd64(a, b [4]float64) [4]float64 {
return [4]float64{a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]} return [4]float64{a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]}
} }
// Check that small array initialization avoids using the stack. // Check that small array initialization avoids using the stack.
// 386:"TEXT\t.*, [$]0-" // 386:"TEXT .*, [$]0-"
// amd64:"TEXT\t.*, [$]0-" // amd64:"TEXT .*, [$]0-"
// arm:"TEXT\t.*, [$]0-" (spills return address) // arm:"TEXT .*, [$]0-" (spills return address)
// arm64:"TEXT\t.*, [$]0-" // arm64:"TEXT .*, [$]0-"
// mips:"TEXT\t.*, [$]-4-" // mips:"TEXT .*, [$]-4-"
// ppc64x:"TEXT\t.*, [$]0-" // ppc64x:"TEXT .*, [$]0-"
// s390x:"TEXT\t.*, [$]0-" // s390x:"TEXT .*, [$]0-"
func ArrayInit(i, j int) [4]int { func ArrayInit(i, j int) [4]int {
return [4]int{i, 0, j, 0} return [4]int{i, 0, j, 0}
} }
@ -99,7 +99,7 @@ func check_asmout(b [2]int) int {
// Check that simple functions get promoted to nosplit, even when // Check that simple functions get promoted to nosplit, even when
// they might panic in various ways. See issue 31219. // they might panic in various ways. See issue 31219.
// amd64:"TEXT\t.*NOSPLIT.*" // amd64:"TEXT .*NOSPLIT.*"
func MightPanic(a []int, i, j, k, s int) { func MightPanic(a []int, i, j, k, s int) {
_ = a[i] // panicIndex _ = a[i] // panicIndex
_ = a[i:j] // panicSlice _ = a[i:j] // panicSlice
@ -113,7 +113,7 @@ func Defer() {
for i := 0; i < 2; i++ { for i := 0; i < 2; i++ {
defer func() {}() defer func() {}()
} }
// amd64:`CALL\truntime\.deferprocStack` // amd64:`CALL runtime\.deferprocStack`
defer func() {}() defer func() {}()
} }
@ -138,7 +138,7 @@ type mySlice struct {
cap int cap int
} }
// amd64:"TEXT\t.*, [$]0-" // amd64:"TEXT .*, [$]0-"
func sliceInit(base uintptr) []uintptr { func sliceInit(base uintptr) []uintptr {
const ptrSize = 8 const ptrSize = 8
size := uintptr(4096) size := uintptr(4096)
@ -150,7 +150,7 @@ func sliceInit(base uintptr) []uintptr {
elements, elements,
elements, elements,
} }
// amd64:-"POPQ",-"SP" // amd64:-"POPQ" -"SP"
return *(*[]uintptr)(unsafe.Pointer(&sl)) return *(*[]uintptr)(unsafe.Pointer(&sl))
} }
@ -171,6 +171,6 @@ func getp2() *[4]int {
// Store to an argument without read can be removed. // Store to an argument without read can be removed.
func storeArg(a [2]int) { func storeArg(a [2]int) {
// amd64:-`MOVQ\t\$123,.*\.a\+\d+\(SP\)` // amd64:-`MOVQ \$123,.*\.a\+\d+\(SP\)`
a[1] = 123 a[1] = 123
} }

View file

@ -22,8 +22,8 @@ func CountBytes(s []byte) int {
} }
func ToByteSlice() []byte { // Issue #24698 func ToByteSlice() []byte { // Issue #24698
// amd64:`LEAQ\ttype:\[3\]uint8` // amd64:`LEAQ type:\[3\]uint8`
// amd64:`CALL\truntime\.mallocTiny3` // amd64:`CALL runtime\.mallocTiny3`
// amd64:-`.*runtime.stringtoslicebyte` // amd64:-`.*runtime.stringtoslicebyte`
return []byte("foo") return []byte("foo")
} }
@ -37,56 +37,56 @@ func ConvertToByteSlice(a, b, c string) []byte {
func ConstantLoad() { func ConstantLoad() {
// 12592 = 0x3130 // 12592 = 0x3130
// 50 = 0x32 // 50 = 0x32
// amd64:`MOVW\t\$12592, \(`,`MOVB\t\$50, 2\(` // amd64:`MOVW \$12592, \(`,`MOVB \$50, 2\(`
// 386:`MOVW\t\$12592, \(`,`MOVB\t\$50, 2\(` // 386:`MOVW \$12592, \(`,`MOVB \$50, 2\(`
// arm:`MOVW\t\$48`,`MOVW\t\$49`,`MOVW\t\$50` // arm:`MOVW \$48`,`MOVW \$49`,`MOVW \$50`
// arm64:`MOVD\t\$12592`,`MOVD\t\$50` // arm64:`MOVD \$12592`,`MOVD \$50`
// loong64:`MOVV\t\$12592`,`MOVV\t\$50` // loong64:`MOVV \$12592`,`MOVV \$50`
// wasm:`I64Const\t\$12592`,`I64Store16\t\$0`,`I64Const\t\$50`,`I64Store8\t\$2` // wasm:`I64Const \$12592`,`I64Store16 \$0`,`I64Const \$50`,`I64Store8 \$2`
// mips64:`MOVV\t\$48`,`MOVV\t\$49`,`MOVV\t\$50` // mips64:`MOVV \$48`,`MOVV \$49`,`MOVV \$50`
bsink = []byte("012") bsink = []byte("012")
// 858927408 = 0x33323130 // 858927408 = 0x33323130
// 13620 = 0x3534 // 13620 = 0x3534
// amd64:`MOVL\t\$858927408`,`MOVW\t\$13620, 4\(` // amd64:`MOVL \$858927408`,`MOVW \$13620, 4\(`
// 386:`MOVL\t\$858927408`,`MOVW\t\$13620, 4\(` // 386:`MOVL \$858927408`,`MOVW \$13620, 4\(`
// arm64:`MOVD\t\$858927408`,`MOVD\t\$13620` // arm64:`MOVD \$858927408`,`MOVD \$13620`
// loong64:`MOVV\t\$858927408`,`MOVV\t\$13620` // loong64:`MOVV \$858927408`,`MOVV \$13620`
// wasm:`I64Const\t\$858927408`,`I64Store32\t\$0`,`I64Const\t\$13620`,`I64Store16\t\$4` // wasm:`I64Const \$858927408`,`I64Store32 \$0`,`I64Const \$13620`,`I64Store16 \$4`
bsink = []byte("012345") bsink = []byte("012345")
// 3978425819141910832 = 0x3736353433323130 // 3978425819141910832 = 0x3736353433323130
// 7306073769690871863 = 0x6564636261393837 // 7306073769690871863 = 0x6564636261393837
// amd64:`MOVQ\t\$3978425819141910832`,`MOVQ\t\$7306073769690871863` // amd64:`MOVQ \$3978425819141910832`,`MOVQ \$7306073769690871863`
// 386:`MOVL\t\$858927408, \(`,`DUFFCOPY` // 386:`MOVL \$858927408, \(`,`DUFFCOPY`
// arm64:`MOVD\t\$3978425819141910832`,`MOVD\t\$7306073769690871863`,`MOVD\t\$15` // arm64:`MOVD \$3978425819141910832`,`MOVD \$7306073769690871863`,`MOVD \$15`
// loong64:`MOVV\t\$3978425819141910832`,`MOVV\t\$7306073769690871863`,`MOVV\t\$15` // loong64:`MOVV \$3978425819141910832`,`MOVV \$7306073769690871863`,`MOVV \$15`
// wasm:`I64Const\t\$3978425819141910832`,`I64Store\t\$0`,`I64Const\t\$7306073769690871863`,`I64Store\t\$7` // wasm:`I64Const \$3978425819141910832`,`I64Store \$0`,`I64Const \$7306073769690871863`,`I64Store \$7`
bsink = []byte("0123456789abcde") bsink = []byte("0123456789abcde")
// 56 = 0x38 // 56 = 0x38
// amd64:`MOVQ\t\$3978425819141910832`,`MOVB\t\$56` // amd64:`MOVQ \$3978425819141910832`,`MOVB \$56`
// loong64:`MOVV\t\$3978425819141910832`,`MOVV\t\$56` // loong64:`MOVV \$3978425819141910832`,`MOVV \$56`
bsink = []byte("012345678") bsink = []byte("012345678")
// 14648 = 0x3938 // 14648 = 0x3938
// amd64:`MOVQ\t\$3978425819141910832`,`MOVW\t\$14648` // amd64:`MOVQ \$3978425819141910832`,`MOVW \$14648`
// loong64:`MOVV\t\$3978425819141910832`,`MOVV\t\$14648` // loong64:`MOVV \$3978425819141910832`,`MOVV \$14648`
bsink = []byte("0123456789") bsink = []byte("0123456789")
// 1650538808 = 0x62613938 // 1650538808 = 0x62613938
// amd64:`MOVQ\t\$3978425819141910832`,`MOVL\t\$1650538808` // amd64:`MOVQ \$3978425819141910832`,`MOVL \$1650538808`
// loong64:`MOVV\t\$3978425819141910832`,`MOVV\t\$1650538808` // loong64:`MOVV \$3978425819141910832`,`MOVV \$1650538808`
bsink = []byte("0123456789ab") bsink = []byte("0123456789ab")
} }
// self-equality is always true. See issue 60777. // self-equality is always true. See issue 60777.
func EqualSelf(s string) bool { func EqualSelf(s string) bool {
// amd64:`MOVL\t\$1, AX`,-`.*memequal.*` // amd64:`MOVL \$1, AX`,-`.*memequal.*`
return s == s return s == s
} }
func NotEqualSelf(s string) bool { func NotEqualSelf(s string) bool {
// amd64:`XORL\tAX, AX`,-`.*memequal.*` // amd64:`XORL AX, AX`,-`.*memequal.*`
return s != s return s != s
} }

View file

@ -20,7 +20,7 @@ type Z1 struct {
} }
func Zero1(t *Z1) { // Issue #18370 func Zero1(t *Z1) { // Issue #18370
// amd64:`MOVUPS\tX[0-9]+, \(.*\)`,`MOVQ\t\$0, 16\(.*\)` // amd64:`MOVUPS X[0-9]+, \(.*\)`,`MOVQ \$0, 16\(.*\)`
*t = Z1{} *t = Z1{}
} }
@ -29,7 +29,7 @@ type Z2 struct {
} }
func Zero2(t *Z2) { func Zero2(t *Z2) {
// amd64:`MOVUPS\tX[0-9]+, \(.*\)`,`MOVQ\t\$0, 16\(.*\)` // amd64:`MOVUPS X[0-9]+, \(.*\)`,`MOVQ \$0, 16\(.*\)`
// amd64:`.*runtime[.]gcWriteBarrier.*\(SB\)` // amd64:`.*runtime[.]gcWriteBarrier.*\(SB\)`
*t = Z2{} *t = Z2{}
} }
@ -43,6 +43,6 @@ type I1 struct {
} }
func Init1(p *I1) { // Issue #18872 func Init1(p *I1) { // Issue #18872
// amd64:`MOVQ\t[$]1`,`MOVQ\t[$]2`,`MOVQ\t[$]3`,`MOVQ\t[$]4` // amd64:`MOVQ [$]1`,`MOVQ [$]2`,`MOVQ [$]3`,`MOVQ [$]4`
*p = I1{1, 2, 3, 4} *p = I1{1, 2, 3, 4}
} }

View file

@ -137,8 +137,8 @@ type K interface {
// use a runtime call for type switches to interface types. // use a runtime call for type switches to interface types.
func interfaceSwitch(x any) int { func interfaceSwitch(x any) int {
// amd64:`CALL\truntime.interfaceSwitch`,`MOVL\t16\(AX\)`,`MOVQ\t8\(.*\)(.*\*8)` // amd64:`CALL runtime.interfaceSwitch`,`MOVL 16\(AX\)`,`MOVQ 8\(.*\)(.*\*8)`
// arm64:`CALL\truntime.interfaceSwitch`,`LDAR`,`MOVWU\t16\(R0\)`,`MOVD\t\(R.*\)\(R.*\)` // arm64:`CALL runtime.interfaceSwitch`,`LDAR`,`MOVWU 16\(R0\)`,`MOVD \(R.*\)\(R.*\)`
switch x.(type) { switch x.(type) {
case I: case I:
return 1 return 1
@ -150,8 +150,8 @@ func interfaceSwitch(x any) int {
} }
func interfaceSwitch2(x K) int { func interfaceSwitch2(x K) int {
// amd64:`CALL\truntime.interfaceSwitch`,`MOVL\t16\(AX\)`,`MOVQ\t8\(.*\)(.*\*8)` // amd64:`CALL runtime.interfaceSwitch`,`MOVL 16\(AX\)`,`MOVQ 8\(.*\)(.*\*8)`
// arm64:`CALL\truntime.interfaceSwitch`,`LDAR`,`MOVWU\t16\(R0\)`,`MOVD\t\(R.*\)\(R.*\)` // arm64:`CALL runtime.interfaceSwitch`,`LDAR`,`MOVWU 16\(R0\)`,`MOVD \(R.*\)\(R.*\)`
switch x.(type) { switch x.(type) {
case I: case I:
return 1 return 1
@ -163,8 +163,8 @@ func interfaceSwitch2(x K) int {
} }
func interfaceCast(x any) int { func interfaceCast(x any) int {
// amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(AX\)`,`MOVQ\t8\(.*\)(.*\*1)` // amd64:`CALL runtime.typeAssert`,`MOVL 16\(AX\)`,`MOVQ 8\(.*\)(.*\*1)`
// arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU\t16\(R0\)`,`MOVD\t\(R.*\)\(R.*\)` // arm64:`CALL runtime.typeAssert`,`LDAR`,`MOVWU 16\(R0\)`,`MOVD \(R.*\)\(R.*\)`
if _, ok := x.(I); ok { if _, ok := x.(I); ok {
return 3 return 3
} }
@ -172,8 +172,8 @@ func interfaceCast(x any) int {
} }
func interfaceCast2(x K) int { func interfaceCast2(x K) int {
// amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(AX\)`,`MOVQ\t8\(.*\)(.*\*1)` // amd64:`CALL runtime.typeAssert`,`MOVL 16\(AX\)`,`MOVQ 8\(.*\)(.*\*1)`
// arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU\t16\(R0\)`,`MOVD\t\(R.*\)\(R.*\)` // arm64:`CALL runtime.typeAssert`,`LDAR`,`MOVWU 16\(R0\)`,`MOVD \(R.*\)\(R.*\)`
if _, ok := x.(I); ok { if _, ok := x.(I); ok {
return 3 return 3
} }
@ -181,8 +181,8 @@ func interfaceCast2(x K) int {
} }
func interfaceConv(x IJ) I { func interfaceConv(x IJ) I {
// amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(AX\)`,`MOVQ\t8\(.*\)(.*\*1)` // amd64:`CALL runtime.typeAssert`,`MOVL 16\(AX\)`,`MOVQ 8\(.*\)(.*\*1)`
// arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU\t16\(R0\)`,`MOVD\t\(R.*\)\(R.*\)` // arm64:`CALL runtime.typeAssert`,`LDAR`,`MOVWU 16\(R0\)`,`MOVD \(R.*\)\(R.*\)`
return x return x
} }
@ -195,7 +195,7 @@ func stringSwitchInlineable(s string) {
} }
} }
func stringSwitch() { func stringSwitch() {
// amd64:-"CMP",-"CALL" // amd64:-"CMP" -"CALL"
// arm64:-"CMP",-"CALL" // arm64:-"CMP" -"CALL"
stringSwitchInlineable("foo") stringSwitchInlineable("foo")
} }

View file

@ -37,7 +37,7 @@ func swGYZ[T any](a Ig[T]) {
t.Y() t.Y()
case Iz: // amd64:-".*typeAssert" case Iz: // amd64:-".*typeAssert"
t.Z() t.Z()
case interface{ G() T }: // amd64:-".*typeAssert",-".*assertE2I\\(",".*assertE2I2" case interface{ G() T }: // amd64:-".*typeAssert" -".*assertE2I\\(" ".*assertE2I2"
t.G() t.G()
} }
} }
@ -46,7 +46,7 @@ func swE2G[T any](a any) {
switch t := a.(type) { switch t := a.(type) {
case Iy: case Iy:
t.Y() t.Y()
case Ig[T]: // amd64:-".*assertE2I\\(",".*assertE2I2" case Ig[T]: // amd64:-".*assertE2I\\(" ".*assertE2I2"
t.G() t.G()
} }
} }
@ -55,7 +55,7 @@ func swI2G[T any](a Ix) {
switch t := a.(type) { switch t := a.(type) {
case Iy: case Iy:
t.Y() t.Y()
case Ig[T]: // amd64:-".*assertE2I\\(",".*assertE2I2" case Ig[T]: // amd64:-".*assertE2I\\(" ".*assertE2I2"
t.G() t.G()
} }
} }

View file

@ -12,24 +12,24 @@ package codegen
func zeroSize() { func zeroSize() {
c := make(chan struct{}) c := make(chan struct{})
// amd64:`MOVQ\t\$0, command-line-arguments\.s\+56\(SP\)` // amd64:`MOVQ \$0, command-line-arguments\.s\+56\(SP\)`
var s *int var s *int
// force s to be a stack object, also use some (fixed) stack space // force s to be a stack object, also use some (fixed) stack space
g(&s, 1, 2, 3, 4, 5) g(&s, 1, 2, 3, 4, 5)
// amd64:`LEAQ\tcommand-line-arguments\..*\+55\(SP\)` // amd64:`LEAQ command-line-arguments\..*\+55\(SP\)`
c <- noliteral(struct{}{}) c <- noliteral(struct{}{})
} }
// Like zeroSize, but without hiding the zero-sized struct. // Like zeroSize, but without hiding the zero-sized struct.
func zeroSize2() { func zeroSize2() {
c := make(chan struct{}) c := make(chan struct{})
// amd64:`MOVQ\t\$0, command-line-arguments\.s\+48\(SP\)` // amd64:`MOVQ \$0, command-line-arguments\.s\+48\(SP\)`
var s *int var s *int
// force s to be a stack object, also use some (fixed) stack space // force s to be a stack object, also use some (fixed) stack space
g(&s, 1, 2, 3, 4, 5) g(&s, 1, 2, 3, 4, 5)
// amd64:`LEAQ\tcommand-line-arguments\..*stmp_\d+\(SB\)` // amd64:`LEAQ command-line-arguments\..*stmp_\d+\(SB\)`
c <- struct{}{} c <- struct{}{}
} }