aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2020-03-17 00:57:21 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2020-03-17 00:57:21 -0700
commitaafd56631474edc3921bc4daf9dc234954eb5267 (patch)
tree8d851eec14ad7678adc69b342059b45da081fdf8
parent450508a8cb7efb579bbb3722668ead16837a6e3c (diff)
downloadspike-aafd56631474edc3921bc4daf9dc234954eb5267.zip
spike-aafd56631474edc3921bc4daf9dc234954eb5267.tar.gz
spike-aafd56631474edc3921bc4daf9dc234954eb5267.tar.bz2
rvv: sf: handle signaling NaN for fmax/fmin
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
-rw-r--r--softfloat/fall_maxmin.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/softfloat/fall_maxmin.c b/softfloat/fall_maxmin.c
index 08f1d40..6405cf1 100644
--- a/softfloat/fall_maxmin.c
+++ b/softfloat/fall_maxmin.c
@@ -45,7 +45,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define COMPARE_MAX(a, b, bits) \
float ## bits ## _t f ## bits ## _max( float ## bits ## _t a, float ## bits ## _t b ) \
{ \
- if (isNaNF ## bits ## UI(a.v) && isNaNF ## bits ## UI(b.v)) { \
+ if (f ## bits ## _isSignalingNaN(a) || \
+ f ## bits ## _isSignalingNaN(b)) { \
+ union ui ## bits ## _f ## bits ui; \
+ ui.ui = defaultNaNF ## bits ## UI; \
+ softfloat_raiseFlags( softfloat_flag_invalid ); \
+ return ui.f; \
+ } else if (isNaNF ## bits ## UI(a.v) && isNaNF ## bits ## UI(b.v)) { \
union ui ## bits ## _f ## bits ui; \
ui.ui = defaultNaNF ## bits ## UI; \
return ui.f; \
@@ -60,7 +66,13 @@ float ## bits ## _t f ## bits ## _max( float ## bits ## _t a, float ## bits ## _
#define COMPARE_MIN(a, b, bits) \
float ## bits ## _t f ## bits ## _min( float ## bits ## _t a, float ## bits ## _t b ) \
{ \
- if (isNaNF ## bits ## UI(a.v) && isNaNF ## bits ## UI(b.v)) { \
+ if (f ## bits ## _isSignalingNaN(a) || \
+ f ## bits ## _isSignalingNaN(b)) { \
+ union ui ## bits ## _f ## bits ui; \
+ ui.ui = defaultNaNF ## bits ## UI; \
+ softfloat_raiseFlags( softfloat_flag_invalid ); \
+ return ui.f; \
+ } else if (isNaNF ## bits ## UI(a.v) && isNaNF ## bits ## UI(b.v)) { \
union ui ## bits ## _f ## bits ui; \
ui.ui = defaultNaNF ## bits ## UI; \
return ui.f; \