This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix up cprop to canonicalize PLUS/MINUS with 2 CONSTANT_P arguments (PR rtl-optimization/57915)
- From: Jeff Law <law at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, Steven Bosscher <stevenb dot gcc at gmail dot com>, Eric Botcazou <ebotcazou at adacore dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 03 Feb 2014 15:11:24 -0700
- Subject: Re: [PATCH] Fix up cprop to canonicalize PLUS/MINUS with 2 CONSTANT_P arguments (PR rtl-optimization/57915)
- Authentication-results: sourceware.org; auth=none
- References: <20140131212810 dot GA892 at tucnak dot redhat dot com> <CABu31nOp0xpREroJrkU1cUg6t5ER+ickGU+meCeDMvaAiwJ1Lw at mail dot gmail dot com> <19a815cb-574b-46c6-97f9-38e1c2739ed8 at email dot android dot com> <52EC906A dot 5000404 at redhat dot com> <20140201095831 dot GB892 at tucnak dot redhat dot com>
On 02/01/14 02:58, Jakub Jelinek wrote:
I think AND is necessary for certain variants of the Alpha. In
theory a shift-add might be possible here, but I don't know if it
happens in practice.
Well, from what I can read in simplify-rtx.c, it only adds CONST around
PLUS/MINUS, not around anything else.
True. But is that the only place that creates the expressions? I'd
certainly agree that PLUS is by far the most important. I've never the
other forms, but those are more likely an artifact of the ports I've
worked on through the years.
Anyway, another variant would be (untested so far) say following patch.
BTW, I wonder why each pass rolls it's own kind of simplification, e.g.
fwprop has propagate_rtx_1, cprop this function, etc., while we have
simplify_replace_fn_rtx that would be used perhaps with some hook that will
handle special cases for each of the pass, but otherwise will take care of
simplifying everything that has actually changed. But that is likely not
what we want to change in stage4.
Some is certainly historical. Even just unifying the simplifications in
combine and simplify_rtx would be a big (but useful) change. Agreed
it's not stage4 material.
2014-02-01 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/57915
* recog.c (simplify_while_replacing): If all unary/binary/relational
operation arguments are constant, attempt to simplify those.
* gcc.target/i386/pr57915.c: New test.
Looks good to me.
Jeff