This is the mail archive of the
mailing list for the GCC project.
Re: Inline round for IA64
- From: Richard Henderson <rth at redhat dot com>
- To: Canqun Yang <canqun at nudt dot edu dot cn>
- Cc: gcc-patches at gcc dot gnu dot org, Jim Wilson <wilson at specifixinc dot com>
- Date: Sat, 17 Jan 2004 15:34:03 -0800
- Subject: Re: Inline round for IA64
- References: <20040116011323.EA9F75BFE6@ds20.nudt.edu.cn>
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);
x = orig;
in rtl from a function in builtins.c, every target would benefit.