diff options
| author | Amanieu d'Antras <amanieu.dantras@huawei.com> | 2021-01-20 17:08:47 +0000 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2021-01-27 22:47:56 +0000 |
| commit | d53b0a04a6a0f5048b37da2c14ac0cdabae5d348 (patch) | |
| tree | 163d77e511f0b7ea5c4ca8e9bbafb032fead6cf4 /compiler/rustc_target | |
| parent | 8afe59893a7b3586b29b0bb697eba69e1a2b5593 (diff) | |
| download | rust-d53b0a04a6a0f5048b37da2c14ac0cdabae5d348.tar.gz rust-d53b0a04a6a0f5048b37da2c14ac0cdabae5d348.zip | |
Fix ARM and AArch64 calling convention for passing small composite types
On big-endian the values need to be right-aligned within a 64-bit register, as if the value had been read with a 64-bit load instruction.
Diffstat (limited to 'compiler/rustc_target')
| -rw-r--r-- | compiler/rustc_target/src/abi/call/aarch64.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_target/src/abi/call/arm.rs | 9 |
2 files changed, 3 insertions, 30 deletions
diff --git a/compiler/rustc_target/src/abi/call/aarch64.rs b/compiler/rustc_target/src/abi/call/aarch64.rs index 1ab7722edab..a5e985d4712 100644 --- a/compiler/rustc_target/src/abi/call/aarch64.rs +++ b/compiler/rustc_target/src/abi/call/aarch64.rs @@ -40,17 +40,7 @@ where let size = ret.layout.size; let bits = size.bits(); if bits <= 128 { - let unit = if bits <= 8 { - Reg::i8() - } else if bits <= 16 { - Reg::i16() - } else if bits <= 32 { - Reg::i32() - } else { - Reg::i64() - }; - - ret.cast_to(Uniform { unit, total: size }); + ret.cast_to(Uniform { unit: Reg::i64(), total: size }); return; } ret.make_indirect(); @@ -72,17 +62,7 @@ where let size = arg.layout.size; let bits = size.bits(); if bits <= 128 { - let unit = if bits <= 8 { - Reg::i8() - } else if bits <= 16 { - Reg::i16() - } else if bits <= 32 { - Reg::i32() - } else { - Reg::i64() - }; - - arg.cast_to(Uniform { unit, total: size }); + arg.cast_to(Uniform { unit: Reg::i64(), total: size }); return; } arg.make_indirect(); diff --git a/compiler/rustc_target/src/abi/call/arm.rs b/compiler/rustc_target/src/abi/call/arm.rs index 26fed3bae4e..b560e11fe1c 100644 --- a/compiler/rustc_target/src/abi/call/arm.rs +++ b/compiler/rustc_target/src/abi/call/arm.rs @@ -45,14 +45,7 @@ where let size = ret.layout.size; let bits = size.bits(); if bits <= 32 { - let unit = if bits <= 8 { - Reg::i8() - } else if bits <= 16 { - Reg::i16() - } else { - Reg::i32() - }; - ret.cast_to(Uniform { unit, total: size }); + ret.cast_to(Uniform { unit: Reg::i32(), total: size }); return; } ret.make_indirect(); |
