This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR opt/12260: Avoid (const (neg (const (plus X Y))))


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]