Skip to content
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 load/store mode for add int32 #57

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Fix load/store mode for add int32 #57

merged 2 commits into from
Dec 10, 2024

Conversation

rdjogoTT
Copy link
Contributor

@rdjogoTT rdjogoTT commented Dec 7, 2024

Add int32 needs the values in SFPU LREGS to be in 2's complement for negative addition to work properly.

@rdjogoTT rdjogoTT self-assigned this Dec 7, 2024
@rdjogoTT rdjogoTT removed the request for review from nvelickovicTT December 9, 2024 22:16
inline void _add_int32_(const uint dst_offset) {
// Operand A is input1 (int32)
// Operand B is input2 (int32)
// Output is int32

// Modifies LOAD/STORE to work with INT32 2's complement. Does not convert to INT32 sign-magnitude.
// Modifies LOAD/STORE to do INT32 sign-magnitude to 2's complement conversion, however
// in Blackhole this has no effect and format remains in original format.
constexpr auto INSTR_MOD_LOAD_STORE = InstrModLoadStore::INT32_2S_COMP;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also depend on SIGN_MAGNITUDE_FORMAT flag in principle? I know in BH it doesn't have any effect, but you showed it matters in WH.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it should, I was told that InstrModLoadStore::INT32 was removed so this is the only option now.

@rdjogoTT rdjogoTT merged commit 7536fba into main Dec 10, 2024
1 check 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.

2 participants