diff mbox series

Add 'gcc.target/nvptx/alias-to-alias-1.c' (was: [nvptx] Fix code-gen for alias attribute)

Message ID 871q1zzqv2.fsf@euler.schwinge.ddns.net
State New
Headers show
Series Add 'gcc.target/nvptx/alias-to-alias-1.c' (was: [nvptx] Fix code-gen for alias attribute) | expand

Commit Message

Thomas Schwinge Sept. 4, 2024, 9:54 a.m. UTC
Hi!

On 2024-09-04T11:45:20+0200, I wrote:
> On 2024-08-26T10:50:36+0000, Prathamesh Kulkarni <prathameshk@nvidia.com> wrote:
>> For the following test (adapted from pr96390.c):
>>
>> __attribute__((noipa)) int foo () { return 42; }
>> int bar () __attribute__((alias ("foo")));
>> int baz () __attribute__((alias ("bar")));
>
>> Compiling [for nvptx] results in: [...]

> proposed patch [...] (doesn't affect
> '--target=nvptx-none' test results at all...)

Pushed to trunk branch commit a89321c890b96c583671b73fc802e87545e4a2b1
"Add 'gcc.target/nvptx/alias-to-alias-1.c'", see attached, which as part
of your proposed patch you'll then need to update as follows (or
similar):

    --- gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c
    +++ gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c
    @@ -1,6 +1,8 @@
     /* Alias to alias; 'libgomp.c-c++-common/pr96390.c'.  */
     
    -/* { dg-do compile } */
    +/* { dg-do link } */
    +/* { dg-do run { target runtime_ptx_alias } } */
    +/* { dg-options -save-temps } */
     /* { dg-add-options ptx_alias } */
     
     int v;
    @@ -23,5 +25,6 @@ main (void)
     /* { 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 } } */
    +/* Via 'ultimate_alias_target':
    +   { dg-final { scan-assembler-times "\\.alias baz,foo;" 1 } } */
     /* { dg-final { scan-assembler-times "\\.visible \\.func baz;" 1 } } */


Grüße
 Thomas
diff mbox series

Patch

From a89321c890b96c583671b73fc802e87545e4a2b1 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwinge@baylibre.com>
Date: Wed, 4 Sep 2024 09:44:33 +0200
Subject: [PATCH] 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.
---
 .../gcc.target/nvptx/alias-to-alias-1.c       | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c

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 00000000000..3db79d1fc0b
--- /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 } } */
-- 
2.34.1