summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index e8af7f34050..ef414797af5 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;
}
@@ -6186,7 +6195,7 @@ simplify_subreg (machine_mode outermode, rtx op,
unsigned int part_size, final_offset;
rtx part, res;
- enum machine_mode part_mode = GET_MODE (XEXP (op, 0));
+ machine_mode part_mode = GET_MODE (XEXP (op, 0));
if (part_mode == VOIDmode)
part_mode = GET_MODE_INNER (GET_MODE (op));
part_size = GET_MODE_SIZE (part_mode);