This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH] combine: Replace sign_extend with zero_extend more often.


There may be a slight imprecision in expand_compound_operation.
When it encounters a SIGN_EXTEND where it's already known that the
sign bit is zero, it may replace that with a ZERO_EXTEND (and
tries to simplify that further).  However, the pattern is only
replaced if the new set_src_cost() is _lower_ than the old cost.

The patch changes that to "not higher than", assuming that the
ZERO_EXTEND form is generally preferrable unless there is a reason
to believe it's not (i.e. its cost is higher).  The comment atop
this code block seems to support this:

  /* Convert sign extension to zero extension, if we know that the high
     bit is not set, as this is easier to optimize.  It will be converted
     back to cheaper alternative in make_extraction.  */

On s390[x] this gets rid of some SIGN_EXTENDs completely.

(The patched code uses the cheaper of both replacement patterns.)

--

The patch hasn't got a lot of testing yet as I'd like to hear your
opinion on the patch first.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

Attachment: 0001-ChangeLog
Description: Text document

Attachment: 0001-combine-Replace-sign_extend-with-zero_extend-more-of.patch
Description: Text document


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