[PATCH] RTL expansion of exponentiation by integer constant

Kelley Cook kcook34@ford.com
Mon Jun 23 14:14:00 GMT 2003


> The following patch implements support for inlining code to calculate 
> pow(x,n) [or x**n] where n is known to be an integer constant at compile 
> time.  This is currently done only with -ffast-math by expanding the pow 
> builtin into a sequence of floating point multiplications.  For example, 
> pow(x,6) can be calculated as x2 = x*x; x3 = x2*x; x6 = x3*x3.

Roger,

This looks an excellent optimization.  

A question though, shouldn't this expansion be disabled when optimizing for size?

Kelley Cook




More information about the Gcc-patches mailing list