Skip to content

Implement x87 invalid operation bit on F80 mode#4642

Merged
Sonicadvance1 merged 3 commits intoFEX-Emu:mainfrom
pmatos:feature/x87-invalid-operation-bit
Jul 23, 2025
Merged

Implement x87 invalid operation bit on F80 mode#4642
Sonicadvance1 merged 3 commits intoFEX-Emu:mainfrom
pmatos:feature/x87-invalid-operation-bit

Conversation

@pmatos
Copy link
Copy Markdown
Collaborator

@pmatos pmatos commented Jul 4, 2025

No description provided.

@pmatos pmatos force-pushed the feature/x87-invalid-operation-bit branch 3 times, most recently from 4b86e8c to db1d853 Compare July 4, 2025 13:12
Copy link
Copy Markdown
Collaborator

@bylaws bylaws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be quite afraid of enabling this by default for f64 as is - seems like a ton of extra overhead if there's little depending on it and those that do could probably get deal with f80?.

This could likely be a lot better off in the f64 case using the IOC FPSR flag and somehow keeping track of when that is clobbered in order to flush it at appropriate times - from a brief check it seems to match the x86 behaviour here and would come for free. It would require basically redoing the bulk of your changes though which isn't the best, even if the result would probably be simpler.

Depends what others think, but might make sense to get the f80 side of this split-up and merged and the rest later? Since that's a lot simpler and 'free'

@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 4, 2025

I would be quite afraid of enabling this by default for f64 as is - seems like a ton of extra overhead if there's little depending on it and those that do could probably get deal with f80?.

This could likely be a lot better off in the f64 case using the IOC FPSR flag and somehow keeping track of when that is clobbered in order to flush it at appropriate times - from a brief check it seems to match the x86 behaviour here and would come for free. It would require basically redoing the bulk of your changes though which isn't the best, even if the result would probably be simpler.

Depends what others think, but might make sense to get the f80 side of this split-up and merged and the rest later? Since that's a lot simpler and 'free'

Yeah, I agree with you. I will split this into F80 and F64. I was not aware of the IOC FPSR flag. Will take a look after the split and rework the F64 part. Thanks for the quick turnaround.

@Sonicadvance1
Copy link
Copy Markdown
Member

It should be noted that FP exceptions are optional in ARM spec so not all CPU cores implement it. I believe Apple Silicon and Oryon support it, but Cortex doesn't? We do have a check if the feature is supported that is currently unused although.

@bylaws
Copy link
Copy Markdown
Collaborator

bylaws commented Jul 5, 2025

Even if exceptions aren't implemented, IOC should still be set I think? That would be the main thing here

@Sonicadvance1
Copy link
Copy Markdown
Member

Good shout, I didn't check if the exception is disabled (or forced to zero by unsupported), if the sticky bit changes or not.

@pmatos pmatos force-pushed the feature/x87-invalid-operation-bit branch 2 times, most recently from 75df0ef to 67fe76c Compare July 7, 2025 13:45
@pmatos pmatos changed the title Implement x87 invalid operation bit Implement x87 invalid operation bit on F80 mode Jul 7, 2025
@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 7, 2025

I have updated this PR to focus on F80 (non reduced precision).

I will add a further PR based on this one to add the work for F64.

@pmatos pmatos requested a review from bylaws July 7, 2025 13:48
@pmatos pmatos force-pushed the feature/x87-invalid-operation-bit branch 7 times, most recently from f0ba7b0 to 7a4cd5b Compare July 16, 2025 08:55
@pmatos pmatos requested a review from bylaws July 16, 2025 09:07
@pmatos pmatos force-pushed the feature/x87-invalid-operation-bit branch from 7a4cd5b to 7386b4b Compare July 23, 2025 14:11
@pmatos
Copy link
Copy Markdown
Collaborator Author

pmatos commented Jul 23, 2025

ping @bylaws

Copy link
Copy Markdown
Member

@Sonicadvance1 Sonicadvance1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whew, that's a lot of tests!

@Sonicadvance1 Sonicadvance1 merged commit 525462e into FEX-Emu:main Jul 23, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants