Underflow flag not set at subnormal/normal boundary
Created by: gregdavill
Background
I've been running functional tests/validation on this fpu, by running test vectors generated by testfloat. http://www.jhauser.us/arithmetic/TestFloat.html
I've noticed a class of bugs around the underflow flag. Here are some errors produced by testfloat:
Errors found in f32_mul, rounding near_even:
+01.000000 +7E.7FFFFF => +01.000000 ....x expected +01.000000 ...ux
+01.000000 -7E.7FFFFF => -01.000000 ....x expected -01.000000 ...ux
+01.7FFFFF +7E.000000 => +01.000000 ....x expected +01.000000 ...ux
Errors found in f32_mulAdd, rounding min:
+54.61FFFE -02.70001F -00.7FFFFF
=> -01.000000 ....x expected -01.000000 ...ux
+00.000001 -7D.7FBFFF -00.7FFFFF
=> -01.000000 ....x expected -01.000000 ...ux
This effects the FMA operations using the Multiply operation, (MUL, F[N]MADD, F[N]MSUB). And the DIV operation (Using t-head div/sqrt) This bug shows up for all rounding modes except RTZ.
Issue
The fact that this does not effect the RTZ rounding mode led me to this statement in the spec:
This bug is the corner case, where the final result is +/-b^emin, but the unbounded exponent range lies strictly between +/-b^emin. In this case it appears that the underflow flag should be set, which is what happens in softfloat, but not happening in the FMA or t-head DIV unit.
In RTZ mode you can never hit the case where you round from a subnormal result into a normal result.