diff --git a/gcc/combine.c b/gcc/combine.c index cb5fa40..290a366 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -5903,7 +5903,8 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest, if (HWI_COMPUTABLE_MODE_P (mode) && (STORE_FLAG_VALUE & ~GET_MODE_MASK (mode)) == 0 && (temp = get_last_value (XEXP (x, 0))) - && COMPARISON_P (temp)) + && COMPARISON_P (temp) + && TRULY_NOOP_TRUNCATION_MODES_P (mode, GET_MODE (XEXP (x, 0)))) return gen_lowpart (mode, XEXP (x, 0)); break; diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index c81e27e..e431e0c 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1249,7 +1249,8 @@ simplify_context::simplify_unary_operation_1 (rtx_code code, machine_mode mode, than HOST_BITS_PER_WIDE_INT. */ if (HWI_COMPUTABLE_MODE_P (mode) && COMPARISON_P (op) - && (STORE_FLAG_VALUE & ~GET_MODE_MASK (mode)) == 0) + && (STORE_FLAG_VALUE & ~GET_MODE_MASK (mode)) == 0 + && TRULY_NOOP_TRUNCATION_MODES_P (mode, GET_MODE (op))) { temp = rtl_hooks.gen_lowpart_no_emit (mode, op); if (temp)