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: [RFC PATCH]: Reciprocal sqrt (rsqrt) conversion pass



Also note, that rsqrt is a target builtin (available in all
frontends).

I think it should be target-independent the same way as cexpi (putting it in all the front-ends :-( unfortunately). Furthermore, place it in an optab so that target-independent code in expand can use it to expand sqrt(a) to a*sqrt(a) and a/sqrt(b) to a*rsqrt(b).


For the latter, if there is a single use of sqrt(b), TER will build the expression for you so that you can magically see it in expand. For more complex cases, the cse-recip pass can do a/sqrt(b)=>a*rsqrt(b), by modifying the creation of the reciprocal value (testing if the RHS is a sqrt).

I think you should also do the sqrt(a/b)=>rsqrt(b/a) transformation at the beginning of the cse-recip pass, possibly with a separate loop. If possible, make sure that it is further converted to rsqrt(b*(1/a)) by the same pass if profitable. (This however is thin ice). Of course, tree-ssa-math-opts.c can also look at the optab to avoid doing a fruitless transformation.

a/b is already mangled by NR-enhanced reciprocal
transformation.

NR-enhanced reciprocals should also be created at expansion time only, so that the recip pass can see what they do.


Paolo


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