From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id 17055385803F; Fri, 10 Dec 2021 16:48:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17055385803F Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] morello: Set LSB on label in casesi pattern X-Act-Checkin: gcc X-Git-Author: Stam Markianos-Wright X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: b302420cb558d799669fbf7b7f06ec3f8b6f541e X-Git-Newrev: fce30daf2773f194347363b27f47e02d01c0c7ba Message-Id: <20211210164848.17055385803F@sourceware.org> Date: Fri, 10 Dec 2021 16:48:48 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Dec 2021 16:48:48 -0000 https://gcc.gnu.org/g:fce30daf2773f194347363b27f47e02d01c0c7ba commit fce30daf2773f194347363b27f47e02d01c0c7ba Author: Stam Markianos-Wright Date: Wed Oct 20 09:55:33 2021 +0100 morello: Set LSB on label in casesi pattern The `casesi` backend pattern outputs through the aarch64_output_casesi function that emits some manual assembly, which includes an `adr` instruction. The address of the label whose address is taken does not have the LSB set, so if that address is branched to, the processor exits C64 state, which causes an exception to be raised shortly after. This patch adds a `+1` after the label in the `addr` instruction, which sets the LSB on the address, thus preserving the C64 state. Diff: --- gcc/config/aarch64/aarch64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index c60939ebe4f..22bd98ddd2e 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -11776,7 +11776,8 @@ aarch64_output_casesi (rtx *operands) output_asm_insn (patterns[index][0], operands); ASM_GENERATE_INTERNAL_LABEL (label, "Lrtx", CODE_LABEL_NUMBER (operands[2])); snprintf (buf, sizeof (buf), - "adr\t%%4, %s", targetm.strip_name_encoding (label)); + "adr\t%%4, %s%s", targetm.strip_name_encoding (label), + TARGET_CAPABILITY_PURE ? "+1" : ""); output_asm_insn (buf, operands); output_asm_insn (patterns[index][1], operands); output_asm_insn ("br\t%3", operands);