]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Centralize the complications for special efficient rounding to integers.
authorbde <bde@FreeBSD.org>
Fri, 20 Jul 2018 12:42:24 +0000 (12:42 +0000)
committerbde <bde@FreeBSD.org>
Fri, 20 Jul 2018 12:42:24 +0000 (12:42 +0000)
commitf9cb61fe19d441306c4647c9b0b369f60d650855
tree4b24e3058b5660cc433bc466ac44d2aa1a5c0c92
parent7c83f506833e6e87a2b9ea04f8511a0823b73de4
Centralize the complications for special efficient rounding to integers.

This was open-coded in range reduction for trig and exp functions.  Now
there are 3 static inline functions rnint[fl]() that replace open-coded
expressions, and type-generic irint() and i64rint() macros that hide the
complications for efficiently using non-generic irint() and irintl()
functions and casts.

Special details:

ld128/e_rem_pio2l.h needs to use i64rint() since it needs a 46-bit integer
result.  Everything else only needs a (less than) 32-bit integer result so
uses irint().

Float and double cases now use float_t and double_t locally instead of
STRICT_ASSIGN() to avoid bugs in extra precision.

On amd64, inline asm is now only used for irint() on long doubles.  The SSE
asm for irint() on amd64 only existed because the ifdef tangles made the
correct method of simply casting to int for this case non-obvious.
lib/msun/ld128/e_rem_pio2l.h
lib/msun/ld128/k_expl.h
lib/msun/ld128/s_expl.c
lib/msun/ld80/e_rem_pio2l.h
lib/msun/ld80/k_expl.h
lib/msun/ld80/s_expl.c
lib/msun/src/e_rem_pio2.c
lib/msun/src/e_rem_pio2f.c
lib/msun/src/math_private.h