[LLVMdev] Shifts that use only 5 LSBs.
Daniel M Gessel
gessel at apple.com
Thu Dec 18 13:40:43 PST 2008
I can't find the bug you refer to.
Also, it doesn't have this problem in x86: it uses the shldl
instruction.
PPC32, interestingly enough, generates something similar, but looks
like it has extra instructions to or in what's guaranteed to be 0.
Reminding myself of some PPC assembler though, so I'm not 100%.
Thanks,
Dan
On Dec 16, 2008, at 9:27 PM, Eli Friedman wrote:
> On Tue, Dec 16, 2008 at 5:20 PM, Daniel M Gessel <gessel at apple.com>
> wrote:
>> The problem here is that it looks like LLVM is introducing an
>> expansion that
>> assumes 32 bit shifts use more than 5 bits of the shift value.
>> I created a simple test function:
>> u64 mebbe_shift( u64 x, int test )
>> {
>> if( test )
>> x <<= 2;
>> return x;
>> }
>> I compile using clang, opt, and llc.
>> I get something that, converted from my assembler to hasty psuedo-C:
>> u64 mebbe_shift( u64 x, int test )
>> {
>> int amt = test ? 2 : 0;
>> x.hi = x.hi << amt | x.lo >> (32 - amt);
>> x.lo <<= amt;
>>
>> return x;
>> }
>
> Ouch, that's nasty... I just filed http://llvm.org/bugs/show_bug.cgi?id=3225.
>
> -Eli
> _______________________________________________
> 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