This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] New simplify_associative_operation function
- From: Michael Matz <matz at suse dot de>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Aug 2003 17:11:04 +0200 (CEST)
- Subject: Re: [PATCH] New simplify_associative_operation function
Hi,
On Sat, 16 Aug 2003, Roger Sayle wrote:
> The following patch implements some optimizations of associative
> binary operations in simplify_binary_operation. Because these
> transformations are valid for PLUS, MULT, AND, IOR, XOR, SMIN,
> SMAX, UMIN and UMAX they've been factored into their own function,
> simplify_associative_operation that's shared by all of the above.
>
> The transformations that are performed include
>
> (x op c1) op c2 => x op (c1 op c2)
> (x op c1) op (y op c2) => (x op y) op (c1 op c2)
> (x op c) op y => (x op y) op c
Note, that the last two at least also require commutativity. All
operators in the above list are, but maybe this fact should be reflected
in the function name, or somewhere. Maybe "reorderable" or whatever would
be a good name for this property.
Ciao,
Michael.