Skip to content

Commit

Permalink
Rollup merge of #134396 - mustartt:byval-pointer-natural-alignment, r…
Browse files Browse the repository at this point in the history
…=wesleywiser

AIX: use align 8 for byval parameter

On AIX, byval pointer arguments are aligned to 8 bytes based on the 64bit register size. For example, the C callee https://godbolt.org/z/5f4vnG6bh will expect the following argument.

```
ptr nocapture noundef readonly byval(%struct.TwoU64s) align 8 %0
```

This case is captured by `run-make/extern-fn-explicit-align`
  • Loading branch information
matthiaskrgr authored Jan 22, 2025
2 parents cd1f36b + 7bfcddf commit df01040
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_target/src/callconv/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ where

// The AIX ABI expect byval for aggregates
// See https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/Targets/PPC.cpp.
// The incoming parameter is represented as a pointer in the IR,
// the alignment is associated with the size of the register. (align 8 for 64bit)
if !is_ret && abi == AIX {
arg.pass_by_stack_offset(None);
arg.pass_by_stack_offset(Some(Align::from_bytes(8).unwrap()));
return;
}

Expand Down

0 comments on commit df01040

Please sign in to comment.