aboutsummaryrefslogtreecommitdiffstats
path: root/include/math-emu/op-common.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/math-emu/op-common.h')
-rw-r--r--include/math-emu/op-common.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index cc1ec396f8d6..f456534dcaf9 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -139,18 +139,27 @@ do { \
139 if (X##_e <= _FP_WFRACBITS_##fs) \ 139 if (X##_e <= _FP_WFRACBITS_##fs) \
140 { \ 140 { \
141 _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \ 141 _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \
142 _FP_ROUND(wc, X); \
143 if (_FP_FRAC_HIGH_##fs(X) \ 142 if (_FP_FRAC_HIGH_##fs(X) \
144 & (_FP_OVERFLOW_##fs >> 1)) \ 143 & (_FP_OVERFLOW_##fs >> 1)) \
145 { \ 144 { \
146 X##_e = 1; \ 145 X##_e = 1; \
147 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \ 146 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
148 FP_SET_EXCEPTION(FP_EX_INEXACT); \
149 } \ 147 } \
150 else \ 148 else \
151 { \ 149 { \
152 X##_e = 0; \ 150 _FP_ROUND(wc, X); \
153 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ 151 if (_FP_FRAC_HIGH_##fs(X) \
152 & (_FP_OVERFLOW_##fs >> 1)) \
153 { \
154 X##_e = 1; \
155 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
156 FP_SET_EXCEPTION(FP_EX_INEXACT); \
157 } \
158 else \
159 { \
160 X##_e = 0; \
161 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
162 } \
154 } \ 163 } \
155 if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \ 164 if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \
156 (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \ 165 (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
@@ -494,6 +503,8 @@ do { \
494 R##_c = FP_CLS_NAN; \ 503 R##_c = FP_CLS_NAN; \
495 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \ 504 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
496 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\ 505 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\
506 break; \
507 \
497 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \ 508 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
498 R##_s = _FP_NANSIGN_##fs; \ 509 R##_s = _FP_NANSIGN_##fs; \
499 R##_c = FP_CLS_NAN; \ 510 R##_c = FP_CLS_NAN; \