From 9dd5ce4899ecbae93fee0ba53b03563dc2af9bf7 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 c439882b2e75..b8b803b4200a 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -9429,6 +9429,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; }