Richard Guenther - Re: [PATCH]: Add folding of ldexp/scalbn/scalbln (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.
This patch adds folding of ldexp, scalbn and scalbln. It always transforms the following cases for all three builtins:
f(+-0, y) -> +-0 f(+-Inf, y) -> +-Inf f(NaN, y) -> NaN f(x, 0) -> x
When both arguments are constant, then I evaluate ldexp using real.c:real_ldexp(). If the radix is 2, then I also do that for scalbn/scalbln. I believe at the moment, all supported targets use a radix of 2, but I check for it anyway just in case.
Tested on sparc-sun-solaris2.10, no regressions and the new cases all pass.
Okay for mainline?