[clang] Add __builtin_bitreverseg (PR #179126)
Madhur Kumar via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 2 06:47:20 PST 2026
================
@@ -3683,6 +3683,16 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
return RValue::get(
emitBuiltinWithOneOverloadedType<1>(*this, E, Intrinsic::bswap));
}
+ case Builtin::BI__builtin_bitreverseg: {
+ Value *ArgValue = EmitScalarExpr(E->getArg(0));
+ llvm::IntegerType *IntTy = cast<llvm::IntegerType>(ArgValue->getType());
+ assert(IntTy &&
+ "LLVM's __builtin_bitreverseg only support integer variants");
+ if (IntTy->getBitWidth() == 1)
----------------
MadhurKumar004 wrote:
Yes it is covered in `clang/test/CodeGen/builtins.c` with a bool type inside test_buildin_bitreverseg function. If this is not enough should i add a test case with something like `unsinged _BitInt(1)`
https://github.com/llvm/llvm-project/pull/179126
More information about the cfe-commits
mailing list