aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/fmax_s.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/fmax_s.h')
-rw-r--r--riscv/insns/fmax_s.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/riscv/insns/fmax_s.h b/riscv/insns/fmax_s.h
index 2f570ea..33e535b 100644
--- a/riscv/insns/fmax_s.h
+++ b/riscv/insns/fmax_s.h
@@ -1,6 +1,8 @@
require_extension('F');
require_fp;
-WRITE_FRD(f32_le_quiet(f32(FRS2), f32(FRS1)) || isNaNF32UI(f32(FRS2).v) ? FRS1 : FRS2);
-if ((isNaNF32UI(f32(FRS1).v) && isNaNF32UI(f32(FRS2).v)) || softfloat_exceptionFlags)
+bool greater = f32_lt_quiet(f32(FRS2), f32(FRS1)) ||
+ (f32_eq(f32(FRS2), f32(FRS1)) && (f32(FRS2).v & F32_SIGN));
+WRITE_FRD(greater || isNaNF32UI(f32(FRS2).v) ? FRS1 : FRS2);
+if (isNaNF32UI(f32(FRS1).v) && isNaNF32UI(f32(FRS2).v))
WRITE_FRD(f32(defaultNaNF32UI));
set_fp_exceptions;