aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/mathbits.go
blob: 98ee8f2a0b34f35e21de833f35e2502a517b22fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// asmcheck

// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package codegen

import "math/bits"

// ----------------------- //
//    bits.LeadingZeros    //
// ----------------------- //

func LeadingZeros(n uint) int {
	//amd64:"BSRQ"
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.LeadingZeros(n)
}

func LeadingZeros64(n uint64) int {
	//amd64:"BSRQ"
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.LeadingZeros64(n)
}

func LeadingZeros32(n uint32) int {
	//amd64:"BSRQ"
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.LeadingZeros32(n)
}

func LeadingZeros16(n uint16) int {
	//amd64:"BSRQ"
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.LeadingZeros16(n)
}

func LeadingZeros8(n uint8) int {
	//amd64 LeadingZeros8 not intrinsified (see ssa.go)
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.LeadingZeros8(n)
}

// --------------- //
//    bits.Len*    //
// --------------- //

func Len(n uint) int {
	//amd64:"BSRQ"
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.Len(n)
}

func Len64(n uint64) int {
	//amd64:"BSRQ"
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.Len64(n)
}

func Len32(n uint32) int {
	//amd64:"BSRQ"
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.Len32(n)
}

func Len16(n uint16) int {
	//amd64:"BSRQ"
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.Len16(n)
}

func Len8(n uint8) int {
	//amd64 Len8 not intrisified (see ssa.go)
	//s390x:"FLOGR"
	//arm:"CLZ" arm64:"CLZ"
	//mips:"CLZ"
	return bits.Len8(n)
}