gcc/
        * config/nvptx/nvptx-sm.def: Add '52'.
        * config/nvptx/nvptx-gen.h: Regenerate.
        * config/nvptx/nvptx-gen.opt: Likewise.
        * config/nvptx/nvptx.cc (first_ptx_version_supporting_sm): Adjust.
        * config/nvptx/nvptx.opt (-march-map=sm_52): Likewise.
        * config.gcc: Likewise.
        * doc/invoke.texi (Nvidia PTX Options): Document '-march=sm_52'.
        * config/nvptx/gen-multilib-matches-tests: Extend.
        gcc/testsuite/
        * gcc.target/nvptx/march-map=sm_52.c: Adjust.
        * gcc.target/nvptx/march=sm_52.c: New.
        libgomp/
        * testsuite/libgomp.c/declare-variant-3-sm52.c: New.
        * testsuite/libgomp.c/declare-variant-3.h: Adjust.
---
 gcc/config.gcc                                |  2 +-
 gcc/config/nvptx/gen-multilib-matches-tests   | 41 ++++++++++++++++---
 gcc/config/nvptx/nvptx-gen.h                  |  1 +
 gcc/config/nvptx/nvptx-gen.opt                |  3 ++
 gcc/config/nvptx/nvptx-sm.def                 |  1 +
 gcc/config/nvptx/nvptx.cc                     |  1 +
 gcc/config/nvptx/nvptx.opt                    |  2 +-
 gcc/doc/invoke.texi                           |  2 +-
 .../gcc.target/nvptx/march-map=sm_52.c        |  4 +-
 gcc/testsuite/gcc.target/nvptx/march=sm_52.c  | 19 +++++++++
 .../libgomp.c/declare-variant-3-sm52.c        |  8 ++++
 .../testsuite/libgomp.c/declare-variant-3.h   |  8 ++++
 12 files changed, 81 insertions(+), 11 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/nvptx/march=sm_52.c
 create mode 100644 libgomp/testsuite/libgomp.c/declare-variant-3-sm52.c

diff --git a/gcc/config.gcc b/gcc/config.gcc
index b68ede921ec9..21f3dcd9d009 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -5643,7 +5643,7 @@ case "${target}" in
                        case $nvptx_multilib in
                        #TODO 'sm_[...]' list per 'nvptx-sm.def'.
                        sm_30 | sm_35 | sm_37 \
-                       | sm_53 \
+                       | sm_52 | sm_53 \
                        | sm_70 | sm_75 \
                        | sm_80 )
                                TM_MULTILIB_CONFIG="$TM_MULTILIB_CONFIG 
$nvptx_multilib"
diff --git a/gcc/config/nvptx/gen-multilib-matches-tests 
b/gcc/config/nvptx/gen-multilib-matches-tests
index 87045040b11a..13b1c5b9d018 100644
--- a/gcc/config/nvptx/gen-multilib-matches-tests
+++ b/gcc/config/nvptx/gen-multilib-matches-tests
@@ -16,6 +16,7 @@ SMOIL sm_30
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -28,14 +29,15 @@ SMOIL sm_30 sm_80
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 CMMC
 
-BEGIN '--with-arch=sm_30', 
'--with-multilib-list=sm_30,sm_35,sm_37,sm_53,sm_70,sm_75,sm_80'
+BEGIN '--with-arch=sm_30', 
'--with-multilib-list=sm_30,sm_35,sm_37,sm_52,sm_53,sm_70,sm_75,sm_80'
 SMOID sm_30
-SMOIL sm_30 sm_35 sm_37 sm_53 sm_70 sm_75 sm_80
+SMOIL sm_30 sm_35 sm_37 sm_52 sm_53 sm_70 sm_75 sm_80
 AEMM .=misa?sm_30
 CMMC
 
@@ -46,6 +48,7 @@ SMOIL sm_35
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -57,6 +60,7 @@ SMOID sm_35
 SMOIL sm_35 sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -69,6 +73,7 @@ SMOID sm_37
 SMOIL sm_37 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -76,11 +81,24 @@ AEMM .=misa?sm_80
 CMMC
 
 
+BEGIN '--with-arch=sm_52', '--with-multilib-list=sm_52,sm_75,sm_35'
+SMOID sm_52
+SMOIL sm_52 sm_75 sm_35
+AEMM misa?sm_35=misa?sm_30
+AEMM misa?sm_35=misa?sm_37
+AEMM .=misa?sm_52
+AEMM .=misa?sm_53
+AEMM .=misa?sm_70
+AEMM misa?sm_75=misa?sm_80
+CMMC
+
+
 BEGIN '--with-arch=sm_53', '--with-multilib-list=sm_53,sm_30'
 SMOID sm_53
 SMOIL sm_53 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -92,15 +110,16 @@ SMOID sm_53
 SMOIL sm_53 sm_37
 AEMM misa?sm_37=misa?sm_30
 AEMM misa?sm_37=misa?sm_35
+AEMM misa?sm_37=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
 CMMC
 
