[LLVMdev] rol/ror llvm instruction set

Bill Wendling isanbard at gmail.com
Tue Feb 3 16:17:49 PST 2009


On Tue, Feb 3, 2009 at 3:54 PM, Kasra <kasra_n500 at yahoo.com> 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.
>
I guess I could ask you the opposite question: What is the benefit of
having these? They would have to be mappable to the source language in
some way. I'm not sure about Ada, but I don't know of a "rotate"
operator for any of the C variants, or any other high-level language.
(This could be my lack of knowledge about other languages.) In C, you
specify a rotate by doing shifts and bit-wise operations.

This isn't to say that LLVM IR is C-specific. Just that if you did
have an LLVM rotate instruction, it would have to be generated by the
front-end -- currently by recognizing the same things that the DAG
combiner recognizes. And then it may need to be "lowered" for various
platforms that don't support it, which is greater than the number of
platforms that don't have shifts.

If a language came along that had rotate as a primitive and that
generated LLVM IR, then you could probably convince people that having
the rotates as LLVM IR instructions would be a benefit. We're not
above changing the language to support good things. :-)

-bw



More information about the llvm-dev mailing list