__builtin_cntlzdm
Purpose
Returns the number of leading consecutive 0-bits in the result returned when the first argument corresponds to 1-bits in the second argument.
Note: This built-in function
is valid only when the -mcpu option is set to target Power10 processors.
Syntax
d=__builtin_cntlzdm(a,b)
Result and argument types
The following table describes the types of the returned value and the function arguments.
| d | a | b |
|---|---|---|
| unsigned long long | unsigned long long | unsigned long long |
Result value
The result d is set to the number of consecutive 0-bits,
starting on the left, in a that corresponds to 1-bits in
b.
Here is an example for doubleword inputs:
In the above table, the first sixteen bits of
| Argument | Value |
|---|---|
a |
0x 0123 4567 89ab cdef |
b |
0x aaaa aaaa aaaa aaaa |
d |
5 |
a are 0000 0001 0010 0011. The first sixteen bits of b are 1010 1010 1010 1010. Applying the mask of
b to a means that we only consider the even-numbered bits
of a, which are 0 0 0 0 0 1 0
1. The number of leading zeros in this result is 5.