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] 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.


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