From 3fea1a75f5a7f9bba73e2b7dbf40aeee41a51983 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 29 Oct 2014 21:44:05 +0000 Subject: [PATCH] [AArch64] Restore recog state after finding pre-madd instruction * config/aarch64/aarch64.c (aarch64_madd_needs_nop): Restore recog state after aarch64_prev_real_insn call. * gcc.target/aarch64/madd_after_asm_1.c: New test. From-SVN: r216852 --- gcc/ChangeLog | 5 +++++ gcc/config/aarch64/aarch64.c | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/aarch64/madd_after_asm_1.c | 14 ++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c85fa9361c..80935753a35 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-10-29 Kyrylo Tkachov + + * config/aarch64/aarch64.c (aarch64_madd_needs_nop): Restore + recog state after aarch64_prev_real_insn call. + 2014-10-29 Kyrylo Tkachov * config/aarch64/aarch64.h (MACHMODE): Add 'enum' to machine_mode. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index e222ee37cf2..0400fd503d2 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -7770,6 +7770,10 @@ aarch64_madd_needs_nop (rtx_insn* insn) return false; prev = aarch64_prev_real_insn (insn); + /* aarch64_prev_real_insn can call recog_memoized on insns other than INSN. + Restore recog state to INSN to avoid state corruption. */ + extract_constrain_insn_cached (insn); + if (!prev || !has_memory_op (prev)) return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2955cfd58e3..a362f135782 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-10-29 Kyrylo Tkachov + + * gcc.target/aarch64/madd_after_asm_1.c: New test. + 2014-10-29 DJ Delorie * gcc.dg/20141029-1.c: New. diff --git a/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c b/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c new file mode 100644 index 00000000000..523941d4792 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c @@ -0,0 +1,14 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -mfix-cortex-a53-835769" } */ + +int +test (int a, double b, int c, int d, int e) +{ + double result; + __asm__ __volatile ("// %0, %1" + : "=w" (result) + : "0" (b) + : /* No clobbers */ + ); + return c * d + e; +} -- 2.30.2