[committed] testsuite: Add testcase for already fixed PR [PR109362]

Message ID ZCfXdZvpU0rv6Ezk@tucnak
State Accepted
Headers
Series [committed] testsuite: Add testcase for already fixed PR [PR109362] |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jakub Jelinek April 1, 2023, 7:04 a.m. UTC
  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
  

Patch

--- 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;
+    }
+}