From 31de037a0bf98a295850c55d53e6574dfb1518d3 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Thu, 3 Sep 2020 19:09:00 +0100 Subject: [PATCH] Darwin, Arm64 : Account for stack addresses less aligned than DI. darwinpcs, packs some stack items, which means that one cannot guarantee that they are aligned to DI. Check for these cases and reject PRFM instructions then. Note, that this generally results in use of an extra temporary reg. clang uses 'PRFUM' instructions in those cases, so we have a missed optimisation opportunity (low priority). fixes issue #16. --- gcc/config/aarch64/aarch64.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index aaceb7eda3c9..e6e8b5445553 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -10368,6 +10368,10 @@ aarch64_address_valid_for_prefetch_p (rtx x, bool strict_p) if (!res) return false; + /* Darwinpcs allows addresses on the stack that are not DImode aligned. */ + if (TARGET_MACHO && addr.offset && (INTVAL (addr.offset) & 0x07)) + return false; + /* ... except writeback forms. */ return addr.type != ADDRESS_REG_WB; }