This is the mail archive of the
mailing list for the GCC project.
Re: Extension to compare-elim
On Thu, 17 May 2012 09:08:26 -0700, Richard Henderson wrote:
> My question is, why are you generating compares in two different modes
> early, before compare-elim runs? If you hadn't done that, your
> redundant compare would already be eliminated.
Good question. I tried to follow the example set by the rx port.
I have two CC modes, the CCmode which says the compare clobbers all flags
(cmp insn) and the NZmode which only clobbers the N and Z flags (tst
insn). I select a specific mode for a compare during expand. Where can I
do this otherwise?
If I don't do it at expand time, it seems all the compare instructions
end up being emitted as cmp's since GCC will never change the mode of
compare itself and therefore the insn with a compare in CCmode will never
match the test pattern which requires compare to have NZmode.