This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize x*x*x*x*x*x using 3 multiplications.
- From: Michael Matz <matz at suse dot de>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Richard Henderson <rth at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 1 Aug 2003 02:54:03 +0200 (CEST)
- Subject: Re: [PATCH] Optimize x*x*x*x*x*x using 3 multiplications.
Hi,
On Thu, 31 Jul 2003, Roger Sayle wrote:
> extern int z1, z2;
> void foo(int x, int y, int z)
> {
> z1 = (x+y)+z;
> z2 = x+(y+z);
> }
>
> gets optimized to z2 = z1 with MSVC but not by GCC.
I have a somewhat ugly patch for this problem which basically reorders all
operands of an associative, commutative operator into some canonical
order. This makes CSEing them possible.
Ciao,
Michael.