Skip to content

Commit 7e4df4d

Browse files
Andrew Watermanccelio
Andrew Waterman
authored andcommitted
Softfloat fcvt.{w/h}.s now returns -MaxInt for -NaN
Behavior now consistent with RISC-V user spec.
1 parent 1b15ab2 commit 7e4df4d

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

softfloat/f32_to_i32.c

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ int_fast32_t f32_to_i32( float32_t a, int_fast8_t roundingMode, bool exact )
2121
sign = signF32UI( uiA );
2222
exp = expF32UI( uiA );
2323
sig = fracF32UI( uiA );
24-
if ( ( exp == 0xFF ) && sig ) sign = 0;
2524
if ( exp ) sig |= 0x00800000;
2625
sig64 = (uint_fast64_t) sig<<32;
2726
shiftCount = 0xAF - exp;

softfloat/f32_to_i64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int_fast64_t f32_to_i64( float32_t a, int_fast8_t roundingMode, bool exact )
2525
shiftCount = 0xBE - exp;
2626
if ( shiftCount < 0 ) {
2727
softfloat_raiseFlags( softfloat_flag_invalid );
28-
if ( ! sign || ( ( exp == 0xFF ) && sig ) ) {
28+
if ( ! sign ) {
2929
return INT64_C( 0x7FFFFFFFFFFFFFFF );
3030
}
3131
return - INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1;

0 commit comments

Comments
 (0)