[gcc/devel/c++-modules] middle-end: Remove truly_noop_truncation check from convert.c
Nathan Sidwell
nathan@gcc.gnu.org
Mon Jul 13 15:05:16 GMT 2020
https://gcc.gnu.org/g:b8697d0cd06da3375063295fe7161671e0904459
commit b8697d0cd06da3375063295fe7161671e0904459
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Mon Jul 13 09:49:34 2020 +0100
middle-end: Remove truly_noop_truncation check from convert.c
This patch eliminates a check of targetm.truly_noop_truncation from
the early middle-end, where the gimple/generic being generated by
GCC's front-ends is being inappropriately influenced by the target's
TRULY_NOOP_TRUNCATION. The (recent) intention of TRULY_NOOP_TRUNCATION
is to indicate that a backend requires explicit truncation instructions
rather than using SUBREGs to perform truncations. A long standing
(and probably unintentional) side-effect has been that this setting
also controls whether the middle-end narrows integer operations at
the tree-level. Understandably, GCC and its testsuite assume that
GIMPLE and GENERIC behave consistently across platforms, and alas
defining TRULY_NOOP_TRUNCATION away from the default triggers several
regressions (including gcc.dg/fold-rotate-1.c).
2020-07-13 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* convert.c (convert_to_integer_1): Narrow integer operations
even on targets that require explicit truncation instructions.
Diff:
---
gcc/convert.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/gcc/convert.c b/gcc/convert.c
index 42509c518a9..292c5133974 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -836,16 +836,10 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0))))
break;
- if (outprec >= BITS_PER_WORD
- || targetm.truly_noop_truncation (outprec, inprec)
- || inprec > TYPE_PRECISION (TREE_TYPE (arg0))
- || inprec > TYPE_PRECISION (TREE_TYPE (arg1)))
- {
- tree tem = do_narrow (loc, ex_form, type, arg0, arg1,
- expr, inprec, outprec, dofold);
- if (tem)
- return tem;
- }
+ tree tem = do_narrow (loc, ex_form, type, arg0, arg1,
+ expr, inprec, outprec, dofold);
+ if (tem)
+ return tem;
}
break;
More information about the Gcc-cvs
mailing list