Patch to implement rotates by zero
Richard Sandiford
rsandifo@redhat.com
Mon Aug 19 02:26:00 GMT 2002
Hmm, having had a bit more chance to think about it, I'd like to
stick with the original patch...
cgd@broadcom.com writes:
> it just makes the binutils code simpler. People who do rotate by 0
> and expect an optimization should lose. it wouldn't happen if they
> had real rotate instructions (i.e., they'd get an actual instruction).
> So, they might as well get the 'normal' rotate macro expansion.
I don't really understand what you mean by "it wouldn't happen if they
had real rotate instructions". If you don't have a real rotate insn,
you'd get "sll" instead or "ror", but either way you'd get exactly
one instruction.
As for it making the code simpler... well, yes, I suppose it does
slightly. But it would have been even simpler if we didn't bother
having "rol" or "ror" macros at all. I think now we have them, we
have to treat them as far as possible like other macros. To me,
it seems consistent with the way other constant macros are
treated that:
sll at,R2,0
srl R1,R2,0
or R1,R1,at
becomes:
sll R1,R2,0
Not that the patch justifies this much attention, really. ;)
Richard
More information about the Binutils
mailing list