[PATCH] Fix PR optimization/8746 (x86)

Jan Hubicka jh@suse.cz
Fri Mar 21 18:49:00 GMT 2003


> > Now I see why you confused this with a fix - it fails only with sign bit
> > set.
> 
> Yes, the splitter was wrong if bit7 is set in the mask. So a patch that 
> prevents it from triggering if bit7 is set is not far from being a fix :-)
> The first part of your patch just does that.
> 
> > The corect condition is IMO test for the constant being positive or
> > CCmode to match CCZmode where sign bit doesn't matter in this case.
> 
> Something like this?
> 
> && ix86_match_ccmode (insn, CCNOmode)
> && (INTVAL (operands[2]) >= 0 || ix86_match_ccmode (insn, CCZmode))

Yes, that looks fine to me,one call to match_ccmode is redundant tought.
> 
> > Additionally we should test constant to be positive for AND pattern when
> > optimizing for size or having cheap prefixes (there is TARGET_* macro
> > for that) and disable the TEST pattern conversion when there are cheap
> > prefixes or optimizing for size.
> 
> We must test that the constant is positive (or use your relaxed condition) is 
> all cases, no?

Yes, we additonally should check that the transformation helps
something.  I guess the current code is doing that almost fine, except
for use of the prefix cost knob that has been added after the code was
written (in K6/pentium times)
> 
> I didn't find the appropriate item among the bunch of (mostly undocumented) 
> TARGET_* macros.
It is TARGET_FAST_PREFIX.
The TEST condtional should be probably something like this:
  "! TARGET_PARTIAL_REG_STALL && reload_completed
   && ix86_match_ccmode (insn, INTVAL (operands[2]) ?>= 0 ? CCNOmode : CCZmode)
   && GET_MODE (operands[0]) == HImode
   && !optimize_size && !TARGET_FAST_PREFIX"
The AND conditional should probably just be changed to call match_ccmode
properly.   Does this look sane to everyone?

Honza
> 
> -- 
> Eric Botcazou



More information about the Gcc-patches mailing list