Skip to content

Document the C ABI for _BitInt and other types. #240

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

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

sunfishcode
Copy link
Member

Document the C ABI for _BitInt, _Complex, __int128_t, and __uint128_t. These follow the ABI currently used by clang, to the best of my knowledge.

Fixes #239.

Document the C ABI for `_BitInt`, `_Complex`, `__int128_t`, and
`__uint128_t`. These follow the ABI currently used by clang, to the
best of my knowledge.

Fixes WebAssembly#239.
@pinskia
Copy link

pinskia commented Dec 2, 2024

Would be nice to get larger than 128 bit _BitInt defined too.

@sunfishcode
Copy link
Member Author

It appears clang doesn't currently support _BitInt wider than 128 on any target other than x86 right now, so there isn't an existing ABI for it on Wasm that we can just document.

@sunfishcode
Copy link
Member Author

sunfishcode commented Dec 9, 2024

The PR here includes documenting the alignment for __int128_t, which turns out to be interesting because Clang defaults __int128_t to 16-byte alignment while LLVM defaults i128 to 8-byte alignment. I've now posted llvm/llvm-project#119204 to propose a fix for LLVM.

@sunfishcode
Copy link
Member Author

If anyone would like to have an ABI for _BitInt(N) where N > 128, they're welcome to file a new PR or issue to start the discussion. This PR is just about documenting existing practice.

@sunfishcode sunfishcode merged commit b35a21d into WebAssembly:main Dec 10, 2024
@sunfishcode sunfishcode deleted the sunfishcode/bitint branch December 10, 2024 18:29
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.

Document Argument passing for _BitInt types
3 participants