[committed] testsuite: Add testcase for already fixed PR [PR109362]
Checks
Commit Message
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 <jakub@redhat.com>
PR tree-optimization/109362
* gcc.target/i386/pr109362.c: New test.
Jakub
@@ -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;
+ }
+}