diff options
Diffstat (limited to 'test/codegen/mathbits.go')
| -rw-r--r-- | test/codegen/mathbits.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index f930046a3b..a95c13caa9 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -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 // // ------------------------ // |
