This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Inline round for IA64
Richard Henderson <rth@redhat.com> writes:
> As mentioned by Jim, you need to protect against overflow.
>
> In addition, one needs to protect against the rounding mode being set
> to something other than round-to-nearest. This, actually, is probably
> a non-starter when it comes to inlining this function.
>
> Are you sure you want to implement round, and not rint or nearbyint?
>
> Finally, there's very little of this that's specific to ia64. Indeed,
> none of it. If you were to generate this:
>
> float rint(float orig)
> {
> float two_exp_p = 1 << FLT_MANT_DIG;
> float x = fabs(orig);
> if (x < two_exp_p)
> {
> x += two_exp_p;
> x -= two_exp_p;
> x = copysignf (x, orig);
> }
> else
> x = orig;
> return x;
> }
>
> in rtl from a function in builtins.c, every target would benefit.
... well, assuming that the real format is right. This won't work for
the two-double 'long double' format used on ppc-aix and ppc-darwin.
But it'd be perfectly fine to use it for ieee_double_format
and ieee_single_format and so on.
--
- Geoffrey Keating <geoffk@geoffk.org>