vec_cntlzm
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=vec_cntlzm(a,b)
Result and argument types
The following table describes the types of the returned value and the function arguments.
| d | a | b |
|---|---|---|
| vector unsigned long long | vector unsigned long long | vector unsigned long long |
Result value
Each element of d is set to the number of consecutive
0-bits, starting on the left, in the corresponding element of a that
corresponds to 1-bits in the corresponding element of b.
Here is an example for doubleword inputs:
Consider element 0 in the above table. The first sixteen bits of
| Argument | Element 0 | Element 1 |
|---|---|---|
a |
0x 0123 4567 89ab cdef | 0x 0123 4567 89ab cdef |
b |
0x aaaa aaaa aaaa aaaa | 0x cccc cccc cccc cccc |
d |
5 | 9 |
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 the compiler only
considers 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.