func @and = <{T: Type}> (lhs: T, rhs: T) -> T;
Bitwise and. T
must be integral
or a vector
of integral
.
func @or = <{T: Type}> (lhs: T, rhs: T) -> T;
Bitwise or. T
must be integral
or a vector
of integral
.
func @xor = <{T: Type}> (lhs: T, rhs: T) -> T;
Bitwise exclusive or. T
must be integral
or a vector
of integral
.
func @shl = <{T: Type, SHIFT_T: Type, MAY_WRAP: Bool}> (lhs: T, rhs: SHIFT_T) -> T;
Bitwise shift left. T
must be integral
or a vector
of integral
. SHIFT_T
must be unsigned with a width of ceil(log2(@bitWidth<{T}>()))
If T
is unsigned and MAY_WRAP
is false
, it is undefined behavior
if any 1
bits are shifted out.
If T
is signed and MAY_WRAP
is false
, it is undefined behavior
if the result is a different sign than lhs.
func @shlSat = <{T: Type, SHIFT_T: Type}> (lhs: T, rhs: T) -> T;
Bitwise saturating shift left. T
must be integral
or a vector
of integral
. SHIFT_T
must be unsigned integral
with a width of ceil(log2(@bitWidth<{T}>()))
.
func @shr = <{T: Type, SHIFT_T: Type, MAY_WRAP: Bool}> (lhs: T, rhs: SHIFT_T) -> T;
Bitwise shift right. T
must be integral
or a vector
of integral
. SHIFT_T
must be unsigned integral
with a width of ceil(log2(@bitWidth<{T}>()))
.
If MAY_WRAP
is false
, it is undefined behavior
if any 1
bits are shifted out.
func @bitReverse = <{T: Type}> (arg: T) -> T;
Reverse the bits. T
must be integral
or a vector
of integral
, and must have an even bitwidth
func @bSwap = <{T: Type}> (arg: T) -> T;
Swap the bytes . T
must be integral
or a vector
of integral
.
func @ctPop = <{T: Type}> (arg: T) -> T;
Count the number of one bits. T
must be integral
or a vector
of integral
.
func @ctlz = <{T: Type}> (arg: T) -> T;
Count number of leading zero bits. T
must be integral
or a vector
of integral
.
func @cttz = <{T: Type}> (arg: T) -> T;
Count number of trailing zero bits. T
must be integral
or a vector
of integral
.