* [Committed] Restore build on !TARGET_TRULY_NOOP_TRUNCATION targets
@ 2021-08-23 14:35 Roger Sayle
0 siblings, 0 replies; only message in thread
From: Roger Sayle @ 2021-08-23 14:35 UTC (permalink / raw)
To: 'GCC Patches'
[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]
My sincere apologies to everyone, but especially Andrew Pinski
who warned me in advance that TRULY_NOOP_TRUNCATION results in
different code paths/optimizations on some targets. This restores
the build on nvptx-none (and presumably others) where mysteriously
(truncate:QI (reg:QI)) fails to be simplified to (reg:QI), which
is expected (everywhere) in my recently added self-tests.
[I'd even tested the functional change of the previous patch on
nvptx-none, but it's the new self-tests that I added for submission
that have been shown to be less portable across targets than hoped].
This patch has been committed as obvious, after testing that it
restores the build on nvptx-none and with a "make bootstrap" on
x86_64-pc-linux-gnu to guarantee no surprises [make -k check is
underway].
Sorry again.
2021-08-23 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* simplify-rtx.c (simplify_unary_operation_1): [TRUNCATE]:
Handle case where the operand is already the desired mode.
Roger
--
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 407 bytes --]
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index f3df614..8eea9fb 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1268,6 +1268,9 @@ simplify_context::simplify_unary_operation_1 (rtx_code code, machine_mode mode,
return temp;
}
+ /* Check for useless truncation. */
+ if (GET_MODE (op) == mode)
+ return op;
break;
case FLOAT_TRUNCATE:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-23 14:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 14:35 [Committed] Restore build on !TARGET_TRULY_NOOP_TRUNCATION targets Roger Sayle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).