* PR 37363 follow-on 1: avoid gen_rtx_CONST call in cse.c:fold_rtx
@ 2008-11-11 4:14 Richard Sandiford
2008-11-11 15:32 ` Richard Guenther
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2008-11-11 4:14 UTC (permalink / raw)
To: gcc-patches
Although this patch isn't strictly necessary to fix PR 37363, the
comment suggests that we might in future create (const (minus ...))s
in fold_rtx. Since we don't want to do that, I'd like to apply this
patch at the same time as the main one.
The code I'm removing should be dead: simplify_unary_operation should
already know when the result can be treated as a CONST.
Bootstrapped & regression-tested on x86_64-linux-gnu. Also tested
by comparing the before and after assembly output for:
gcc.c-torture gcc.dg g++.dg
on these targets:
powerpc-darwin powerpc64-darwin i386-darwin x86_64-darwin
powerpc-linux-gnu powerpc64-linux-gnu powerpc-ibm-aix5.3.0
using the options "-O2 -fpic". The output was the same.
OK to install?
Richard
gcc/
* cse.c (fold_rtx): Remove redundant gen_rtx_CONST.
Index: gcc/cse.c
===================================================================
--- gcc/cse.c 2008-11-10 23:00:17.000000000 +0000
+++ gcc/cse.c 2008-11-10 23:11:30.000000000 +0000
@@ -3171,33 +3171,15 @@ fold_rtx (rtx x, rtx insn)
{
case RTX_UNARY:
{
- int is_const = 0;
-
/* We can't simplify extension ops unless we know the
original mode. */
if ((code == ZERO_EXTEND || code == SIGN_EXTEND)
&& mode_arg0 == VOIDmode)
break;
- /* If we had a CONST, strip it off and put it back later if we
- fold. */
- if (const_arg0 != 0 && GET_CODE (const_arg0) == CONST)
- is_const = 1, const_arg0 = XEXP (const_arg0, 0);
-
new_rtx = simplify_unary_operation (code, mode,
const_arg0 ? const_arg0 : folded_arg0,
mode_arg0);
- /* NEG of PLUS could be converted into MINUS, but that causes
- expressions of the form
- (CONST (MINUS (CONST_INT) (SYMBOL_REF)))
- which many ports mistakenly treat as LEGITIMATE_CONSTANT_P.
- FIXME: those ports should be fixed. */
- if (new_rtx != 0 && is_const
- && GET_CODE (new_rtx) == PLUS
- && (GET_CODE (XEXP (new_rtx, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (new_rtx, 0)) == LABEL_REF)
- && GET_CODE (XEXP (new_rtx, 1)) == CONST_INT)
- new_rtx = gen_rtx_CONST (mode, new_rtx);
}
break;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PR 37363 follow-on 1: avoid gen_rtx_CONST call in cse.c:fold_rtx
2008-11-11 4:14 PR 37363 follow-on 1: avoid gen_rtx_CONST call in cse.c:fold_rtx Richard Sandiford
@ 2008-11-11 15:32 ` Richard Guenther
0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2008-11-11 15:32 UTC (permalink / raw)
To: gcc-patches, rdsandiford
On Mon, Nov 10, 2008 at 5:29 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> Although this patch isn't strictly necessary to fix PR 37363, the
> comment suggests that we might in future create (const (minus ...))s
> in fold_rtx. Since we don't want to do that, I'd like to apply this
> patch at the same time as the main one.
>
> The code I'm removing should be dead: simplify_unary_operation should
> already know when the result can be treated as a CONST.
>
> Bootstrapped & regression-tested on x86_64-linux-gnu. Also tested
> by comparing the before and after assembly output for:
>
> gcc.c-torture gcc.dg g++.dg
>
> on these targets:
>
> powerpc-darwin powerpc64-darwin i386-darwin x86_64-darwin
> powerpc-linux-gnu powerpc64-linux-gnu powerpc-ibm-aix5.3.0
>
> using the options "-O2 -fpic". The output was the same.
> OK to install?
Ok.
Thanks,
Richard.
> Richard
>
>
> gcc/
> * cse.c (fold_rtx): Remove redundant gen_rtx_CONST.
>
> Index: gcc/cse.c
> ===================================================================
> --- gcc/cse.c 2008-11-10 23:00:17.000000000 +0000
> +++ gcc/cse.c 2008-11-10 23:11:30.000000000 +0000
> @@ -3171,33 +3171,15 @@ fold_rtx (rtx x, rtx insn)
> {
> case RTX_UNARY:
> {
> - int is_const = 0;
> -
> /* We can't simplify extension ops unless we know the
> original mode. */
> if ((code == ZERO_EXTEND || code == SIGN_EXTEND)
> && mode_arg0 == VOIDmode)
> break;
>
> - /* If we had a CONST, strip it off and put it back later if we
> - fold. */
> - if (const_arg0 != 0 && GET_CODE (const_arg0) == CONST)
> - is_const = 1, const_arg0 = XEXP (const_arg0, 0);
> -
> new_rtx = simplify_unary_operation (code, mode,
> const_arg0 ? const_arg0 : folded_arg0,
> mode_arg0);
> - /* NEG of PLUS could be converted into MINUS, but that causes
> - expressions of the form
> - (CONST (MINUS (CONST_INT) (SYMBOL_REF)))
> - which many ports mistakenly treat as LEGITIMATE_CONSTANT_P.
> - FIXME: those ports should be fixed. */
> - if (new_rtx != 0 && is_const
> - && GET_CODE (new_rtx) == PLUS
> - && (GET_CODE (XEXP (new_rtx, 0)) == SYMBOL_REF
> - || GET_CODE (XEXP (new_rtx, 0)) == LABEL_REF)
> - && GET_CODE (XEXP (new_rtx, 1)) == CONST_INT)
> - new_rtx = gen_rtx_CONST (mode, new_rtx);
> }
> break;
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-11 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-11 4:14 PR 37363 follow-on 1: avoid gen_rtx_CONST call in cse.c:fold_rtx Richard Sandiford
2008-11-11 15:32 ` Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).