]> Cypherpunks repositories - gostls13.git/commitdiff
test/codegen: port math/bits.TrailingZeros tests to codegen
authorAlberto Donizetti <alb.donizetti@gmail.com>
Tue, 6 Mar 2018 08:39:14 +0000 (09:39 +0100)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Tue, 6 Mar 2018 11:48:37 +0000 (11:48 +0000)
And remove them from ssa_test.

Change-Id: Ib5de5c0d908f23915e0847eca338cacf2fa5325b
Reviewed-on: https://go-review.googlesource.com/98795
Reviewed-by: Giovanni Bajo <rasky@develer.com>
src/cmd/compile/internal/gc/asm_test.go
test/codegen/mathbits.go

index 1e9bd20548fddc0d0ea675f1f3adcb0bb9578a12..deafdf5894683ec6df780965a01dfbe331c2e26f 100644 (file)
@@ -523,38 +523,6 @@ var linuxAMD64Tests = []*asmTest{
                pos: []string{"\tBTQ\t\\$60"},
        },
        // Intrinsic tests for math/bits
-       {
-               fn: `
-               func f41(a uint64) int {
-                       return bits.TrailingZeros64(a)
-               }
-               `,
-               pos: []string{"\tBSFQ\t", "\tMOVL\t\\$64,", "\tCMOVQEQ\t"},
-       },
-       {
-               fn: `
-               func f42(a uint32) int {
-                       return bits.TrailingZeros32(a)
-               }
-               `,
-               pos: []string{"\tBSFQ\t", "\tORQ\t[^$]", "\tMOVQ\t\\$4294967296,"},
-       },
-       {
-               fn: `
-               func f43(a uint16) int {
-                       return bits.TrailingZeros16(a)
-               }
-               `,
-               pos: []string{"\tBSFQ\t", "\tORQ\t\\$65536,"},
-       },
-       {
-               fn: `
-               func f44(a uint8) int {
-                       return bits.TrailingZeros8(a)
-               }
-               `,
-               pos: []string{"\tBSFQ\t", "\tORQ\t\\$256,"},
-       },
        {
                fn: `
                func f45(a uint64) uint64 {
@@ -1230,39 +1198,6 @@ var linuxS390XTests = []*asmTest{
                pos: []string{"\tFMSUBS\t"},
        },
        // Intrinsic tests for math/bits
-       {
-               fn: `
-               func f18(a uint64) int {
-                       return bits.TrailingZeros64(a)
-               }
-               `,
-               pos: []string{"\tFLOGR\t"},
-       },
-       {
-               fn: `
-               func f19(a uint32) int {
-                       return bits.TrailingZeros32(a)
-               }
-               `,
-               pos: []string{"\tFLOGR\t", "\tMOVWZ\t"},
-       },
-       {
-               fn: `
-               func f20(a uint16) int {
-                       return bits.TrailingZeros16(a)
-               }
-               `,
-               pos: []string{"\tFLOGR\t", "\tOR\t\\$65536,"},
-       },
-       {
-               fn: `
-               func f21(a uint8) int {
-                       return bits.TrailingZeros8(a)
-               }
-               `,
-               pos: []string{"\tFLOGR\t", "\tOR\t\\$256,"},
-       },
-       // Intrinsic tests for math/bits
        {
                fn: `
                func f22(a uint64) uint64 {
index 98ee8f2a0b34f35e21de833f35e2502a517b22fe..f930046a3b38377c9109ab4bb0272bc4644fc88a 100644 (file)
@@ -95,3 +95,37 @@ func Len8(n uint8) int {
        //mips:"CLZ"
        return bits.Len8(n)
 }
+
+// ------------------------ //
+//    bits.TrailingZeros    //
+// ------------------------ //
+
+func TrailingZeros(n uint) int {
+       //amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ"
+       //s390x:"FLOGR"
+       return bits.TrailingZeros(n)
+}
+
+func TrailingZeros64(n uint64) int {
+       //amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ"
+       //s390x:"FLOGR"
+       return bits.TrailingZeros64(n)
+}
+
+func TrailingZeros32(n uint32) int {
+       //amd64:"MOVQ\t\\$4294967296","ORQ\t[^$]","BSFQ"
+       //s390x:"FLOGR","MOVWZ"
+       return bits.TrailingZeros32(n)
+}
+
+func TrailingZeros16(n uint16) int {
+       //amd64:"BSFQ","ORQ\t\\$65536"
+       //s390x:"FLOGR","OR\t\\$65536"
+       return bits.TrailingZeros16(n)
+}
+
+func TrailingZeros8(n uint8) int {
+       //amd64:"BSFQ","ORQ\t\\$256"
+       //s390x:"FLOGR","OR\t\\$256"
+       return bits.TrailingZeros8(n)
+}