[LLVMdev] Why is there no ashl/lshl?

Chris Lattner clattner at apple.com
Tue May 7 09:42:31 PDT 2013


On May 7, 2013, at 9:25 AM, "Robinson, Paul" <Paul_Robinson at playstation.sony.com> wrote:

>> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
>> On Behalf Of Tim Northover
>> In contrast, it's not quite clear what an arithmetic left-shift would
>> be. If you want to keep x << 1 == x*2 then the logical one already
>> does this. 
> 
> Only if the left-most (shiftcount + 1) bits are all-0 or all-1.
> I've used machines that distinguished logical and arithmetic left shift
> to detect when this condition fails (arith shift would trap).

LLVM IR doesn't expose flags (except in specific overflow detecting intrinsics).

-Chris



More information about the llvm-dev mailing list