Fix argument ABI for overaligned structs on ppc64le
When passing a 16 (or higher) aligned struct by value on ppc64le, it needs to be passed as an array of `i128` rather than an array of `i64`. This will force the use of an even starting register. For the case of a 16 byte struct with alignment 16 it is important that `[1 x i128]` is used instead of `i128` -- apparently, the latter will get treated similarly to `[2 x i64]`, not exhibiting the correct ABI. Add a `force_array` flag to `Uniform` to support this. The relevant clang code can be found here:fe2119a7b0/clang/lib/CodeGen/Targets/PPC.cpp (L878-L884)
fe2119a7b0/clang/lib/CodeGen/Targets/PPC.cpp (L780-L784)
I think the corresponding psABI wording is this: > Fixed size aggregates and unions passed by value are mapped to as > many doublewords of the parameter save area as the value uses in > memory. Aggregrates and unions are aligned according to their > alignment requirements. This may result in doublewords being > skipped for alignment. In particular the last sentence. Fixes https://github.com/rust-lang/rust/issues/122767.
This commit is contained in:
parent
a2c72ce594
commit
009280c5e3
15 changed files with 152 additions and 33 deletions
|
@ -150,7 +150,7 @@ impl LlvmType for CastTarget {
|
|||
// Simplify to a single unit or an array if there's no prefix.
|
||||
// This produces the same layout, but using a simpler type.
|
||||
if self.prefix.iter().all(|x| x.is_none()) {
|
||||
if rest_count == 1 {
|
||||
if rest_count == 1 && !self.rest.force_array {
|
||||
return rest_ll_unit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue