-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversion from FP32 -2^31 to INT32 sets NV status #83
Comments
Hi @pashenden It seems same kind of bug as already reported here. Thanks for reporting. |
Yes, same bug. In that issue, the operand value is 0xcf000000, and the fcvt.w.s instruction would invoke the F2I operation in the FPU. So fixing the FPU should address the bug in the processor core. |
Correctly convert signed integers of negative max-magnitude value without erroneously flagging an overflow condition issue: openhwgroup#83 Signed-off-by: Greg Davill <greg.davill@gmail.com>
@pascalgouedo Can this issue be closed now with #97 merged? |
Hi @gregdavill |
Fixed with release v0.8.1. |
In v0.7.0, converting the FP32 value -2147483648.0 to INT32 produces the result 0x80000000 and sets the NV status flag. However, the input value can be exactly represented as an INT32.
Test case:
Root cause:
These lines do not take account of the fact that for the valid input value, the exponent is exactly 31. If the sign is negative and the mantissa is 0x80000000 in this case, there should not be overflow.
The text was updated successfully, but these errors were encountered: