forked from OSchip/llvm-project
Generate code for the various __builtin_ctz functions.
llvm-svn: 46811
This commit is contained in:
parent
7422bce18a
commit
093f1a099f
|
@ -149,6 +149,20 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
|
|||
|
||||
return RValue::get(Result);
|
||||
}
|
||||
case Builtin::BI__builtin_ctz:
|
||||
case Builtin::BI__builtin_ctzl:
|
||||
case Builtin::BI__builtin_ctzll: {
|
||||
Value *ArgValue = EmitScalarExpr(E->getArg(0));
|
||||
|
||||
const llvm::Type *ArgType = ArgValue->getType();
|
||||
Value *F = CGM.getIntrinsic(Intrinsic::cttz, &ArgType, 1);
|
||||
|
||||
const llvm::Type *ResultType = ConvertType(E->getType());
|
||||
Value *Result = Builder.CreateCall(F, ArgValue, "tmp");
|
||||
if (Result->getType() != ResultType)
|
||||
Result = Builder.CreateIntCast(Result, ResultType, "cast");
|
||||
return RValue::get(Result);
|
||||
}
|
||||
case Builtin::BI__builtin_expect:
|
||||
return RValue::get(EmitScalarExpr(E->getArg(0)));
|
||||
case Builtin::BI__builtin_bswap32:
|
||||
|
|
Loading…
Reference in New Issue