-
Notifications
You must be signed in to change notification settings - Fork 121
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
Fix FXTRACT for 0.0 and -0.0 #4093
base: main
Are you sure you want to change the base?
Conversation
For context the spec mentions that for fscale:
When testing this, through |
96fe7af
to
6fe0e35
Compare
All good here now - instcounci failure coming from #4092 that needs to land before this one. |
Behaves like NZCVSelect for FPRs.
Fixes fxtract by returning the correct values for 0.0 and -0.0. We moved the split of fxtract into _sig and _exp, to the opcode dispatcher, to ease some comparisons. Also removed the IR node F80XTRACTStack which is not needed anymore.
pinging here for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me, but I'll leave it to Alyssa for the IR change.
@@ -256,6 +260,12 @@ struct FEX_PACKED X80SoftFloat { | |||
|
|||
return Result; | |||
#else | |||
// Zero is a special case, the exponent is always -inf | |||
if (lhs.Exponent == 0x0 && lhs.Significand == 0x0) { | |||
X80SoftFloat Result(1, 0x7FFFUL, 0x8000000000000000UL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded constants with lots of zeroes like these are prone to typos that aren't easily caught in code review either. There's two ways to avoid this issue:
- Compute the constant symbolically:
1UL << 63
- Use digit separators to make double-checking easier:
0x8000'0000'0000'0000UL
(Mentioning this here because the PR adds a bunch such constants and I stopped counting zeroes after the first one)
Fixes fxtract by returning the correct values for 0.0 and -0.0. We moved the split of fxtract into _sig and _exp, to the opcode dispatcher, to ease some comparisons.
Also removed the IR node F80XTRACTStack which is not needed anymore.
Depends on landing #4092 (commit d62dd50 included here but to be merged separately)