]> Cypherpunks.ru repositories - gostls13.git/commitdiff
test/codegen: port math/bits.OnesCount tests to codegen
authorAlberto Donizetti <alb.donizetti@gmail.com>
Tue, 6 Mar 2018 11:55:41 +0000 (12:55 +0100)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Tue, 6 Mar 2018 17:53:00 +0000 (17:53 +0000)
And remove them from ssa_test.

Change-Id: I3efac5fea529bb0efa2dae32124530482ba5058e
Reviewed-on: https://go-review.googlesource.com/98815
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/asm_test.go
test/codegen/mathbits.go

index deafdf5894683ec6df780965a01dfbe331c2e26f..faee6d7c9381b2d7c886262a7177d9a8a03f02ef 100644 (file)
@@ -547,34 +547,6 @@ var linuxAMD64Tests = []*asmTest{
                `,
                pos: []string{"\tROLW\t\\$8,"},
        },
-       {
-               fn: `
-               func pop1(x uint64) int {
-                       return bits.OnesCount64(x)
-               }`,
-               pos: []string{"\tPOPCNTQ\t", "support_popcnt"},
-       },
-       {
-               fn: `
-               func pop2(x uint32) int {
-                       return bits.OnesCount32(x)
-               }`,
-               pos: []string{"\tPOPCNTL\t", "support_popcnt"},
-       },
-       {
-               fn: `
-               func pop3(x uint16) int {
-                       return bits.OnesCount16(x)
-               }`,
-               pos: []string{"\tPOPCNTL\t", "support_popcnt"},
-       },
-       {
-               fn: `
-               func pop4(x uint) int {
-                       return bits.OnesCount(x)
-               }`,
-               pos: []string{"\tPOPCNTQ\t", "support_popcnt"},
-       },
        // multiplication merging tests
        {
                fn: `
@@ -1492,30 +1464,6 @@ var linuxARM64Tests = []*asmTest{
                `,
                pos: []string{"TBZ"},
        },
-       {
-               fn: `
-               func $(x uint64) int {
-                       return bits.OnesCount64(x)
-               }
-               `,
-               pos: []string{"\tVCNT\t", "\tVUADDLV\t"},
-       },
-       {
-               fn: `
-               func $(x uint32) int {
-                       return bits.OnesCount32(x)
-               }
-               `,
-               pos: []string{"\tVCNT\t", "\tVUADDLV\t"},
-       },
-       {
-               fn: `
-               func $(x uint16) int {
-                       return bits.OnesCount16(x)
-               }
-               `,
-               pos: []string{"\tVCNT\t", "\tVUADDLV\t"},
-       },
        // Load-combining tests.
        {
                fn: `
index f930046a3b38377c9109ab4bb0272bc4644fc88a..a95c13caa9a48224532bba9efd0cc5245ff65174 100644 (file)
@@ -96,6 +96,34 @@ func Len8(n uint8) int {
        return bits.Len8(n)
 }
 
+// -------------------- //
+//    bits.OnesCount    //
+// -------------------- //
+
+func OnesCount(n uint) int {
+       //amd64:"POPCNTQ",".*support_popcnt"
+       //arm64:"VCNT","VUADDLV"
+       return bits.OnesCount(n)
+}
+
+func OnesCount64(n uint64) int {
+       //amd64:"POPCNTQ",".*support_popcnt"
+       //arm64:"VCNT","VUADDLV"
+       return bits.OnesCount64(n)
+}
+
+func OnesCount32(n uint32) int {
+       //amd64:"POPCNTL",".*support_popcnt"
+       //arm64:"VCNT","VUADDLV"
+       return bits.OnesCount32(n)
+}
+
+func OnesCount16(n uint16) int {
+       //amd64:"POPCNTL",".*support_popcnt"
+       //arm64:"VCNT","VUADDLV"
+       return bits.OnesCount16(n)
+}
+
 // ------------------------ //
 //    bits.TrailingZeros    //
 // ------------------------ //