This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR opt/12260: Avoid (const (neg (const (plus X Y))))
- From: Richard Henderson <rth at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- Date: Sat, 11 Oct 2003 09:12:59 -0700
- Subject: Re: [PATCH] PR opt/12260: Avoid (const (neg (const (plus X Y))))
- References: <87ad8v89mg.fsf@student.uni-tuebingen.de> <Pine.LNX.4.44.0309240917430.29699-100000@www.eyesopen.com>
On Wed, Sep 24, 2003 at 09:54:11AM -0600, Roger Sayle wrote:
> I'd like to assume the fault is in the alpha back-end somewhere for
> assuming that just because an expression matches CONSTANT_P that it
> is valid as an operand in assembler.
Nope. The Alpha backend *does* reject the expression. Which causes
the middle-end to try to spill it to memory.
The expression definitely should never have been created.
> PR optimization/12260
> * simplify-rtx.c (simplify_unary_operation): Simplify all unary
> operations through CONST nodes. Optimize (neg (plus X C)) as
> (minus -C X) for constant values C.
> (simplify_binary_operation): Optimize (minus (neg X) C) as
> (minus -C X) for constant values C.
> (simplify_plus_minus): Avoid creating (neg (const (plus X C)),
> instead create (minus -C X).
>
> * gcc.c-torture/compile/20030924-1.c: New test case.
Ok.
r~