forked from OSchip/llvm-project
Add missing __builtin_bitreverse8
Also add documentation for bitreverse builtins llvm-svn: 264203
This commit is contained in:
parent
b565bdfb6e
commit
08087c52eb
|
@ -1505,6 +1505,33 @@ C-style cast applied to each element of the first argument.
|
|||
|
||||
Query for this feature with ``__has_builtin(__builtin_convertvector)``.
|
||||
|
||||
``__builtin_bitreverse``
|
||||
---------------------
|
||||
|
||||
* ``__builtin_bitreverse8``
|
||||
* ``__builtin_bitreverse16``
|
||||
* ``__builtin_bitreverse32``
|
||||
* ``__builtin_bitreverse64``
|
||||
|
||||
**Syntax**:
|
||||
|
||||
.. code-block:: c++
|
||||
__builtin_bitreverse32(x)
|
||||
|
||||
**Examples**:
|
||||
|
||||
.. code-block:: c++
|
||||
uint8_t rev_x = __builtin_bitreverse8(x);
|
||||
uint16_t rev_x = __builtin_bitreverse16(x);
|
||||
uint32_t rev_y = __builtin_bitreverse32(y);
|
||||
uint64_t rev_z = __builtin_bitreverse64(z);
|
||||
|
||||
**Description**:
|
||||
|
||||
The '``__builtin_bitreverse``' family of builtins is used to reverse
|
||||
the bitpattern of an integer value; for example ``0b10110110`` becomes
|
||||
``0b01101101``.
|
||||
|
||||
``__builtin_unreachable``
|
||||
-------------------------
|
||||
|
||||
|
|
|
@ -409,6 +409,7 @@ BUILTIN(__builtin_bswap16, "UsUs", "nc")
|
|||
BUILTIN(__builtin_bswap32, "UiUi", "nc")
|
||||
BUILTIN(__builtin_bswap64, "ULLiULLi", "nc")
|
||||
|
||||
BUILTIN(__builtin_bitreverse8, "UcUc", "nc")
|
||||
BUILTIN(__builtin_bitreverse16, "UsUs", "nc")
|
||||
BUILTIN(__builtin_bitreverse32, "UiUi", "nc")
|
||||
BUILTIN(__builtin_bitreverse64, "ULLiULLi", "nc")
|
||||
|
|
|
@ -681,6 +681,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
case Builtin::BI__builtin_bswap64: {
|
||||
return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::bswap));
|
||||
}
|
||||
case Builtin::BI__builtin_bitreverse8:
|
||||
case Builtin::BI__builtin_bitreverse16:
|
||||
case Builtin::BI__builtin_bitreverse32:
|
||||
case Builtin::BI__builtin_bitreverse64: {
|
||||
|
|
|
@ -117,9 +117,11 @@ int main() {
|
|||
P(bswap32, (N));
|
||||
P(bswap64, (N));
|
||||
|
||||
// CHECK: @llvm.bitreverse.i8
|
||||
// CHECK: @llvm.bitreverse.i16
|
||||
// CHECK: @llvm.bitreverse.i32
|
||||
// CHECK: @llvm.bitreverse.i64
|
||||
P(bitreverse8, (N));
|
||||
P(bitreverse16, (N));
|
||||
P(bitreverse32, (N));
|
||||
P(bitreverse64, (N));
|
||||
|
|
Loading…
Reference in New Issue