diff mbox

[AArch64,4.9] Restore recog state after finding pre-madd instruction

Message ID 5450BBD0.3060909@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Oct. 29, 2014, 10:05 a.m. UTC
Hi all,

This is the backport of the trunk patch posted at 
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg03019.html.
It is essentially the same content (only the diff context differs).

Jakub, this is a regression fix so, if ok'd, can we get this into 4.9.2 
please?

Bootstrapped and regtested on aarch64-none-linux-gnu.

Thanks,
Kyrill

2014-10-28  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/aarch64/aarch64.c (aarch64_madd_needs_nop): Restore
     recog state after aarch64_prev_real_insn call.

2014-10-28  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.target/aarch64/madd_after_asm_1.c: New test.

Comments

Marcus Shawcroft Oct. 29, 2014, 7:57 p.m. UTC | #1
On 29 October 2014 10:05, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> Hi all,
>
> This is the backport of the trunk patch posted at
> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg03019.html.
> It is essentially the same content (only the diff context differs).
>
> Jakub, this is a regression fix so, if ok'd, can we get this into 4.9.2
> please?
>
> Bootstrapped and regtested on aarch64-none-linux-gnu.

OK with me, but needs ack from Jakub.
/Marcus
Jakub Jelinek Oct. 29, 2014, 8:02 p.m. UTC | #2
On Wed, Oct 29, 2014 at 07:57:46PM +0000, Marcus Shawcroft wrote:
> On 29 October 2014 10:05, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> > Hi all,
> >
> > This is the backport of the trunk patch posted at
> > https://gcc.gnu.org/ml/gcc-patches/2014-10/msg03019.html.
> > It is essentially the same content (only the diff context differs).
> >
> > Jakub, this is a regression fix so, if ok'd, can we get this into 4.9.2
> > please?
> >
> > Bootstrapped and regtested on aarch64-none-linux-gnu.
> 
> OK with me, but needs ack from Jakub.

Ok if you can get it committed quickly (tonight, or early tomorrow morning
European time), want to do the release tomorrow.

	Jakub
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 34354d4..52c0471 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -6557,6 +6557,10 @@  aarch64_madd_needs_nop (rtx 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)
     return false;
 
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 0000000..523941d
--- /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;
+}