os: "linux",
tests: linuxARM64Tests,
},
- {
- arch: "mips64",
- os: "linux",
- tests: linuxMIPS64Tests,
- },
{
arch: "amd64",
os: "plan9",
}
var linuxAMD64Tests = []*asmTest{
- {
- fn: `
- func $(x int) int {
- return x * 96
- }
- `,
- pos: []string{"\tSHLQ\t\\$5,", "\tLEAQ\t\\(.*\\)\\(.*\\*2\\),"},
- },
{
// make sure assembly output has matching offset and base register.
fn: `
`,
pos: []string{"\tAND\t"},
},
- {
- // check that we don't emit comparisons for constant shift
- fn: `
-//go:nosplit
- func $(x int) int {
- return x << 17
- }
- `,
- pos: []string{"LSL\t\\$17"},
- neg: []string{"CMP"},
- },
// Load-combining tests.
{
fn: `
},
}
-var linuxMIPS64Tests = []*asmTest{
- {
- // check that we don't emit comparisons for constant shift
- fn: `
- func $(x int) int {
- return x << 17
- }
- `,
- pos: []string{"SLLV\t\\$17"},
- neg: []string{"SGT"},
- },
-}
-
var plan9AMD64Tests = []*asmTest{
// We should make sure that the compiler doesn't generate floating point
// instructions for non-float operations on Plan 9, because floating point
return a, b
}
+func Mul_96(n int) int {
+ // amd64:`SHLQ\t[$]5`,`LEAQ\t\(.*\)\(.*\*2\),`
+ return n * 96
+}
+
// Multiplications merging tests
func MergeMuls1(n int) int {
// arm64:"UBFX\t[$]1, R[0-9]+, [$]19",-"LSL",-"LSR"
return ((x & 0xfffff) << 3) >> 4
}
+
+// Check that we don't emit comparisons for constant shifts.
+//go:nosplit
+func shift_no_cmp(x int) int {
+ // arm64:`LSL\t[$]17`,-`CMP`
+ // mips64:`SLLV\t[$]17`,-`SGT`
+ return x << 17
+}