diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-12-04 12:25:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-12-04 12:25:06 +0100 |
commit | 5bf51f2f731c28ea9b45e170fc36a2b0d51ba9b2 (patch) | |
tree | cf6f9692b6ef691ad0b472370f553e0b1c441595 /gcc/combine.c | |
parent | 77381ee7de541021dccd0030a757fc38f369993b (diff) | |
download | gcc-5bf51f2f731c28ea9b45e170fc36a2b0d51ba9b2.zip gcc-5bf51f2f731c28ea9b45e170fc36a2b0d51ba9b2.tar.gz gcc-5bf51f2f731c28ea9b45e170fc36a2b0d51ba9b2.tar.bz2 |
re PR rtl-optimization/58726 (wrong code at -Os on x86_64-linux-gnu (affecting trunk/4.7/4.6, but not 4.8))
PR rtl-optimization/58726
* combine.c (force_to_mode): Fix comment typo. Don't destructively
modify x for ROTATE, ROTATERT and IF_THEN_ELSE.
* gcc.c-torture/execute/pr58726.c: New test.
From-SVN: r205664
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 25cf273..c7eb5e5 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8029,7 +8029,7 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask, if (code == CALL || code == ASM_OPERANDS || code == CLOBBER) return x; - /* We want to perform the operation is its present mode unless we know + /* We want to perform the operation in its present mode unless we know that the operation is valid in MODE, in which case we do the operation in MODE. */ op_mode = ((GET_MODE_CLASS (mode) == GET_MODE_CLASS (GET_MODE (x)) @@ -8460,9 +8460,10 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask, gen_int_mode (mask, GET_MODE (x)), XEXP (x, 1)); if (temp && CONST_INT_P (temp)) - SUBST (XEXP (x, 0), - force_to_mode (XEXP (x, 0), GET_MODE (x), - INTVAL (temp), next_select)); + x = simplify_gen_binary (code, GET_MODE (x), + force_to_mode (XEXP (x, 0), GET_MODE (x), + INTVAL (temp), next_select), + XEXP (x, 1)); } break; @@ -8530,14 +8531,16 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask, /* We have no way of knowing if the IF_THEN_ELSE can itself be written in a narrower mode. We play it safe and do not do so. */ - SUBST (XEXP (x, 1), - gen_lowpart_or_truncate (GET_MODE (x), - force_to_mode (XEXP (x, 1), mode, - mask, next_select))); - SUBST (XEXP (x, 2), - gen_lowpart_or_truncate (GET_MODE (x), - force_to_mode (XEXP (x, 2), mode, - mask, next_select))); + op0 = gen_lowpart_or_truncate (GET_MODE (x), + force_to_mode (XEXP (x, 1), mode, + mask, next_select)); + op1 = gen_lowpart_or_truncate (GET_MODE (x), + force_to_mode (XEXP (x, 2), mode, + mask, next_select)); + if (op0 != XEXP (x, 1) || op1 != XEXP (x, 2)) + x = simplify_gen_ternary (IF_THEN_ELSE, GET_MODE (x), + GET_MODE (XEXP (x, 0)), XEXP (x, 0), + op0, op1); break; default: |