[LLVMdev] selecting select_cc
Rafael EspĂndola
rafael.espindola at gmail.com
Tue Aug 22 05:08:02 PDT 2006
On 8/22/06, Ralph Corderoy <ralph at inputplus.co.uk> wrote:
>
> Hi Rafael,
Hi Ralph,
> The more normal ARM code, as produced by assembly writers and compilers
> that I've seen, is
>
> cmp $a, $b
> moveq $dst, $trueVal
> movne $dst, $falseVal
>
> e.g. at the end of a function returning r0
>
> orr r0, r0, #0x40
> cmp r0, #0xfe
> moveq r0, #1
> movne r0, #0
>
> since only one mov instruction is executed and the logic is clearer to
> the reader. I may be out of date here, but a skipped instruction takes
> one S-cycle whereas your always executed mov may take two S-cycles if a
> register-controlled shift is used, and more if $dst is the PC.
Thanks for the information!
I implemented the "mov + moveq" because it was easier to copy from the
alpha backend :-)
One advantage of using "mov + moveq" is that the mov might be
coalesced. I think that we need some benchmark to find the best
option.
> Hopefully, it's no more difficult for LLVM to generate.
It shouldn't be hard. For now, I will add a note to the backend. When
it is mature enough to run benchmarks I will come back to it.
> Cheers,
>
>
> Ralph.
Best Regards,
Rafael
> PS. It's great to see LLVM gaining an ARM backend.
It is very fun to write one :-)
More information about the llvm-dev
mailing list