On Sun, Jul 12, 2020 at 1:29 AM Roger Sayle <ro...@nextmovesoftware.com> wrote: > > > 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.
It seems to be improving TARGET_TRULY_NOOP_TRUNCATION documentation might be useful here - from what it says it suggests to me it applies to hardregs only and tells for example whether there are lower than word_mode precision registers like on x86_64 %al? Because for pseudos there's always the requirement to use subregs and doing (reg:SI 42) and (reg:QI 42) accesses to the same pseudo is invalid(?). The only user (after your patch) of this hook is in function.c for the function parameter setup btw. and I wonder if there's other hooks for the RA for example that provide duplicate functionality. Richard. > > 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 > >