Upper 32bits from 64bit value

Hi,

I need to fetch lower and higher 32bits from 64bit value. I found “CreateLShr” function to fetch lower 32bits,
llvm::Value *intermediateValue = LLVMIRBuilder->CreateLShr(x64BitValue, 32);

What function I need to use for fetching upper 32bits from 64bit value.

Thanks in advance,
Deep

I need to fetch lower and higher 32bits from 64bit value. I found
"CreateLShr" function to fetch lower 32bits,
llvm::Value *intermediateValue = LLVMIRBuilder->CreateLShr(x64BitValue, 32);

That would give you the upper bits, I think.

What function I need to use for fetching upper 32bits from 64bit value.

There's multiple ways to get the other half: "x & 0xffffffff" is the
canonical one (LLVM's optimisers will convert the others into that if
they can).

Cheers.

Tim.

Hi Tim,

Thank you for reply.

llvm::Value *intermediateValue = LLVMIRBuilder->CreateLShr(x64BitValue, 32);

Now I am using below to calculate upper 32bits, I think this is OK,

llvm::Value *intermediateValue = LLVMIRBuilder->CreateAnd(x64BitValue, 0xFFFFFFFF00000000);
intermediateValue = LLVMIRBuilder->CreateLShr(intermediateValue, 32);
//cast value to 32 bit
intermediateValue = castValueByOpSize(intermediateValue, 32);

Regards,
Deep

Hi All,

Is this possible to generate LLVM IR from any static/dynamic link library?
I have some static and dynamic link library and I want to generate LLVM IR as I want to obfuscate these libraries.
Is there any way to do the same.

Please give me some pointers on this.

Thanks,
Deep