Even by my standards, this is an odd patch.  This adds expanders to
i386.md requesting that integer truncations be represented in RTL
using SUBREGs.  This exactly matches the (current) default behaviour
when TARGET_TRULY_NOOP_TRUNCATION is undefined.  Hence this patch
is mostly for documentation/teaching purposes, so that i386.md is a
template or role model for the patterns that a backend should provide.

As explained in my earlier post, defining TARGET_TRULY_NOOP_TRUNCATION
to always return false in the i386/x86_64 backend, results in 603
additional unexpected failures.  Adding these expanders avoids the
majority (412) of those regressions.

I'm not proposing that i386/x86_64 redefine TARGET_TRULY_NOOP_TRUNCATION
but these placeholder expanders may provide the backend the flexibility
of that option in the future, but it also helps to test some less frequently
invoked corners of the middle-end.

This patch has been tested on x86_64-pc-linux-gnu with a full "make
bootstrap" and "make -k check" with no new failures, indeed there
are (should be) absolutely no code changes with this patch.

Might these changes be of interest?  If not, at least this patch
is now archived on gcc-patches for future generations.


2020-07-12  Roger Sayle  <ro...@nextmovesoftware.com>

gcc/ChangeLog
        * config/i386/i386.md (truncdi<SWI124>2, truncsi<SWI12>2,
        trunchiqi2): New expanders to make the intended representation
        of scalar integer truncations explicit.

Thoughts?
Roger
--
Roger Sayle
NextMove Software
Cambridge, UK


Reply via email to