diff options
author | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-03-17 00:57:21 -0700 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-03-23 21:53:53 -0700 |
commit | 8663f6494e61185a20df0e87c5f17898ab86e7d7 (patch) | |
tree | 0c1e54c0d73483d2a4b1ab2da5a4037ea2be28b6 /softfloat | |
parent | 7bdc7c2017239f0673b25be6961743763a8413c3 (diff) | |
download | spike-8663f6494e61185a20df0e87c5f17898ab86e7d7.zip spike-8663f6494e61185a20df0e87c5f17898ab86e7d7.tar.gz spike-8663f6494e61185a20df0e87c5f17898ab86e7d7.tar.bz2 |
rvv: sf: handle signaling NaN for fmax/fmin
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'softfloat')
-rw-r--r-- | softfloat/fall_maxmin.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/softfloat/fall_maxmin.c b/softfloat/fall_maxmin.c index 08f1d40..32a9ade 100644 --- a/softfloat/fall_maxmin.c +++ b/softfloat/fall_maxmin.c @@ -45,31 +45,31 @@ 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 ) \ { \ + bool greater = f ## bits ## _lt_quiet(b, a) || \ + (f ## bits ## _eq(b, a) && signF ## bits ## UI(b.v)); \ + \ 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; \ + } else { \ + return greater || isNaNF ## bits ## UI((b).v) ? a : b; \ } \ - \ - bool greater = f ## bits ## _lt_quiet(b, a) || \ - (f ## bits ## _eq(b, a) && signF ## bits ## UI(b.v)); \ - \ - return greater || isNaNF ## bits ## UI((b).v) ? a : b; \ } #define COMPARE_MIN(a, b, bits) \ float ## bits ## _t f ## bits ## _min( float ## bits ## _t a, float ## bits ## _t b ) \ { \ + bool less = f ## bits ## _lt_quiet(a, b) || \ + (f ## bits ## _eq(a, b) && signF ## bits ## UI(a.v)); \ + \ 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; \ + } else { \ + return less || isNaNF ## bits ## UI((b).v) ? a : b; \ } \ - \ - bool greater = f ## bits ## _lt_quiet(a, b) || \ - (f ## bits ## _eq(a, b) && signF ## bits ## UI(a.v)); \ - \ - return greater || isNaNF ## bits ## UI((b).v) ? a : b; \ } COMPARE_MAX(a, b, 16); |