]> Cypherpunks repositories - gostls13.git/commitdiff
test/codegen: port math/bits.ReverseBytes tests to codegen
authorAlberto Donizetti <alb.donizetti@gmail.com>
Tue, 6 Mar 2018 19:10:35 +0000 (20:10 +0100)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Tue, 6 Mar 2018 20:34:33 +0000 (20:34 +0000)
And remove them from ssa_test.

Change-Id: If767af662801219774d1bdb787c77edfa6067770
Reviewed-on: https://go-review.googlesource.com/98976
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/mathbits.go

index faee6d7c9381b2d7c886262a7177d9a8a03f02ef..0e39d0df3e559b2884a68dbdae38616ec4b2f247 100644 (file)
@@ -224,7 +224,7 @@ var allAsmTests = []*asmTests{
        {
                arch:    "amd64",
                os:      "linux",
-               imports: []string{"math/bits", "unsafe", "runtime"},
+               imports: []string{"unsafe", "runtime"},
                tests:   linuxAMD64Tests,
        },
        {
@@ -233,10 +233,9 @@ var allAsmTests = []*asmTests{
                tests: linux386Tests,
        },
        {
-               arch:    "s390x",
-               os:      "linux",
-               imports: []string{"math/bits"},
-               tests:   linuxS390XTests,
+               arch:  "s390x",
+               os:    "linux",
+               tests: linuxS390XTests,
        },
        {
                arch:    "arm",
@@ -245,10 +244,9 @@ var allAsmTests = []*asmTests{
                tests:   linuxARMTests,
        },
        {
-               arch:    "arm64",
-               os:      "linux",
-               imports: []string{"math/bits"},
-               tests:   linuxARM64Tests,
+               arch:  "arm64",
+               os:    "linux",
+               tests: linuxARM64Tests,
        },
        {
                arch:  "mips",
@@ -522,31 +520,6 @@ var linuxAMD64Tests = []*asmTest{
                `,
                pos: []string{"\tBTQ\t\\$60"},
        },
-       // Intrinsic tests for math/bits
-       {
-               fn: `
-               func f45(a uint64) uint64 {
-                       return bits.ReverseBytes64(a)
-               }
-               `,
-               pos: []string{"\tBSWAPQ\t"},
-       },
-       {
-               fn: `
-               func f46(a uint32) uint32 {
-                       return bits.ReverseBytes32(a)
-               }
-               `,
-               pos: []string{"\tBSWAPL\t"},
-       },
-       {
-               fn: `
-               func f47(a uint16) uint16 {
-                       return bits.ReverseBytes16(a)
-               }
-               `,
-               pos: []string{"\tROLW\t\\$8,"},
-       },
        // multiplication merging tests
        {
                fn: `
@@ -1169,23 +1142,6 @@ var linuxS390XTests = []*asmTest{
                `,
                pos: []string{"\tFMSUBS\t"},
        },
-       // Intrinsic tests for math/bits
-       {
-               fn: `
-               func f22(a uint64) uint64 {
-                       return bits.ReverseBytes64(a)
-               }
-               `,
-               pos: []string{"\tMOVDBR\t"},
-       },
-       {
-               fn: `
-               func f23(a uint32) uint32 {
-                       return bits.ReverseBytes32(a)
-               }
-               `,
-               pos: []string{"\tMOVWBR\t"},
-       },
        {
                // check that stack store is optimized away
                fn: `
@@ -1361,22 +1317,6 @@ var linuxARM64Tests = []*asmTest{
                pos: []string{"\tORN\t"},
                neg: []string{"\tORR\t"},
        },
-       {
-               fn: `
-               func f22(a uint64) uint64 {
-                       return bits.ReverseBytes64(a)
-               }
-               `,
-               pos: []string{"\tREV\t"},
-       },
-       {
-               fn: `
-               func f23(a uint32) uint32 {
-                       return bits.ReverseBytes32(a)
-               }
-               `,
-               pos: []string{"\tREVW\t"},
-       },
        {
                fn: `
                func f34(a uint64) uint64 {
index a95c13caa9a48224532bba9efd0cc5245ff65174..2185b535b9e924357e4bd295975b075de30a898d 100644 (file)
@@ -124,6 +124,36 @@ func OnesCount16(n uint16) int {
        return bits.OnesCount16(n)
 }
 
+// ----------------------- //
+//    bits.ReverseBytes    //
+// ----------------------- //
+
+func ReverseBytes(n uint) uint {
+       //amd64:"BSWAPQ"
+       //s390x:"MOVDBR"
+       //arm64:"REV"
+       return bits.ReverseBytes(n)
+}
+
+func ReverseBytes64(n uint64) uint64 {
+       //amd64:"BSWAPQ"
+       //s390x:"MOVDBR"
+       //arm64:"REV"
+       return bits.ReverseBytes64(n)
+}
+
+func ReverseBytes32(n uint32) uint32 {
+       //amd64:"BSWAPL"
+       //s390x:"MOVWBR"
+       //arm64:"REVW"
+       return bits.ReverseBytes32(n)
+}
+
+func ReverseBytes16(n uint16) uint16 {
+       //amd64:"ROLW"
+       return bits.ReverseBytes16(n)
+}
+
 // ------------------------ //
 //    bits.TrailingZeros    //
 // ------------------------ //