This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Combine clue requested - missed ia32 optimization


On Sat, Jul 15, 2000 at 02:03:19AM +0100, Joern Rennecke wrote:
> > I've traced this to a missed combination.  We have RTL like so:
> > 
> > (set (reg:QI 50)
> >      (gtu:QI (reg:CC 17 flags)
> >              (const_int 0 [0x0])))
> > 
> > (set (reg:QI 51)
> >      (ltu:QI (reg:CC 17 flags)
> >              (const_int 0 [0x0])))
> > 
> > (set (reg:CC 17 flags)
> >      (compare:CC (reg:QI 50)
> >                  (reg:QI 51)))
> 
> combine can handle only three instructions at a time.  I suppose you could
> still handle this, by combining these three instructions into a no-op move.
> However, ia32 is a SMALL_REGISTER_CLASSES target, so all kinds of weird
> limitations on what can be combined apply.  There is probably one that
> blocks this combination.

I've gotten quite a bit farther since I wrote this.  The combination
is blocked only by a bug in use_crosses_set_p where it thinks a use
crosses the set, but the offending insn has been deleted previously.
Then simplify_binary_operation doesn't know what to do with

(set (reg:CC 17 flags)
     (compare:CC
	(gtu:QI (reg:CC 17 flags) (const_int 0))
	(ltu:QI (reg:CC 17 flags) (const_int 0))
     ))

Once you teach it that, we wind up at recog_for_combine with

(set (reg:CC 17 flags) (reg:CC 17 flags))

which is not a recognizable insn.  Rather than hack up the MD file,
I'm thinking of adding another case to the extensive list of things to
try if the result isn't recognizable: something like

  if (insn_code_number < 0 && GET_CODE (newpat) == SET
      && rtx_equal_p (SET_SRC (newpat), SET_DEST (newpat)))
    {
       /* delete i3, and warp to the cleanup block */
    }

I'm now puzzling over how to explain the situation to the cleanup
block.

Thanks for the help.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]