-BEGIN '--with-arch=sm_53', 
'--with-multilib-list=sm_53,sm_30,sm_35,sm_37,sm_70,sm_75,sm_80'
+BEGIN '--with-arch=sm_53', 
'--with-multilib-list=sm_53=sm_30,sm_35,sm_37,sm_52,sm_70,sm_75,sm_80'
 SMOID sm_53
-SMOIL sm_53 sm_30 sm_35 sm_37 sm_70 sm_75 sm_80
+SMOIL sm_53 sm_30 sm_35 sm_37 sm_52 sm_70 sm_75 sm_80
 AEMM .=misa?sm_53
 CMMC
 
@@ -111,6 +130,7 @@ SMOIL sm_70
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -122,6 +142,7 @@ SMOID sm_70
 SMOIL sm_70 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_30=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -134,6 +155,7 @@ SMOIL sm_70 sm_53
 AEMM misa?sm_53=misa?sm_30
 AEMM misa?sm_53=misa?sm_35
 AEMM misa?sm_53=misa?sm_37
+AEMM misa?sm_53=misa?sm_52
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
@@ -144,6 +166,7 @@ SMOID sm_70
 SMOIL sm_70 sm_53 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
@@ -155,6 +178,7 @@ SMOID sm_75
 SMOIL sm_75 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_30=misa?sm_53
 AEMM misa?sm_30=misa?sm_70
 AEMM .=misa?sm_75
@@ -167,6 +191,7 @@ SMOIL sm_75 sm_53
 AEMM misa?sm_53=misa?sm_30
 AEMM misa?sm_53=misa?sm_35
 AEMM misa?sm_53=misa?sm_37
+AEMM misa?sm_53=misa?sm_52
 AEMM misa?sm_53=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
@@ -177,6 +202,7 @@ SMOID sm_75
 SMOIL sm_75 sm_30 sm_53
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_53=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
@@ -189,6 +215,7 @@ SMOIL sm_80
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -200,6 +227,7 @@ SMOID sm_80
 SMOIL sm_80 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_30=misa?sm_53
 AEMM misa?sm_30=misa?sm_70
 AEMM misa?sm_30=misa?sm_75
@@ -212,13 +240,14 @@ SMOIL sm_80 sm_75
 AEMM misa?sm_75=misa?sm_30
 AEMM misa?sm_75=misa?sm_35
 AEMM misa?sm_75=misa?sm_37
+AEMM misa?sm_75=misa?sm_52
 AEMM misa?sm_75=misa?sm_53
 AEMM misa?sm_75=misa?sm_70
 AEMM .=misa?sm_80
 CMMC
 
-BEGIN '--with-arch=sm_80', 
'--with-multilib-list=sm_80,sm_30,sm_35,sm_37,sm_53,sm_70,sm_75'
+BEGIN '--with-arch=sm_80', 
'--with-multilib-list=sm_80,sm_30,sm_35,sm_37,sm_52,sm_53,sm_70,sm_75'
 SMOID sm_80
-SMOIL sm_80 sm_30 sm_35 sm_37 sm_53 sm_70 sm_75
+SMOIL sm_80 sm_30 sm_35 sm_37 sm_52 sm_53 sm_70 sm_75
 AEMM .=misa?sm_80
 CMMC
diff --git a/gcc/config/nvptx/nvptx-gen.h b/gcc/config/nvptx/nvptx-gen.h
index 7f9b620ea778..5f271a33c357 100644
--- a/gcc/config/nvptx/nvptx-gen.h
+++ b/gcc/config/nvptx/nvptx-gen.h
@@ -24,6 +24,7 @@
 #define TARGET_SM30 (ptx_isa_option >= PTX_ISA_SM30)
 #define TARGET_SM35 (ptx_isa_option >= PTX_ISA_SM35)
 #define TARGET_SM37 (ptx_isa_option >= PTX_ISA_SM37)
+#define TARGET_SM52 (ptx_isa_option >= PTX_ISA_SM52)
 #define TARGET_SM53 (ptx_isa_option >= PTX_ISA_SM53)
 #define TARGET_SM70 (ptx_isa_option >= PTX_ISA_SM70)
 #define TARGET_SM75 (ptx_isa_option >= PTX_ISA_SM75)
diff --git a/gcc/config/nvptx/nvptx-gen.opt b/gcc/config/nvptx/nvptx-gen.opt
index 9124bd128967..0d76885c475e 100644
--- a/gcc/config/nvptx/nvptx-gen.opt
+++ b/gcc/config/nvptx/nvptx-gen.opt
@@ -32,6 +32,9 @@ Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)
 EnumValue
 Enum(ptx_isa) String(sm_37) Value(PTX_ISA_SM37)
 
+EnumValue
+Enum(ptx_isa) String(sm_52) Value(PTX_ISA_SM52)
+
 EnumValue
 Enum(ptx_isa) String(sm_53) Value(PTX_ISA_SM53)
 
