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

[compiler-rt] Add missing carry to 128x128->256 wide multiply #97257

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

beetrees
Copy link
Contributor

@beetrees beetrees commented Jul 1, 2024

The addition r0 + (r1 << 64) when calculating lo can overflow. This PR makes sure the overflow is carried into hi.

Credit to @marthadev for the Rust version of this fix in rust-lang/compiler-builtins#587 (comment).

I've tested the fix works locally. I've also added a test to this PR for the fix, although I can't run it locally as the __multf3 test is only run on platforms where long double is f128.

(Note to reviewer: I don't have commit access)

Fixes #90009
Fixes #91840

Copy link

github-actions bot commented Jul 1, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@tgross35
Copy link

tgross35 commented Jul 1, 2024

I've tested the fix works locally. I've also added a test to this PR for the fix, although I can't run it locally as the __multf3 test is only run on platforms where long double is f128.

All these tests probably should change to use __float128 with the q literal suffix at some point

@beetrees

This comment was marked as duplicate.

@beetrees
Copy link
Contributor Author

Ping @compnerd per CODE_OWNERS.TXT.

@tgross35
Copy link

@beetrees is this waiting on anything other than somebody to land it?

@beetrees
Copy link
Contributor Author

beetrees commented Sep 24, 2024

Not as far as I know. I don't have commit access, so I can't merge it myself.

cc @compnerd

@compnerd compnerd merged commit 2495130 into llvm:main Sep 25, 2024
7 checks passed
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this pull request Sep 26, 2024
xgupta pushed a commit to xgupta/llvm-project that referenced this pull request Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

multf3 has incorrect rounding of subnormals Possible incorrect result in compiler-rt 128x128 wideMultiply
4 participants