]> Cypherpunks.ru repositories - gostls13.git/blob - test/codegen/mathbits.go
test: port bits.Len intrinsics tests to the new codegen harness
[gostls13.git] / test / codegen / mathbits.go
1 // asmcheck
2
3 // Copyright 2018 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package codegen
8
9 import "math/bits"
10
11 // --------------- //
12 //    bits.Len*    //
13 // --------------- //
14
15 func Len(n uint) int {
16         //amd64:"BSRQ"
17         //s390x:"FLOGR"
18         //arm:"CLZ" arm64:"CLZ"
19         //mips:"CLZ"
20         return bits.Len(n)
21 }
22
23 func Len64(n uint64) int {
24         //amd64:"BSRQ"
25         //s390x:"FLOGR"
26         //arm:"CLZ" arm64:"CLZ"
27         //mips:"CLZ"
28         return bits.Len64(n)
29 }
30
31 func Len32(n uint32) int {
32         //amd64:"BSRQ"
33         //s390x:"FLOGR"
34         //arm:"CLZ" arm64:"CLZ"
35         //mips:"CLZ"
36         return bits.Len32(n)
37 }
38
39 func Len16(n uint16) int {
40         //amd64:"BSRQ"
41         //s390x:"FLOGR"
42         //arm:"CLZ" arm64:"CLZ"
43         //mips:"CLZ"
44         return bits.Len16(n)
45 }
46
47 func Len8(n uint8) int {
48         //amd64 Len8 not intrisified
49         //s390x:"FLOGR"
50         //arm:"CLZ" arm64:"CLZ"
51         //mips:"CLZ"
52         return bits.Len8(n)
53 }