From d7b8bcff91d706ac59fe0c5b76af306ffb415548 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.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index cf5d7b6f2631..d8f60657a874 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -9531,6 +9531,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; }