[llvm-commits] [llvm-gcc-4.2] r40742 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Chris Lattner
clattner at apple.com
Thu Aug 2 10:34:51 PDT 2007
> URL: http://llvm.org/viewvc/llvm-project?rev=40742&view=rev
> Log:
> Expand builtin_parity.
Cool:
> + case BUILT_IN_PARITY: {
> + Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
> + EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctpop);
> + Result = Builder.CreateBinOp(Instruction::And, Result,
> + TreeConstantToLLVM::ConvertINTEGER_CST
> (integer_one_node),
> + "tmp");
I don't think that ConvertINTEGER_CST will work here: the type of the
"Result" var and the "1" constant have to match. I assume that this
will work for parity of int, but fail on parity of long long etc.
Please use:
ConstantInt::get(Result->getType(), 1)
instead,
-Chris
More information about the llvm-commits
mailing list