require_extension('D');
require_fp;
-WRITE_FRD(f64_le_quiet(f64(FRS2), f64(FRS1)) || isNaNF64UI(f64(FRS2).v) ? FRS1 : FRS2);
-if ((isNaNF64UI(f64(FRS1).v) && isNaNF64UI(f64(FRS2).v)) || softfloat_exceptionFlags)
+bool greater = f64_lt_quiet(f64(FRS2), f64(FRS1)) ||
+ (f64_eq(f64(FRS2), f64(FRS1)) && (f64(FRS2).v & F64_SIGN));
+WRITE_FRD(greater || isNaNF64UI(f64(FRS2).v) ? FRS1 : FRS2);
+if (isNaNF64UI(f64(FRS1).v) && isNaNF64UI(f64(FRS2).v))
WRITE_FRD(f64(defaultNaNF64UI));
set_fp_exceptions;
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;
require_extension('D');
require_fp;
-WRITE_FRD(f64_lt_quiet(f64(FRS1), f64(FRS2)) || isNaNF64UI(f64(FRS2).v) ? FRS1 : FRS2);
-if ((isNaNF64UI(f64(FRS1).v) && isNaNF64UI(f64(FRS2).v)) || softfloat_exceptionFlags)
+bool less = f64_lt_quiet(f64(FRS1), f64(FRS2)) ||
+ (f64_eq(f64(FRS1), f64(FRS2)) && (f64(FRS1).v & F64_SIGN));
+WRITE_FRD(less || isNaNF64UI(f64(FRS2).v) ? FRS1 : FRS2);
+if (isNaNF64UI(f64(FRS1).v) && isNaNF64UI(f64(FRS2).v))
WRITE_FRD(f64(defaultNaNF64UI));
set_fp_exceptions;
require_extension('F');
require_fp;
-WRITE_FRD(f32_lt_quiet(f32(FRS1), f32(FRS2)) || isNaNF32UI(f32(FRS2).v) ? FRS1 : FRS2);
-if ((isNaNF32UI(f32(FRS1).v) && isNaNF32UI(f32(FRS2).v)) || softfloat_exceptionFlags)
+bool less = f32_lt_quiet(f32(FRS1), f32(FRS2)) ||
+ (f32_eq(f32(FRS1), f32(FRS2)) && (f32(FRS1).v & F32_SIGN));
+WRITE_FRD(less || isNaNF32UI(f32(FRS2).v) ? FRS1 : FRS2);
+if (isNaNF32UI(f32(FRS1).v) && isNaNF32UI(f32(FRS2).v))
WRITE_FRD(f32(defaultNaNF32UI));
set_fp_exceptions;