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

[X86] Fix i128 argument passing under SysV ABI #158

Closed

Conversation

tgross35
Copy link

Bring https://reviews.llvm.org/D158169 into Rust's tree, cherry picked from fa1b6e6 which will be present in LLVM18.

Author: Nikita Popov <npopov@redhat.com>
Date:   Thu Aug 17 11:55:38 2023 +0200

    [X86] Fix i128 argument passing under SysV ABI

    The x86_64 SysV ABI specifies that __int128 is passed either in
    two registers (if available) or in a 16 byte aligned stack slot.
    GCC implements this behavior. However, if only one free register
    is available, LLVM will instead pass one half of the i128 in a
    register, and the other on the stack.

    Make sure that either both are passed in registers or both on the
    stack.

    Fixes https://github.com/llvm/llvm-project/issues/41784.
    The patch is basically what craig.topper proposed to do there.

    Differential Revision: https://reviews.llvm.org/D158169

Combined with rust-lang/rust#116672, this will resolve i128 ABI problems.

MCP with more details: rust-lang/compiler-team#683

The x86_64 SysV ABI specifies that __int128 is passed either in
two registers (if available) or in a 16 byte aligned stack slot.
GCC implements this behavior. However, if only one free register
is available, LLVM will instead pass one half of the i128 in a
register, and the other on the stack.

Make sure that either both are passed in registers or both on the
stack.

Fixes llvm#41784.
The patch is basically what craig.topper proposed to do there.

Differential Revision: https://reviews.llvm.org/D158169

(cherry picked from commit fa1b6e6)
@tgross35
Copy link
Author

r? @nikic

@nikic
Copy link

nikic commented Dec 15, 2023

We cannot backport this ABI-changing patch. This part of the fix will have to wait for LLVM 18.

@tgross35 tgross35 closed this Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants