https://gcc.gnu.org/g:3784839eb2d584a377ce833b846ce3cade148adf

commit 3784839eb2d584a377ce833b846ce3cade148adf
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Wed Sep 4 09:44:33 2024 +0200

    Add 'gcc.target/nvptx/alias-to-alias-1.c'
    
    ... similar to alias to alias usage in 'libgomp.c-c++-common/pr96390.c'.
    
            PR target/104957
            gcc/testsuite/
            * gcc.target/nvptx/alias-to-alias-1.c: New.
    
    (cherry picked from commit a89321c890b96c583671b73fc802e87545e4a2b1)

Diff:
---
 gcc/testsuite/ChangeLog.omp                       |  6 +++++
 gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c | 27 +++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index 0393d74ec16f..a19ef2dcd7e4 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -3,6 +3,12 @@
        Backported from trunk:
        2024-09-04  Thomas Schwinge  <tschwi...@baylibre.com>
 
+       PR target/104957
+       * gcc.target/nvptx/alias-to-alias-1.c: New.
+
+       Backported from trunk:
+       2024-09-04  Thomas Schwinge  <tschwi...@baylibre.com>
+
        * gcc.target/nvptx/alias-weak-1.c: New.
 
 2024-07-30  Tobias Burnus  <tbur...@baylibre.com>
diff --git a/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c 
b/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c
new file mode 100644
index 000000000000..3db79d1fc0bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c
@@ -0,0 +1,27 @@
+/* Alias to alias; 'libgomp.c-c++-common/pr96390.c'.  */
+
+/* { dg-do compile } */
+/* { dg-add-options ptx_alias } */
+
+int v;
+
+void foo () { v = 42; }
+void bar () __attribute__((alias ("foo")));
+void baz () __attribute__((alias ("bar")));
+
+int
+main (void)
+{
+  baz ();
+  if (v != 42)
+    __builtin_abort ();
+
+  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 "\\.alias baz,bar;" 1 } } */
+/* { dg-final { scan-assembler-times "\\.visible \\.func baz;" 1 } } */

Reply via email to