]> Cypherpunks repositories - gostls13.git/commitdiff
test/codegen: port all small memmove tests to codegen
authorAlberto Donizetti <alb.donizetti@gmail.com>
Wed, 14 Mar 2018 10:07:06 +0000 (11:07 +0100)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Wed, 14 Mar 2018 15:57:07 +0000 (15:57 +0000)
This change ports all the remaining tests checking that small memmoves
are replaced with MOVs to the new codegen test harness, and deletes
them from the asm_test file.

Change-Id: I01c94b441e27a5d61518035af62d62779dafeb56
Reviewed-on: https://go-review.googlesource.com/100476
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/movesmall.go

index b2148c7f29d303527d7d5f26188521e029bee30e..f2d37e69c996b55a06de5a2ba480f5495d374971 100644 (file)
@@ -630,36 +630,6 @@ var linuxAMD64Tests = []*asmTest{
                `,
                pos: []string{"\tANDQ\t\\$4095,"},
        },
-       {
-               // Test that small memmove was replaced with direct movs
-               fn: `
-                func $() {
-                       x := [...]byte{1, 2, 3, 4, 5, 6, 7}
-                       copy(x[1:], x[:])
-                }
-               `,
-               neg: []string{"memmove"},
-       },
-       {
-               // Same as above but with different size
-               fn: `
-                func $() {
-                       x := [...]byte{1, 2, 3, 4}
-                       copy(x[1:], x[:])
-                }
-               `,
-               neg: []string{"memmove"},
-       },
-       {
-               // Same as above but with different size
-               fn: `
-                func $() {
-                       x := [...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
-                       copy(x[1:], x[:])
-                }
-               `,
-               neg: []string{"memmove"},
-       },
        {
                fn: `
                func $(p int, q *int) bool {
@@ -765,26 +735,6 @@ var linux386Tests = []*asmTest{
                `,
                pos: []string{"\tANDL\t\\$4095,"},
        },
-       {
-               // Test that small memmove was replaced with direct movs
-               fn: `
-                func $() {
-                       x := [...]byte{1, 2, 3, 4, 5, 6, 7}
-                       copy(x[1:], x[:])
-                }
-               `,
-               neg: []string{"memmove"},
-       },
-       {
-               // Same as above but with different size
-               fn: `
-                func $() {
-                       x := [...]byte{1, 2, 3, 4}
-                       copy(x[1:], x[:])
-                }
-               `,
-               neg: []string{"memmove"},
-       },
 }
 
 var linuxS390XTests = []*asmTest{
index 9ad83a5b9ea91c70684972ba9f0d8e7c7047407f..e22c85948d4e0616abb981305c285329a212e68f 100644 (file)
@@ -6,7 +6,28 @@
 
 package codegen
 
-func movesmall() {
+// These tests check that memmoves calls on small data are replaced
+// with MOVs
+
+func movesmall4() {
+       x := [...]byte{1, 2, 3, 4}
+       // 386:-".*memmove"
+       // amd64:-".*memmove"
+       // arm:-".*memmove"
+       // arm64:-".*memmove"
+       copy(x[1:], x[:])
+}
+
+func movesmall7() {
        x := [...]byte{1, 2, 3, 4, 5, 6, 7}
-       copy(x[1:], x[:]) // arm64:-".*memmove"
+       // 386:-".*memmove"
+       // amd64:-".*memmove"
+       // arm64:-".*memmove"
+       copy(x[1:], x[:])
+}
+
+func movesmall16() {
+       x := [...]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
+       // amd64:-".*memmove"
+       copy(x[1:], x[:])
 }