[pushed] aarch64: More SME vs -mtrack-speculation
Checks
Commit Message
The sequence to commit a lazy save includes a branch based on
whether TPIDR2_EL0 is zero. The code assumed that CBZ could
be used for this, but that instruction is forbidden when
-mtrack-speculation is being used.
Tested on aarch64-linux-gnu & pushed.
Richard
gcc/
* config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state):
Use aarch64_gen_compare_zero_and_branch rather than emitting
a CBZ directly.
gcc/testsuite/
* gcc.target/aarch64/sme/locally_streaming_1_ts.c: New test.
* gcc.target/aarch64/sme/sibcall_7_ts.c: Likewise.
---
gcc/config/aarch64/aarch64.cc | 3 ++-
gcc/testsuite/gcc.target/aarch64/sme/locally_streaming_1_ts.c | 3 +++
gcc/testsuite/gcc.target/aarch64/sme/sibcall_7_ts.c | 3 +++
3 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.target/aarch64/sme/locally_streaming_1_ts.c
create mode 100644 gcc/testsuite/gcc.target/aarch64/sme/sibcall_7_ts.c
@@ -29344,7 +29344,8 @@ aarch64_mode_emit_local_sme_state (aarch64_local_sme_state mode,
auto tmp_reg = gen_reg_rtx (DImode);
emit_insn (gen_aarch64_read_tpidr2 (tmp_reg));
auto label = gen_label_rtx ();
- auto jump = emit_jump_insn (gen_aarch64_cbeqdi1 (tmp_reg, label));
+ rtx branch = aarch64_gen_compare_zero_and_branch (EQ, tmp_reg, label);
+ auto jump = emit_jump_insn (branch);
JUMP_LABEL (jump) = label;
emit_insn (gen_aarch64_tpidr2_save ());
emit_insn (gen_aarch64_clear_tpidr2 ());
new file mode 100644
@@ -0,0 +1,3 @@
+// { dg-options "-O -fomit-frame-pointer -mtrack-speculation" }
+
+#include "locally_streaming_1.c"
new file mode 100644
@@ -0,0 +1,3 @@
+// { dg-options "-O2 -mtrack-speculation" }
+
+#include "sibcall_7.c"