summaryrefslogtreecommitdiff
path: root/soft-fp/op-common.h
diff options
context:
space:
mode:
authorMarcus Shawcroft <marcus.shawcroft@linaro.org>2012-11-13 17:01:05 +0000
committerMarcus Shawcroft <marcus.shawcroft@linaro.org>2012-11-13 17:01:05 +0000
commit47594329a9c03fb945f41c19f06401271f9aa9c5 (patch)
tree446ca8eacfca3054d9243cdff7914fa9c134ac68 /soft-fp/op-common.h
parent640ac3f1bf2e575b514645fc03cceeeacf7bd845 (diff)
downloadglibc-47594329a9c03fb945f41c19f06401271f9aa9c5.tar.gz
Fix missing truncation UNDERFLOW.
Diffstat (limited to 'soft-fp/op-common.h')
-rw-r--r--soft-fp/op-common.h25
1 files changed, 11 insertions, 14 deletions
diff --git a/soft-fp/op-common.h b/soft-fp/op-common.h
index db75af53e6..12fb16e5ef 100644
--- a/soft-fp/op-common.h
+++ b/soft-fp/op-common.h
@@ -134,6 +134,12 @@ do { \
#define _FP_PACK_SEMIRAW(fs, wc, X) \
do { \
_FP_ROUND(wc, X); \
+ if (X##_e == 0 && !_FP_FRAC_ZEROP_##wc(X)) \
+ { \
+ if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
+ || (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
+ FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
+ } \
if (_FP_FRAC_HIGH_##fs(X) \
& (_FP_OVERFLOW_##fs >> 1)) \
{ \
@@ -143,24 +149,15 @@ do { \
_FP_OVERFLOW_SEMIRAW(fs, wc, X); \
} \
_FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
- if (!_FP_EXP_NORMAL(fs, wc, X) && !_FP_FRAC_ZEROP_##wc(X)) \
+ if (X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
{ \
- if (X##_e == 0) \
+ if (!_FP_KEEPNANFRACP) \
{ \
- if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) \
- || (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
- FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
+ _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
+ X##_s = _FP_NANSIGN_##fs; \
} \
else \
- { \
- if (!_FP_KEEPNANFRACP) \
- { \
- _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
- X##_s = _FP_NANSIGN_##fs; \
- } \
- else \
- _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_QNANBIT_##fs; \
- } \
+ _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_QNANBIT_##fs; \
} \
} while (0)