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: [PING][PATCH] Expand lround inline for x86_64/i?86 SSE math



On Oct 26, 2006, at 08:51, Richard Guenther wrote:
On Thu, 19 Oct 2006, Richard Guenther wrote:
On Wed, 18 Oct 2006, Geert Bosch wrote:
On Oct 18, 2006, at 12:22, Richard Guenther wrote:
which would be fine (as we can restrict the inline expansion to
-fno-rounding-math then, which is the default).  Now on to a way
to tell real.c to do nextafter (0.5, 0.0) ...

You can lift that code from ada/trans.c:


/* Compute the exact value calc_type'Pred (0.5) at compile time. */
fmt = REAL_MODE_FORMAT (TYPE_MODE (calc_type));
real_2expN (&half_minus_pred_half, -(fmt->p) - 1);
REAL_ARITHMETIC (pred_half, MINUS_EXPR, dconsthalf,
half_minus_pred_half);
gnu_pred_half = build_real (calc_type, pred_half);

Thanks, this did it. Here is an updated patch, bootstrapped and tested on
x86_64-unknown-linux-gnu.


Ok for 4.3?

I re-tested the patch below for its own on top of the already applied patches again.

Hi Richard,


Unfortunately I can't approve this patch. I'll just add my
thumbs up for the numerical portion of the patch.

It would be good to add a comment indicating that the rounding
is not suitable for x87 math, because the addition below
should be performed with exactly one round-to-even operation
using the given real format. For the x87, the rounding is only
valid using XF mode, and only in absence of -frounding-math.

-Geert

+  /* adj = op1 + adj */
+  expand_simple_binop (mode, PLUS, adj, op1, adj, 0, OPTAB_DIRECT);


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