public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] morello: Set LSB on label in casesi pattern
@ 2021-12-10 16:48 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-12-10 16:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fce30daf2773f194347363b27f47e02d01c0c7ba

commit fce30daf2773f194347363b27f47e02d01c0c7ba
Author: Stam Markianos-Wright <stam.markianos-wright@arm.com>
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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-10 16:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 16:48 [gcc(refs/vendors/ARM/heads/morello)] morello: Set LSB on label in casesi pattern Matthew Malcomson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).