From d0f02538494ded78cac12c63f5708a53f5a77bda Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwinge@baylibre.com>
Date: Wed, 17 Jul 2024 15:27:51 +0200
Subject: [PATCH] Enhance 'gcc.target/nvptx/alias-*.c' assembler scanning
... in order to demonstrate unexpected behavior (XFAILed here).
PR target/104957
gcc/testsuite/
* gcc.target/nvptx/alias-1.c: Enhance assembler scanning.
* gcc.target/nvptx/alias-2.c: Likewise.
* gcc.target/nvptx/alias-3.c: Likewise.
* gcc.target/nvptx/alias-4.c: Likewise.
* gcc.target/nvptx/alias-to-alias-1.c: Likewise.
---
gcc/testsuite/gcc.target/nvptx/alias-1.c | 15 ++++++++++---
gcc/testsuite/gcc.target/nvptx/alias-2.c | 16 ++++++++++----
gcc/testsuite/gcc.target/nvptx/alias-3.c | 15 ++++++++++---
gcc/testsuite/gcc.target/nvptx/alias-4.c | 17 ++++++++++----
.../gcc.target/nvptx/alias-to-alias-1.c | 22 ++++++++++++++-----
5 files changed, 66 insertions(+), 19 deletions(-)
@@ -23,6 +23,15 @@ main (void)
return 0;
}
-/* { dg-final { scan-assembler-times "\\.alias f,__f;" 1 } } */
-/* { dg-final { scan-assembler-times "\\.visible \\.func __f;" 1 } } */
-/* { dg-final { scan-assembler-times "\\.visible \\.func f;" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: __f$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func __f;$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: __f$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func __f$} 1 } } */
+
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: f$} 1 { xfail *-*-* } } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func f;$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: f$} 1 { xfail *-*-* } } }
+ { dg-final { scan-assembler-times {(?n)^\.alias f,__f;$} 1 } } */
+
+/* { dg-final { scan-assembler-times {(?n)\tcall __f;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)\tcall f;$} 1 } } */
@@ -5,10 +5,18 @@
#include "alias-1.c"
+/* Note extern and inlined, so still there. */
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: __f$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func __f;$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: __f$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func __f$} 1 } } */
+
/* Inlined, so no alias. */
-/* { dg-final { scan-assembler-not "\\.alias.*;" } } */
-/* { dg-final { scan-assembler-not "\\.visible \\.func f;" } } */
-/* Note extern and inlined, so still there. */
-/* { dg-final { scan-assembler-times "\\.visible \\.func __f;" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: f$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func f;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: f$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^\.alias f,__f;$} 0 } } */
+/* { dg-final { scan-assembler-times {(?n)\tcall __f;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)\tcall f;$} 0 } } */
@@ -25,6 +25,15 @@ main (void)
return 0;
}
-/* { dg-final { scan-assembler-times "\\.alias f,__f;" 1 } } */
-/* { dg-final { scan-assembler-times "\\.func __f;" 1 } } */
-/* { dg-final { scan-assembler-times "\\.func f;" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DECL: __f$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^\.func __f;$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DEF: __f$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^\.func __f$} 1 } } */
+
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DECL: f$} 1 { xfail *-*-* } } }
+ { dg-final { scan-assembler-times {(?n)^\.func f;$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DEF: f$} 1 { xfail *-*-* } } }
+ { dg-final { scan-assembler-times {(?n)^\.alias f,__f;$} 1 } } */
+
+/* { dg-final { scan-assembler-times {(?n)\tcall __f;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)\tcall f;$} 1 } } */
@@ -5,9 +5,18 @@
#include "alias-3.c"
+/* Static and inlined, so it's deleted. */
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DECL: __f$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func __f;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DEF: __f$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func __f$} 0 } } */
+
/* Inlined, so no alias. */
-/* { dg-final { scan-assembler-not "\\.alias.*;" } } */
-/* { dg-final { scan-assembler-not "\\.func f;" } } */
-/* Static and inlined, so it's deleted. */
-/* { dg-final { scan-assembler-not "\\.func __f;" } } */
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DECL: f$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func f;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DEF: f$} 0 } }
+ { dg-final { scan-assembler-times {(?n)^\.alias f,__f;$} 0 } } */
+
+/* { dg-final { scan-assembler-times {(?n)\tcall __f;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)\tcall f;$} 0 } } */
@@ -19,9 +19,21 @@ main (void)
return 0;
}
-/* { dg-final { scan-assembler-times "\\.alias bar,foo;" 1 } } */
-/* { dg-final { scan-assembler-times "\\.visible \\.func foo;" 1 } } */
-/* { dg-final { scan-assembler-times "\\.visible \\.func bar;" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: foo$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func foo;$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: foo$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func foo$} 1 } } */
-/* { dg-final { scan-assembler-times "\\.alias baz,bar;" 1 } } */
-/* { dg-final { scan-assembler-times "\\.visible \\.func baz;" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: bar$} 1 { xfail *-*-* } } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func bar;$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: bar$} 1 { xfail *-*-* } } }
+ { dg-final { scan-assembler-times {(?n)^\.alias bar,foo;$} 1 } } */
+
+/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: baz$} 1 { xfail *-*-* } } }
+ { dg-final { scan-assembler-times {(?n)^\.visible \.func baz;$} 1 } }
+ { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: baz$} 1 { xfail *-*-* } } }
+ { dg-final { scan-assembler-times {(?n)^\.alias baz,bar;$} 1 } } */
+
+/* { dg-final { scan-assembler-times {(?n)\tcall foo;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)\tcall bar;$} 0 } }
+ { dg-final { scan-assembler-times {(?n)\tcall baz;$} 1 } } */
--
2.34.1