aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index a1a774752cf..a2cd612f92d 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -758,6 +758,7 @@ simplify_unary_operation (enum rtx_code code, enum machine_mode mode,
tmp[i] = ~tmp[i];
real_from_target (&d, tmp, mode);
}
+ break;
default:
gcc_unreachable ();
}
@@ -1925,7 +1926,7 @@ simplify_binary_operation (enum rtx_code code, enum machine_mode mode,
return const0_rtx;
/* Transform (and (extend X) C) into (zero_extend (and X C)) if
- there are no non-zero bits of C outside of X's mode. */
+ there are no nonzero bits of C outside of X's mode. */
if ((GET_CODE (op0) == SIGN_EXTEND
|| GET_CODE (op0) == ZERO_EXTEND)
&& GET_CODE (trueop1) == CONST_INT
@@ -2880,6 +2881,21 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode,
return simplify_gen_relational (code, mode, cmp_mode, x, c);
}
+ /* (ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))) is
+ the same as (zero_extract:SI FOO (const_int 1) BAR). */
+ if (code == NE
+ && op1 == const0_rtx
+ && GET_MODE_CLASS (mode) == MODE_INT
+ && cmp_mode != VOIDmode
+ /* ??? Work-around BImode bugs in the ia64 backend. */
+ && mode != BImode
+ && cmp_mode != BImode
+ && nonzero_bits (op0, cmp_mode) == 1
+ && STORE_FLAG_VALUE == 1)
+ return GET_MODE_SIZE (mode) > GET_MODE_SIZE (cmp_mode)
+ ? simplify_gen_unary (ZERO_EXTEND, mode, op0, cmp_mode)
+ : lowpart_subreg (mode, op0, cmp_mode);
+
return NULL_RTX;
}