diff --git a/gcc/config/nvptx/nvptx-sm.def b/gcc/config/nvptx/nvptx-sm.def
index 625007dd0b58..0fafc8aeddfa 100644
--- a/gcc/config/nvptx/nvptx-sm.def
+++ b/gcc/config/nvptx/nvptx-sm.def
@@ -23,6 +23,7 @@
 NVPTX_SM (30, NVPTX_SM_SEP)
 NVPTX_SM (35, NVPTX_SM_SEP)
 NVPTX_SM (37, NVPTX_SM_SEP)
+NVPTX_SM (52, NVPTX_SM_SEP)
 NVPTX_SM (53, NVPTX_SM_SEP)
 NVPTX_SM (70, NVPTX_SM_SEP)
 NVPTX_SM (75, NVPTX_SM_SEP)
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index c3aba05e753f..93402bf516b9 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -216,6 +216,7 @@ first_ptx_version_supporting_sm (enum ptx_isa sm)
     case PTX_ISA_SM35:
       return PTX_VERSION_3_1;
     case PTX_ISA_SM37:
+    case PTX_ISA_SM52:
       return PTX_VERSION_4_1;
     case PTX_ISA_SM53:
       return PTX_VERSION_4_2;
diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt
index e02a845c0093..4d14eda76991 100644
--- a/gcc/config/nvptx/nvptx.opt
+++ b/gcc/config/nvptx/nvptx.opt
@@ -79,7 +79,7 @@ march-map=sm_50
 Target RejectNegative Alias(misa=,sm_37)
 
 march-map=sm_52
-Target RejectNegative Alias(misa=,sm_37)
+Target RejectNegative Alias(misa=,sm_52)
 
 march-map=sm_53
 Target RejectNegative Alias(misa=,sm_53)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8a91c578699a..92728a7f6ce3 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -30047,7 +30047,7 @@ supported.
 Generate code for the specified PTX ISA target architecture.
 Valid architecture strings are
 @samp{sm_30}, @samp{sm_35}, @samp{sm_37},
-@samp{sm_53},
+@samp{sm_52}, @samp{sm_53},
 @samp{sm_70}, @samp{sm_75},
 and @samp{sm_80}.
 The default depends on how the compiler has been configured, see
diff --git a/gcc/testsuite/gcc.target/nvptx/march-map=sm_52.c 
b/gcc/testsuite/gcc.target/nvptx/march-map=sm_52.c
index 6dd8605721fa..f37d13a8b088 100644
--- a/gcc/testsuite/gcc.target/nvptx/march-map=sm_52.c
+++ b/gcc/testsuite/gcc.target/nvptx/march-map=sm_52.c
@@ -2,7 +2,7 @@
 /* { dg-options {-march-map=sm_52 -mptx=_} } */
 /* { dg-additional-options -save-temps } */
 /* { dg-final { scan-assembler-times {(?n)^    \.version       6\.0$} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_37$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_52$} 1 } } */
 
 #if __PTX_ISA_VERSION_MAJOR__ != 6
 #error wrong value for __PTX_ISA_VERSION_MAJOR__
@@ -12,7 +12,7 @@
 #error wrong value for __PTX_ISA_VERSION_MINOR__
 #endif
 
-#if __PTX_SM__ != 370
+#if __PTX_SM__ != 520
 #error wrong value for __PTX_SM__
 #endif
 
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_52.c 
b/gcc/testsuite/gcc.target/nvptx/march=sm_52.c
new file mode 100644
index 000000000000..515f950af475
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/march=sm_52.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_52 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^    \.version       6\.0$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_52$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 6
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 0
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 520
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm52.c 
b/libgomp/testsuite/libgomp.c/declare-variant-3-sm52.c
new file mode 100644
index 000000000000..591473c91239
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-3-sm52.c
@@ -0,0 +1,8 @@
+/* { dg-do link { target { offload_target_nvptx } } } */
+/* { dg-additional-options -foffload=nvptx-none } */
+/* { dg-additional-options "-foffload=-misa=sm_52 -foffload=-mptx=_" } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-3.h"
+
+/* { dg-final { only_for_offload_target nvptx-none scan-offload-tree-dump "= 
f52 \\(\\);" "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3.h 
b/libgomp/testsuite/libgomp.c/declare-variant-3.h
index 58ec06bf9dfb..8db0fc536adb 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-3.h
+++ b/libgomp/testsuite/libgomp.c/declare-variant-3.h
@@ -21,6 +21,13 @@ f37 (void)
   return 37;
 }
 
+__attribute__ ((noipa))
+int
+f52 (void)
+{
+  return 52;
+}
+
 __attribute__ ((noipa))
 int
 f53 (void)
@@ -52,6 +59,7 @@ f80 (void)
 #pragma omp declare variant (f30) match (device={isa("sm_30")})
 #pragma omp declare variant (f35) match (device={isa("sm_35")})
 #pragma omp declare variant (f37) match (device={isa("sm_37")})
+#pragma omp declare variant (f52) match (device={isa("sm_52")})
 #pragma omp declare variant (f53) match (device={isa("sm_53")})
 #pragma omp declare variant (f70) match (device={isa("sm_70")})
 #pragma omp declare variant (f75) match (device={isa("sm_75")})
-- 
2.34.1

Reply via email to