This is the mail archive of the gcc@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]

Re: const folding vs multiply-add


On Thu, Nov 08, 2001 at 04:52:10PM -0800, Dale Johannesen wrote:
> Currently the tree-based const folding changes x*2.0 to x+x.
> This is not always the right thing to do on a machine with
> a multiply-add instruction (ppc):
>     for(i=...) {  x[i] = y[i] * 2.0 + z;  }
> Best code is to pull the load of 2.0 out of the loop and
> generate a single multiply-add instruction within the loop.

Given the existance of the C99 fma function, it would be a
good idea to create a well-known multiply-add pattern so
that we can recognize this function as a built-in.

If we have that, we can notice that the machine supports
this sort of thing and generate the code to use the fused
instruction right from the start.


r~


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