aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2017-07-19 21:28:41 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2017-07-19 21:28:41 +0200
commit3d50b6045a05a66715de20fe10fc94e8bdbe4dca (patch)
treea686c908f3ec904d5665254d978c95d8ce7ca2d8 /gcc
parentccfa843f6722b5223fdf0dd83b189555a629e5a6 (diff)
downloadgcc-3d50b6045a05a66715de20fe10fc94e8bdbe4dca.zip
gcc-3d50b6045a05a66715de20fe10fc94e8bdbe4dca.tar.gz
gcc-3d50b6045a05a66715de20fe10fc94e8bdbe4dca.tar.bz2
simplify-rtx: The truncation of an IOR can have all bits set (PR81423)
... if it is an IOR with a constant with all bits set in the mode that is truncated to, for example. Handle that case. PR rtl-optimization/81423 * simplify-rtx.c (simplify_truncation): Handle truncating an IOR with a constant that is -1 in the truncated to mode. From-SVN: r250363
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/simplify-rtx.c9
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 746b08e..4de6391 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-07-19 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/81423
+ * simplify-rtx.c (simplify_truncation): Handle truncating an IOR
+ with a constant that is -1 in the truncated to mode.
+
2017-07-19 Jan Hubicka <hubicka@ucw.cz>
* predict.c (propagate_unlikely_bbs_forward): Break out from ...
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 3bce329..ef41479 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -857,6 +857,15 @@ simplify_truncation (machine_mode mode, rtx op,
return simplify_gen_unary (TRUNCATE, mode, XEXP (op, 0),
GET_MODE (XEXP (op, 0)));
+ /* (truncate:A (ior X C)) is (const_int -1) if C is equal to that already,
+ in mode A. */
+ if (GET_CODE (op) == IOR
+ && SCALAR_INT_MODE_P (mode)
+ && SCALAR_INT_MODE_P (op_mode)
+ && CONST_INT_P (XEXP (op, 1))
+ && trunc_int_for_mode (INTVAL (XEXP (op, 1)), mode) == -1)
+ return constm1_rtx;
+
return NULL_RTX;
}