[RFC PATCH]: Reciprocal sqrt (rsqrt) conversion pass

Paolo Bonzini bonzini@gnu.org
Wed Jun 13 12:36:00 GMT 2007


> a / sqrt(b / c) => a * rsqrt (c / b)
> sqrt (a /  b) => rsqrt ( b / a)
> sqrt (a) => a * rsqrt (a)
> 
> There are actually two passes, one is part of the recip pass,
> searching for the first form, and the second is rsqrt pass that
> searches for other two forms. Two passes are necessary to prevent
> sqrt() in the first form to convert to a * rsqrt(a).

I think the last one should be done at expansion time (in fact, I would 
rather see "a * rsqrt (a)" canonicalized to "sqrt (a)" while working on 
trees).  Would this be enough to avoid the need for a separate pass?

Paolo



More information about the Gcc-patches mailing list