1
0
mirror of https://github.com/golang/go synced 2024-11-12 07:00:21 -07:00

test/codegen: port stack-related tests to codegen

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>
This commit is contained in:
Alberto Donizetti 2018-03-29 10:40:45 +02:00
parent f63250238b
commit 3b0b8bcd68
2 changed files with 24 additions and 102 deletions

View 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

24
test/codegen/stack.go Normal file
View File

@ -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)
}