aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2017-10-03 18:02:38 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2017-10-03 18:02:38 +0200
commita8ccdfa8ea6fbdc78bdd5617427d7ba945cc83af (patch)
tree50f8effb7cc092e35fba1cd02ad40548cf55e31b /gcc
parent9c53f040cb3c3bc0b86f702af5bd73d904d6cf0f (diff)
downloadgcc-a8ccdfa8ea6fbdc78bdd5617427d7ba945cc83af.zip
gcc-a8ccdfa8ea6fbdc78bdd5617427d7ba945cc83af.tar.gz
gcc-a8ccdfa8ea6fbdc78bdd5617427d7ba945cc83af.tar.bz2
simplify-rtx: Remove non-simplifying simplification (PR77729)
If we have (X&C1)|C2 simplify_binary_operation_1 makes C1 as small as possible. This makes worse code in common cases like when the AND with C1 is from a zero-extension. This patch fixes it by removing this transformation (twice). PR rtl-optimization/77729 * simplify-rtx.c (simplify_binary_operation_1): Delete the (X&C1)|C2 to (X&(C1&~C2))|C2 transformations. From-SVN: r253384
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/simplify-rtx.c25
2 files changed, 6 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 33ae1be..9d43ae5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-03 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/77729
+ * simplify-rtx.c (simplify_binary_operation_1): Delete the (X&C1)|C2
+ to (X&(C1&~C2))|C2 transformations.
+
2017-10-03 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/82363
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 1b960b9..3b6cf6f 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2673,14 +2673,6 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
/* If (C1|C2) == ~0 then (X&C1)|C2 becomes X|C2. */
if (((c1|c2) & mask) == mask)
return simplify_gen_binary (IOR, mode, XEXP (op0, 0), op1);
-
- /* Minimize the number of bits set in C1, i.e. C1 := C1 & ~C2. */
- if (((c1 & ~c2) & mask) != (c1 & mask))
- {
- tem = simplify_gen_binary (AND, mode, XEXP (op0, 0),
- gen_int_mode (c1 & ~c2, mode));
- return simplify_gen_binary (IOR, mode, tem, op1);
- }
}
/* Convert (A & B) | A to A. */
@@ -2736,23 +2728,6 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
return gen_rtx_ROTATE (int_mode, XEXP (opright, 0),
XEXP (SUBREG_REG (opleft), 1));
- /* If we have (ior (and (X C1) C2)), simplify this by making
- C1 as small as possible if C1 actually changes. */
- if (CONST_INT_P (op1)
- && (HWI_COMPUTABLE_MODE_P (mode)
- || INTVAL (op1) > 0)
- && GET_CODE (op0) == AND
- && CONST_INT_P (XEXP (op0, 1))
- && CONST_INT_P (op1)
- && (UINTVAL (XEXP (op0, 1)) & UINTVAL (op1)) != 0)
- {
- rtx tmp = simplify_gen_binary (AND, mode, XEXP (op0, 0),
- gen_int_mode (UINTVAL (XEXP (op0, 1))
- & ~UINTVAL (op1),
- mode));
- return simplify_gen_binary (IOR, mode, tmp, op1);
- }
-
/* If OP0 is (ashiftrt (plus ...) C), it might actually be
a (sign_extend (plus ...)). Then check if OP1 is a CONST_INT and
the PLUS does not affect any of the bits in OP1: then we can do