https://gcc.gnu.org/g:a7f2bfda7e991268d14c6927747d27d22bd6fd05

commit a7f2bfda7e991268d14c6927747d27d22bd6fd05
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu May 2 11:56:16 2024 +0200

    libgomp: Add gfx90c, 1036 and 1103 declare variant tests
    
    Recently -march=gfx{90c,1036,1103} support has been added, but corresponding
    changes weren't done in the testsuite.
    
    The following patch adds that.
    
    Tested on x86_64-linux (with fiji and gfx1103 devices; had to use
    OMP_DEFAULT_DEVICE=1 there, fiji doesn't really work due to LLVM dropping
    support, but we still list those as offloading devices).
    
    2024-05-02  Jakub Jelinek  <ja...@redhat.com>
    
            * testsuite/libgomp.c/declare-variant-4.h (gfx90c, gfx1036, 
gfx1103):
            New functions.
            (f): Add #pragma omp declare variant directives for those.
            * testsuite/libgomp.c/declare-variant-4-gfx90c.c: New test.
            * testsuite/libgomp.c/declare-variant-4-gfx1036.c: New test.
            * testsuite/libgomp.c/declare-variant-4-gfx1103.c: New test.
    
    (cherry picked from commit 5eb25d1561dd22316331feee92164f97ca79d1c3)

Diff:
---
 libgomp/ChangeLog.omp                              |  9 ++++++++
 .../libgomp.c/declare-variant-4-gfx1036.c          |  8 ++++++++
 .../libgomp.c/declare-variant-4-gfx1103.c          |  8 ++++++++
 .../testsuite/libgomp.c/declare-variant-4-gfx90c.c |  8 ++++++++
 libgomp/testsuite/libgomp.c/declare-variant-4.h    | 24 ++++++++++++++++++++++
 5 files changed, 57 insertions(+)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 8d36078e1e3..1f23346331d 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,12 @@
+2024-05-02  Jakub Jelinek  <ja...@redhat.com>
+
+       * testsuite/libgomp.c/declare-variant-4.h (gfx90c, gfx1036, gfx1103):
+       New functions.
+       (f): Add #pragma omp declare variant directives for those.
+       * testsuite/libgomp.c/declare-variant-4-gfx90c.c: New test.
+       * testsuite/libgomp.c/declare-variant-4-gfx1036.c: New test.
+       * testsuite/libgomp.c/declare-variant-4-gfx1103.c: New test.
+
 2024-05-04  Sandra Loosemore  <sloosem...@baylibre.com>
 
        * libgomp.texi (OpenMP 5.0): Mark metadirective and declare variant
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1036.c 
b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1036.c
new file mode 100644
index 00000000000..93b8641b3e1
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1036.c
@@ -0,0 +1,8 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1036 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump 
"= gfx1036 \\(\\);" "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1103.c 
b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1103.c
new file mode 100644
index 00000000000..6a6dc4fba3f
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1103.c
@@ -0,0 +1,8 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1103 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump 
"= gfx1103 \\(\\);" "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90c.c 
b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90c.c
new file mode 100644
index 00000000000..44629a806b4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90c.c
@@ -0,0 +1,8 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx90c } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump 
"= gfx90c \\(\\);" "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4.h 
b/libgomp/testsuite/libgomp.c/declare-variant-4.h
index d2e9194bf5b..f244d09c655 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4.h
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4.h
@@ -35,6 +35,13 @@ gfx90a (void)
   return 0x90a;
 }
 
+__attribute__ ((noipa))
+int
+gfx90c (void)
+{
+  return 0x90c;
+}
+
 __attribute__ ((noipa))
 int
 gfx1030 (void)
@@ -42,6 +49,13 @@ gfx1030 (void)
   return 0x1030;
 }
 
+__attribute__ ((noipa))
+int
+gfx1036 (void)
+{
+  return 0x1036;
+}
+
 __attribute__ ((noipa))
 int
 gfx1100 (void)
@@ -49,6 +63,13 @@ gfx1100 (void)
   return 0x1100;
 }
 
+__attribute__ ((noipa))
+int
+gfx1103 (void)
+{
+  return 0x1103;
+}
+
 #ifdef USE_FIJI_FOR_GFX803
 #pragma omp declare variant(gfx803) match(device = {isa("fiji")})
 #else
@@ -58,8 +79,11 @@ gfx1100 (void)
 #pragma omp declare variant(gfx906) match(device = {isa("gfx906")})
 #pragma omp declare variant(gfx908) match(device = {isa("gfx908")})
 #pragma omp declare variant(gfx90a) match(device = {isa("gfx90a")})
+#pragma omp declare variant(gfx90c) match(device = {isa("gfx90c")})
 #pragma omp declare variant(gfx1030) match(device = {isa("gfx1030")})
+#pragma omp declare variant(gfx1036) match(device = {isa("gfx1036")})
 #pragma omp declare variant(gfx1100) match(device = {isa("gfx1100")})
+#pragma omp declare variant(gfx1103) match(device = {isa("gfx1103")})
 __attribute__ ((noipa))
 int
 f (void)

Reply via email to