[LLVMdev] rol/ror llvm instruction set

Nick Lewycky nicholas at mxc.ca
Tue Feb 3 20:35:11 PST 2009


Kasra wrote:
> --- On Tue, 2/3/09, Owen Anderson <resistor at mac.com> wrote:
> 
>> From: Owen Anderson <resistor at mac.com>
>> Subject: Re: [LLVMdev] rol/ror llvm instruction set
>> To: kasra_n500 at yahoo.com, "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
>> Date: Tuesday, February 3, 2009, 4:20 PM
>> On Feb 3, 2009, at 3:54 PM, Kasra wrote:
>>> I guess the backends could know about the
>> instructions. But I am not convinced why it is beneficial
>> not to have ROR and ROL instructions within llvm.
>> How would it be beneficial to have them, if we already
>> generate them at the target level properly?  Adding
>> instructions "just because" doesn't seem wise.
>>
>> -Owen
> 
> If you look at it the way you are it sounds fine. :D
> 
> However, if we have 1 instruction we reduce the amount of time we will spend optomising. 

No, it's the other way around. Adding rotate means we have two 
instructions that represent nearly the same thing, and the optimizers 
will have to match them both.

Designing the IR for a compiler is an art. LLVM has always tried to keep 
the number of instructions minimal, within reason. This means we write 
less code when working on an optimizer, analyzer, file formats, etc.

Unless you can show a strong case that rotate expresses something that 
is difficult to capture in the current IR, I don't think we're 
interested in adding it. You'd have better luck trying to convince me 
that we should replace shift with rotate than to suggest we have both.

Nick

> I argued on my previous post that rotations are implemented on most machine (x86 platform). Thus it seems right to include 1 instruction in llvm and translate it to 3 instruction older architectures that have not implemented the rotation instruction yet.
> 
> I am sure that it is only matter of time before architectures without rotation instruction implementing it. Because of cryptography, it is becoming much more popular about 500% growth over the past decade (AES competitors against SHA-3 competitors). Crypto algorithms really like rotations since it is easily analysed and could be implemented efficiently
> 
> -- Kasra
> 
> 
> 
>       
> 
> _______________________________________________
> 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