bitwise AND

Hi,

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

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 (const APInt &LHS, const APInt &RHS)
> Bitwise AND function for APInt.

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

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.

The LLVM-IR instruction for this is:

http://llvm.org/docs/LangRef.html#i_and

'and' Instruction