From e7d3b54f644a34a42581ab453e485b02f9160ad1 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. (cherry picked from commit 534aad5033dc224ed96118b67a84d496bba500ca) Signed-off-by: Kirill A. Korinsky --- gcc/config/aarch64/aarch64.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git gcc/config/aarch64/aarch64.c gcc/config/aarch64/aarch64.c index dcff477d242..bde27d7d361 100644 --- gcc/config/aarch64/aarch64.c +++ gcc/config/aarch64/aarch64.c @@ -9721,6 +9721,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; } -- 2.42.1