Commit d6988187 by Jakub Jelinek Committed by Jakub Jelinek

re PR libquadmath/56379 (libquadmath: Wrong result for strtoflt128.c if compiled with -O0)

	PR libquadmath/56379
	* strtod/strtod_l.c (mpn_lshift_1): Rewritten as function-like
	macro.

From-SVN: r196155
parent 406defcb
2013-02-19 Jakub Jelinek <jakub@redhat.com>
PR libquadmath/56379
* strtod/strtod_l.c (mpn_lshift_1): Rewritten as function-like
macro.
2013-02-17 Tobias Burnus <burnus@net-b.de> 2013-02-17 Tobias Burnus <burnus@net-b.de>
* math/cacoshq.c (cacoshq): Call signbitq instead of signbit. * math/cacoshq.c (cacoshq): Call signbitq instead of signbit.
......
...@@ -421,28 +421,30 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize, ...@@ -421,28 +421,30 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
/* Shift {PTR, SIZE} COUNT bits to the left, and fill the vacated bits /* Shift {PTR, SIZE} COUNT bits to the left, and fill the vacated bits
with the COUNT most significant bits of LIMB. with the COUNT most significant bits of LIMB.
Tege doesn't like this function so I have to write it here myself. :) Implemented as a macro, so that __builtin_constant_p works even at -O0.
Tege doesn't like this macro so I have to write it here myself. :)
--drepper */ --drepper */
static inline void #define mpn_lshift_1(ptr, size, count, limb) \
__attribute ((always_inline)) do \
mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count, { \
mp_limb_t limb) mp_limb_t *__ptr = (ptr); \
{ if (__builtin_constant_p (count) && count == BITS_PER_MP_LIMB) \
if (__builtin_constant_p (count) && count == BITS_PER_MP_LIMB) { \
{ mp_size_t i; \
/* Optimize the case of shifting by exactly a word: for (i = (size) - 1; i > 0; --i) \
just copy words, with no actual bit-shifting. */ __ptr[i] = __ptr[i - 1]; \
mp_size_t i; __ptr[0] = (limb); \
for (i = size - 1; i > 0; --i) } \
ptr[i] = ptr[i - 1]; else \
ptr[0] = limb; { \
} /* We assume count > 0 && count < BITS_PER_MP_LIMB here. */ \
else unsigned int __count = (count); \
{ (void) mpn_lshift (__ptr, __ptr, size, __count); \
(void) mpn_lshift (ptr, ptr, size, count); __ptr[0] |= (limb) >> (BITS_PER_MP_LIMB - __count); \
ptr[0] |= limb >> (BITS_PER_MP_LIMB - count); } \
} } \
} while (0)
#define INTERNAL(x) INTERNAL1(x) #define INTERNAL(x) INTERNAL1(x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment