From 3b0b8bcd6893742554c120bd3e30b350d3ec3fae Mon Sep 17 00:00:00 2001 From: Alberto Donizetti Date: Thu, 29 Mar 2018 10:40:45 +0200 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- src/cmd/compile/internal/gc/asm_test.go | 102 ------------------------ test/codegen/stack.go | 24 ++++++ 2 files changed, 24 insertions(+), 102 deletions(-) create mode 100644 test/codegen/stack.go diff --git a/src/cmd/compile/internal/gc/asm_test.go b/src/cmd/compile/internal/gc/asm_test.go index 0fe3d31734..b1a5531449 100644 --- a/src/cmd/compile/internal/gc/asm_test.go +++ b/src/cmd/compile/internal/gc/asm_test.go @@ -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 index 0000000000..987d6a5b1f --- /dev/null +++ b/test/codegen/stack.go @@ -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) +}