imports: []string{"runtime"},
tests: linuxAMD64Tests,
},
- {
- arch: "386",
- os: "linux",
- tests: linux386Tests,
- },
- {
- arch: "s390x",
- os: "linux",
- tests: linuxS390XTests,
- },
{
arch: "arm",
os: "linux",
os: "linux",
tests: linuxARM64Tests,
},
- {
- arch: "mips",
- os: "linux",
- tests: linuxMIPSTests,
- },
{
arch: "mips64",
os: "linux",
tests: linuxMIPS64Tests,
},
- {
- arch: "ppc64le",
- os: "linux",
- tests: linuxPPC64LETests,
- },
{
arch: "amd64",
os: "plan9",
`,
neg: []string{"MOVUPS"},
},
- {
- // check that stack store is optimized away
- fn: `
- func $() int {
- var x int
- return *(&x)
- }
- `,
- pos: []string{"TEXT\t.*, [$]0-8"},
- },
-}
-
-var linux386Tests = []*asmTest{
- {
- // check that stack store is optimized away
- fn: `
- func $() int {
- var x int
- return *(&x)
- }
- `,
- pos: []string{"TEXT\t.*, [$]0-4"},
- },
-}
-
-var linuxS390XTests = []*asmTest{
- {
- // check that stack store is optimized away
- fn: `
- func $() int {
- var x int
- return *(&x)
- }
- `,
- pos: []string{"TEXT\t.*, [$]0-8"},
- },
}
var linuxARMTests = []*asmTest{
`,
pos: []string{"b\\+4\\(FP\\)"},
},
- {
- // check that stack store is optimized away
- fn: `
- func $() int {
- var x int
- return *(&x)
- }
- `,
- pos: []string{"TEXT\t.*, [$]-4-4"},
- },
}
var linuxARM64Tests = []*asmTest{
`,
pos: []string{"\tMOVD\t\"\"\\.a\\+[0-9]+\\(FP\\), R[0-9]+", "\tMOVD\tR[0-9]+, \"\"\\.b\\+[0-9]+\\(FP\\)"},
},
- {
- // check that stack store is optimized away
- fn: `
- func $() int {
- var x int
- return *(&x)
- }
- `,
- pos: []string{"TEXT\t.*, [$]-8-8"},
- },
{
// check that we don't emit comparisons for constant shift
fn: `
},
}
-var linuxMIPSTests = []*asmTest{
- {
- // check that stack store is optimized away
- fn: `
- func $() int {
- var x int
- return *(&x)
- }
- `,
- pos: []string{"TEXT\t.*, [$]-4-4"},
- },
-}
-
var linuxMIPS64Tests = []*asmTest{
{
// check that we don't emit comparisons for constant shift
},
}
-var linuxPPC64LETests = []*asmTest{
- {
- // check that stack store is optimized away
- fn: `
- func $() int {
- var x int
- return *(&x)
- }
- `,
- pos: []string{"TEXT\t.*, [$]0-8"},
- },
-}
-
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
--- /dev/null
+// asmcheck
+
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package codegen
+
+// This file contains code generation tests related to the use of the
+// stack.
+
+// check that stack stores are optimized away
+
+// 386:"TEXT\t.*, [$]0-4"
+// amd64:"TEXT\t.*, [$]0-8"
+// arm:"TEXT\t.*, [$]-4-4"
+// arm64:"TEXT\t.*, [$]-8-8"
+// s390x:"TEXT\t.*, [$]0-8"
+// ppc64le:"TEXT\t.*, [$]0-8"
+// mips:"TEXT\t.*, [$]-4-4"
+func StackStore() int {
+ var x int
+ return *(&x)
+}