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.
This commit is contained in:
Amanieu d'Antras 2021-01-20 17:08:47 +00:00 committed by Amanieu d'Antras
parent 8afe59893a
commit d53b0a04a6
2 changed files with 3 additions and 30 deletions

View File

@ -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();

View File

@ -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();