diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-22 11:51:54 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-22 11:51:54 +0000 |
commit | 8564db8424b6988dd1b665e29f579c732a6001dc (patch) | |
tree | c203317dc88ea9f1a0fdb079333a2e6086f51b0e /libquadmath | |
parent | 49e6b159a6b2225a0198f8e261c6b6f3772fba3f (diff) | |
download | gcc-8564db8424b6988dd1b665e29f579c732a6001dc.tar.gz |
2013-02-22 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 196218 using svnmerge.py
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@196219 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libquadmath')
-rw-r--r-- | libquadmath/ChangeLog | 6 | ||||
-rw-r--r-- | libquadmath/strtod/strtod_l.c | 44 |
2 files changed, 29 insertions, 21 deletions
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog index 3c293cfac5e..15c0739319d 100644 --- a/libquadmath/ChangeLog +++ b/libquadmath/ChangeLog @@ -1,3 +1,9 @@ +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> * math/cacoshq.c (cacoshq): Call signbitq instead of signbit. diff --git a/libquadmath/strtod/strtod_l.c b/libquadmath/strtod/strtod_l.c index d1845a8039c..0b0e85a3cf7 100644 --- a/libquadmath/strtod/strtod_l.c +++ b/libquadmath/strtod/strtod_l.c @@ -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 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 */ -static inline void -__attribute ((always_inline)) -mpn_lshift_1 (mp_limb_t *ptr, mp_size_t size, unsigned int count, - mp_limb_t limb) -{ - if (__builtin_constant_p (count) && count == BITS_PER_MP_LIMB) - { - /* Optimize the case of shifting by exactly a word: - just copy words, with no actual bit-shifting. */ - mp_size_t i; - for (i = size - 1; i > 0; --i) - ptr[i] = ptr[i - 1]; - ptr[0] = limb; - } - else - { - (void) mpn_lshift (ptr, ptr, size, count); - ptr[0] |= limb >> (BITS_PER_MP_LIMB - count); - } -} +#define mpn_lshift_1(ptr, size, count, limb) \ + do \ + { \ + mp_limb_t *__ptr = (ptr); \ + if (__builtin_constant_p (count) && count == BITS_PER_MP_LIMB) \ + { \ + mp_size_t i; \ + for (i = (size) - 1; i > 0; --i) \ + __ptr[i] = __ptr[i - 1]; \ + __ptr[0] = (limb); \ + } \ + else \ + { \ + /* We assume count > 0 && count < BITS_PER_MP_LIMB here. */ \ + unsigned int __count = (count); \ + (void) mpn_lshift (__ptr, __ptr, size, __count); \ + __ptr[0] |= (limb) >> (BITS_PER_MP_LIMB - __count); \ + } \ + } \ + while (0) #define INTERNAL(x) INTERNAL1(x) |