[PATCH] x86: Provide expanders for truncdisi2 and friends.

Roger Sayle roger@nextmovesoftware.com
Sat Jul 11 23:33:10 GMT 2020


Doh! With the attachment.


-----Original Message-----
From: Roger Sayle <roger@nextmovesoftware.com> 
Sent: 12 July 2020 00:29
To: 'gcc-patches@gcc.gnu.org' <gcc-patches@gcc.gnu.org>
Subject: [PATCH] x86: Provide expanders for truncdisi2 and friends.


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  <roger@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

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patchd2.txt
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200712/456d7731/attachment.txt>


More information about the Gcc-patches mailing list