]> Cypherpunks repositories - gostls13.git/commitdiff
test/codegen: port stack-related tests to codegen
authorAlberto Donizetti <alb.donizetti@gmail.com>
Thu, 29 Mar 2018 08:40:45 +0000 (10:40 +0200)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Fri, 30 Mar 2018 08:08:06 +0000 (08:08 +0000)
And delete them from asm_test.

Change-Id: Idfe1249052d82d15b9c30b292c78656a0bf7b48d
Reviewed-on: https://go-review.googlesource.com/103315
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/asm_test.go
test/codegen/stack.go [new file with mode: 0644]

index 0fe3d31734af51fd032f883eabb8997bfab5cf38..b1a55314497714556e562926d3b2030533cd1fef 100644 (file)
@@ -227,16 +227,6 @@ var allAsmTests = []*asmTests{
                imports: []string{"runtime"},
                tests:   linuxAMD64Tests,
        },
-       {
-               arch:  "386",
-               os:    "linux",
-               tests: linux386Tests,
-       },
-       {
-               arch:  "s390x",
-               os:    "linux",
-               tests: linuxS390XTests,
-       },
        {
                arch:    "arm",
                os:      "linux",
@@ -248,21 +238,11 @@ var allAsmTests = []*asmTests{
                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",
@@ -345,42 +325,6 @@ var linuxAMD64Tests = []*asmTest{
                `,
                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{
@@ -394,16 +338,6 @@ 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{
@@ -460,16 +394,6 @@ 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: `
@@ -750,19 +674,6 @@ var linuxARM64Tests = []*asmTest{
        },
 }
 
-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
@@ -776,19 +687,6 @@ var linuxMIPS64Tests = []*asmTest{
        },
 }
 
-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
diff --git a/test/codegen/stack.go b/test/codegen/stack.go
new file mode 100644 (file)
index 0000000..987d6a5
--- /dev/null
@@ -0,0 +1,24 @@
+// 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)
+}