[LLVMdev] bitwise AND

Duncan Sands baldrick at free.fr
Tue Sep 6 03:04:38 PDT 2011


Hi Alexandra,

> I want to compute the bitwise 'and' between two values of type int1: %x = and
> %a, %b .

   BinaryOperator::CreateAnd

That said, use an IRBuilder which has lots of convenience methods
(like CreateAnd) to help with creating IR.

Ciao, Duncan.

> Which is the LLVM instruction that creates this? I only found the APInt class,
> whose constructor is:
>
> APInt(unsigned numBits, uint64_t val, bool isSigned = false)
>
> and which provides the bitwise AND operation:
>
> APInt 	llvm::APIntOps::And
> <http://llvm.org/docs/doxygen/html/namespacellvm_1_1APIntOps.html#a684cfe02c582e8d75cd6d457e63e6c25>
> (const APInt &LHS, const APInt &RHS)
> 	Bitwise AND function for APInt
> <http://llvm.org/docs/doxygen/html/classllvm_1_1APInt.html>.
>
>
> Is this the best way to build the 'and' instruction that I need? If so, how can
> I send the value uint64_t stored in the values %a , %b of type int1 ?
>
> Thank you.
>
> Alexandra
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list