[llvm-commits] [llvm-gcc-4.2] r146399 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Bob Wilson
bob.wilson at apple.com
Mon Dec 12 11:23:29 PST 2011
Author: bwilson
Date: Mon Dec 12 13:23:29 2011
New Revision: 146399
URL: http://llvm.org/viewvc/llvm-project?rev=146399&view=rev
Log:
Fix up llvm-gcc to work with the ctlz and cttz changes in llvm svn r146357.
I know llvm-gcc is dead but my llvm-gcc nightly testers keep finding real
problems that are not exposed by clang (for whatever reason), so I'm motivated
to make easy fixes like this to keep it working.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=146399&r1=146398&r2=146399&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Dec 12 13:23:29 2011
@@ -5510,7 +5510,9 @@
case BUILT_IN_CLZL:
case BUILT_IN_CLZLL: {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::ctlz);
+ Function *F =
+ Intrinsic::getDeclaration(TheModule, Intrinsic::ctlz, Amt->getType());
+ Result = Builder.CreateCall2(F, Amt, Builder.getTrue());
Type *DestTy = ConvertType(TREE_TYPE(exp));
Result = Builder.CreateIntCast(Result, DestTy,
!TYPE_UNSIGNED(TREE_TYPE(exp)),
@@ -5521,7 +5523,9 @@
case BUILT_IN_CTZL:
case BUILT_IN_CTZLL: {
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::cttz);
+ Function *F =
+ Intrinsic::getDeclaration(TheModule, Intrinsic::cttz, Amt->getType());
+ Result = Builder.CreateCall2(F, Amt, Builder.getTrue());
Type *DestTy = ConvertType(TREE_TYPE(exp));
Result = Builder.CreateIntCast(Result, DestTy,
!TYPE_UNSIGNED(TREE_TYPE(exp)),
@@ -5645,7 +5649,9 @@
// The argument and return type of cttz should match the argument type of
// the ffs, but should ignore the return type of ffs.
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::cttz);
+ Function *F =
+ Intrinsic::getDeclaration(TheModule, Intrinsic::cttz, Amt->getType());
+ Result = Builder.CreateCall2(F, Amt, Builder.getTrue());
Result = Builder.CreateAdd(Result,
ConstantInt::get(Result->getType(), 1));
Result = CastToUIntType(Result, ConvertType(TREE_TYPE(exp)));
More information about the llvm-commits
mailing list