[LLVMdev] Why is there no ashl/lshl?

Robinson, Paul Paul_Robinson at playstation.sony.com
Tue May 7 09:25:53 PDT 2013


> 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).

--paulr






More information about the llvm-dev mailing list