Skip to content

Fix the ABI of Option<u128> on x86_64#7770

Merged
abrown merged 1 commit into
bytecodealliance:mainfrom
bjorn3:fix_x64_option_i128_abi
Jan 11, 2024
Merged

Fix the ABI of Option<u128> on x86_64#7770
abrown merged 1 commit into
bytecodealliance:mainfrom
bjorn3:fix_x64_option_i128_abi

Conversation

@bjorn3
Copy link
Copy Markdown
Contributor

@bjorn3 bjorn3 commented Jan 11, 2024

LLVM passes the tag in rax and the u128 val in rdx/rcx. Before this change Cranelift would pass the first half of the value in rdx and the second half using an implicit return value pointer.

Fixes rust-lang/rustc_codegen_cranelift#1449

@bjorn3 bjorn3 requested a review from a team as a code owner January 11, 2024 16:13
@bjorn3 bjorn3 requested review from abrown and removed request for a team January 11, 2024 16:13
LLVM passes the tag in rax and the u128 val in rdx/rcx. Before this
change Cranelift would pass the first half of the value in rdx and the
second half using an implicit return value pointer.
@bjorn3 bjorn3 force-pushed the fix_x64_option_i128_abi branch from 360a9ab to 9210ae5 Compare January 11, 2024 16:32
Copy link
Copy Markdown
Member

@abrown abrown left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

@abrown
Copy link
Copy Markdown
Member

abrown commented Jan 11, 2024

@bjorn3, I tried to look this up in the LLVM documentation but all I can find is a mention of RCX in the swiftcc calling convention here. Where do you see it?

@bjorn3
Copy link
Copy Markdown
Contributor Author

bjorn3 commented Jan 11, 2024

See eg https://rust.godbolt.org/z/fTM6o84xq Fair chance it isn't documented anywhere, this requires the enable_llvm_abi_extensions flag in Cranelift for a reason.

@abrown abrown added this pull request to the merge queue Jan 11, 2024
Merged via the queue into bytecodealliance:main with commit df270a4 Jan 11, 2024
@bjorn3 bjorn3 deleted the fix_x64_option_i128_abi branch January 11, 2024 21:18
bjorn3 added a commit to bjorn3/wasmtime that referenced this pull request Jan 11, 2024
LLVM passes the tag in rax and the u128 val in rdx/rcx. Before this
change Cranelift would pass the first half of the value in rdx and the
second half using an implicit return value pointer.
alexcrichton pushed a commit that referenced this pull request Jan 11, 2024
LLVM passes the tag in rax and the u128 val in rdx/rcx. Before this
change Cranelift would pass the first half of the value in rdx and the
second half using an implicit return value pointer.
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.

i128 abi incompatibility with cg_llvm

2 participants