1
0
mirror of https://github.com/openbsd/src.git synced 2026-05-01 01:27:08 +00:00

Backport aarch64 SVE compile fix from upstream

From Brad, ok kettenis@
This commit is contained in:
jca
2026-01-06 22:24:03 +00:00
parent c7117ed52e
commit 5597866b8b

View File

@@ -2471,6 +2471,19 @@ MVT AArch64TargetLowering::getScalarShiftAmountTy(const DataLayout &DL,
bool AArch64TargetLowering::allowsMisalignedMemoryAccesses(
EVT VT, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags,
unsigned *Fast) const {
// Allow SVE loads/stores where the alignment >= the size of the element type,
// even with +strict-align. Predicated SVE loads/stores (e.g. ld1/st1), used
// for stores that come from IR, only require element-size alignment (even if
// unaligned accesses are disabled). Without this, these will be forced to
// have 16-byte alignment with +strict-align (and fail to lower as we don't
// yet support TLI.expandUnalignedLoad() and TLI.expandUnalignedStore()).
if (VT.isScalableVector()) {
unsigned ElementSizeBits = VT.getScalarSizeInBits();
if (ElementSizeBits % 8 == 0 && Alignment >= Align(ElementSizeBits / 8))
return true;
}
if (Subtarget->requiresStrictAlign())
return false;