Hi!

This PR got fixed with r13-137.
Add a testcase to make sure it doesn't reappear.

Regtested on x86_64-linux and i686-linux, committed to trunk as obvious.

2023-04-01  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/109362
        * gcc.target/i386/pr109362.c: New test.

--- gcc/testsuite/gcc.target/i386/pr109362.c.jj 2023-03-31 17:36:08.396428411 
+0200
+++ gcc/testsuite/gcc.target/i386/pr109362.c    2023-03-31 17:35:49.768696966 
+0200
@@ -0,0 +1,19 @@
+/* PR tree-optimization/109362 */
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O2 -masm=att" } */
+/* Ensure we don't waste a register set to %rdi + 8.  */
+/* { dg-final { scan-assembler "\tmovq\t\\\(%rdi\\\), %r" } } */
+/* { dg-final { scan-assembler "\tmovq\t8\\\(%rdi\\\), %r" } } */
+
+struct S { long a, b; };
+
+int
+foo (struct S *v)
+{
+  while (1)
+    {
+      __atomic_load_n (&v->a, __ATOMIC_ACQUIRE);
+      if (__atomic_load_n (&v->b, __ATOMIC_ACQUIRE))
+       return 1;
+    }
+}

        Jakub

Reply via email to