diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-01-28 18:42:57 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-01-28 18:42:57 +0000 |
commit | 1412816686bd4a7b9d7fe72b14c5c4e62d8d4062 (patch) | |
tree | adc23c07cae4fc3ddedcdfa5ea4cc92c7421f6ba /clang/lib/CodeGen/CGBuiltin.cpp | |
parent | de0c33556015d4235a3a553cf53ded748d695af9 (diff) | |
download | bcm5719-llvm-1412816686bd4a7b9d7fe72b14c5c4e62d8d4062.tar.gz bcm5719-llvm-1412816686bd4a7b9d7fe72b14c5c4e62d8d4062.zip |
Make the __builtin_c[lt]zs builtins target independent.
There is really no reason to have these only available on x86. It's
just __builtin_c[tl]z for shorts.
Modernize the test while at it.
llvm-svn: 149183
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index f4a5a82802a..acf95c8579c 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -229,6 +229,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, return RValue::get(Result); } + case Builtin::BI__builtin_ctzs: case Builtin::BI__builtin_ctz: case Builtin::BI__builtin_ctzl: case Builtin::BI__builtin_ctzll: { @@ -245,6 +246,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, "cast"); return RValue::get(Result); } + case Builtin::BI__builtin_clzs: case Builtin::BI__builtin_clz: case Builtin::BI__builtin_clzl: case Builtin::BI__builtin_clzll: { @@ -2061,32 +2063,6 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, switch (BuiltinID) { default: return 0; - case X86::BI__builtin_clzs: { - Value *ArgValue = EmitScalarExpr(E->getArg(0)); - - llvm::Type *ArgType = ArgValue->getType(); - Value *F = CGM.getIntrinsic(Intrinsic::ctlz, ArgType); - - llvm::Type *ResultType = ConvertType(E->getType()); - Value *Result = Builder.CreateCall2(F, ArgValue, Builder.getTrue()); - if (Result->getType() != ResultType) - Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true, - "cast"); - return Result; - } - case X86::BI__builtin_ctzs: { - Value *ArgValue = EmitScalarExpr(E->getArg(0)); - - llvm::Type *ArgType = ArgValue->getType(); - Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType); - - llvm::Type *ResultType = ConvertType(E->getType()); - Value *Result = Builder.CreateCall2(F, ArgValue, Builder.getTrue()); - if (Result->getType() != ResultType) - Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true, - "cast"); - return Result; - } case X86::BI__builtin_ia32_pslldi128: case X86::BI__builtin_ia32_psllqi128: case X86::BI__builtin_ia32_psllwi128: |