]> Cypherpunks repositories - gostls13.git/commitdiff
test/codegen: port last stack and memcombining tests
authorAlberto Donizetti <alb.donizetti@gmail.com>
Wed, 11 Apr 2018 15:03:14 +0000 (17:03 +0200)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Wed, 11 Apr 2018 16:08:04 +0000 (16:08 +0000)
And delete them from asm_test.

Also delete an arm64 cmov test has been already ported to the new test
harness.

Change-Id: I4458721e1f512bc9ecbbe1c22a2c9c7109ad68fe
Reviewed-on: https://go-review.googlesource.com/106335
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
src/cmd/compile/internal/gc/asm_test.go
test/codegen/memcombine.go
test/codegen/stack.go

index 1b7c94837f48e875637b972ff8c8b45b2133b782..b71dc208897acb946eba142a236c85a5dd2016cd 100644 (file)
@@ -221,23 +221,6 @@ func (ats *asmTests) runGo(t *testing.T, args ...string) string {
 }
 
 var allAsmTests = []*asmTests{
-       {
-               arch:    "amd64",
-               os:      "linux",
-               imports: []string{"runtime"},
-               tests:   linuxAMD64Tests,
-       },
-       {
-               arch:    "arm",
-               os:      "linux",
-               imports: []string{"runtime"},
-               tests:   linuxARMTests,
-       },
-       {
-               arch:  "arm64",
-               os:    "linux",
-               tests: linuxARM64Tests,
-       },
        {
                arch:  "amd64",
                os:    "plan9",
@@ -245,69 +228,6 @@ var allAsmTests = []*asmTests{
        },
 }
 
-var linuxAMD64Tests = []*asmTest{
-       {
-               // make sure assembly output has matching offset and base register.
-               fn: `
-               func f72(a, b int) int {
-                       runtime.GC() // use some frame
-                       return b
-               }
-               `,
-               pos: []string{"b\\+24\\(SP\\)"},
-       },
-       // Make sure we don't put pointers in SSE registers across safe points.
-       {
-               fn: `
-               func $(p, q *[2]*int)  {
-                   a, b := p[0], p[1]
-                   runtime.GC()
-                   q[0], q[1] = a, b
-               }
-               `,
-               neg: []string{"MOVUPS"},
-       },
-}
-
-var linuxARMTests = []*asmTest{
-       {
-               // make sure assembly output has matching offset and base register.
-               fn: `
-               func f13(a, b int) int {
-                       runtime.GC() // use some frame
-                       return b
-               }
-               `,
-               pos: []string{"b\\+4\\(FP\\)"},
-       },
-}
-
-var linuxARM64Tests = []*asmTest{
-       // Load-combining tests.
-       {
-               fn: `
-               func $(s []byte) uint16 {
-                       return uint16(s[0]) | uint16(s[1]) << 8
-               }
-               `,
-               pos: []string{"\tMOVHU\t\\(R[0-9]+\\)"},
-               neg: []string{"ORR\tR[0-9]+<<8\t"},
-       },
-       {
-               // make sure that CSEL is emitted for conditional moves
-               fn: `
-               func f37(c int) int {
-                    x := c + 4
-                    if c < 0 {
-                       x = 182
-                    }
-                    return x
-               }
-               `,
-               pos: []string{"\tCSEL\t"},
-       },
-}
-
 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
index ec86a79317b62c0e357708b99e6ebfdc3d2e5d66..17323bd2ab2c381bcd3b4c676420257301313340 100644 (file)
@@ -6,7 +6,10 @@
 
 package codegen
 
-import "encoding/binary"
+import (
+       "encoding/binary"
+       "runtime"
+)
 
 var sink64 uint64
 var sink32 uint32
@@ -98,6 +101,11 @@ func load_be16_idx(b []byte, idx int) {
        sink16 = binary.BigEndian.Uint16(b[idx:])
 }
 
+func load_byte2_uint16(s []byte) uint16 {
+       // arm64:`MOVHU\t\(R[0-9]+\)`,-`ORR\tR[0-9]+<<8`
+       return uint16(s[0]) | uint16(s[1])<<8
+}
+
 // Check load combining across function calls.
 
 func fcall_byte(a, b byte) (byte, byte) {
@@ -132,6 +140,15 @@ func offsets_fold(_, a [20]byte) (b [20]byte) {
        return
 }
 
+// Make sure we don't put pointers in SSE registers across safe
+// points.
+
+func safe_point(p, q *[2]*int) {
+       a, b := p[0], p[1] // amd64:-`MOVUPS`
+       runtime.GC()
+       q[0], q[1] = a, b // amd64:-`MOVUPS`
+}
+
 // ------------- //
 //    Storing    //
 // ------------- //
index 987d6a5b1f9ffd41b99426466d8f05e4a6052105..da5ef24e13165f3cb322fd9062c65a8060934967 100644 (file)
@@ -6,6 +6,8 @@
 
 package codegen
 
+import "runtime"
+
 // This file contains code generation tests related to the use of the
 // stack.
 
@@ -22,3 +24,13 @@ func StackStore() int {
        var x int
        return *(&x)
 }
+
+// Check that assembly output has matching offset and base register
+// (Issue #21064).
+
+// amd64:`.*b\+24\(SP\)`
+// arm:`.*b\+4\(FP\)`
+func check_asmout(a, b int) int {
+       runtime.GC() // use some frame
+       return b
+}