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: Inline round for IA64


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.


r~


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