]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nvptx: Support '-march=sm_89'
authorThomas Schwinge <tschwinge@baylibre.com>
Tue, 12 Nov 2024 16:49:10 +0000 (17:49 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Fri, 6 Dec 2024 11:30:20 +0000 (12:30 +0100)
gcc/
* config/nvptx/nvptx-sm.def: Add '89'.
* 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_89, -march-map=sm_90)
(march-map=sm_90a): Likewise.
* config.gcc: Likewise.
* doc/invoke.texi (Nvidia PTX Options): Document '-march=sm_89'.
* config/nvptx/gen-multilib-matches-tests: Extend.
gcc/testsuite/
* gcc.target/nvptx/march-map=sm_89.c: Adjust.
* gcc.target/nvptx/march-map=sm_90.c: Likewise.
* gcc.target/nvptx/march-map=sm_90a.c: Likewise.
* gcc.target/nvptx/march=sm_89.c: New.
libgomp/
* testsuite/libgomp.c/declare-variant-3-sm89.c: New.
* testsuite/libgomp.c/declare-variant-3.h: Adjust.

14 files changed:
gcc/config.gcc
gcc/config/nvptx/gen-multilib-matches-tests
gcc/config/nvptx/nvptx-gen.h
gcc/config/nvptx/nvptx-gen.opt
gcc/config/nvptx/nvptx-sm.def
gcc/config/nvptx/nvptx.cc
gcc/config/nvptx/nvptx.opt
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/nvptx/march-map=sm_89.c
gcc/testsuite/gcc.target/nvptx/march-map=sm_90.c
gcc/testsuite/gcc.target/nvptx/march-map=sm_90a.c
gcc/testsuite/gcc.target/nvptx/march=sm_89.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/declare-variant-3-sm89.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/declare-variant-3.h

index 21f3dcd9d009b2f15ab0e88f3d20e9c6120abd57..a2d21b5f34369de8b4dfb5afe51ca5275aede9e5 100644 (file)
@@ -5645,7 +5645,7 @@ case "${target}" in
                        sm_30 | sm_35 | sm_37 \
                        | sm_52 | sm_53 \
                        | sm_70 | sm_75 \
-                       | sm_80 )
+                       | sm_80 | sm_89 )
                                TM_MULTILIB_CONFIG="$TM_MULTILIB_CONFIG $nvptx_multilib"
                                ;;
                        $with_arch )
index 13b1c5b9d018e0ea084b424055100aac2b1ad612..a07f19adbdb16b0c507704557dd0b9cb80a4479a 100644 (file)
@@ -21,11 +21,12 @@ AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
-BEGIN '--with-arch=sm_30', '--with-multilib-list=sm_30,sm_80'
+BEGIN '--with-arch=sm_30', '--with-multilib-list=sm_30,sm_89'
 SMOID sm_30
-SMOIL sm_30 sm_80
+SMOIL sm_30 sm_89
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
@@ -33,11 +34,12 @@ AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
+AEMM .=misa?sm_80
 CMMC
 
-BEGIN '--with-arch=sm_30', '--with-multilib-list=sm_30,sm_35,sm_37,sm_52,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,sm_89'
 SMOID sm_30
-SMOIL sm_30 sm_35 sm_37 sm_52 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 sm_89
 AEMM .=misa?sm_30
 CMMC
 
@@ -53,6 +55,7 @@ AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_35', '--with-multilib-list=sm_35,sm_30'
@@ -65,6 +68,7 @@ AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 
@@ -78,6 +82,7 @@ AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 
@@ -90,6 +95,7 @@ AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM misa?sm_75=misa?sm_80
+AEMM misa?sm_75=misa?sm_89
 CMMC
 
 
@@ -103,6 +109,7 @@ AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_53', '--with-multilib-list=sm_53,sm_37'
@@ -115,11 +122,12 @@ AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
-BEGIN '--with-arch=sm_53', '--with-multilib-list=sm_53=sm_30,sm_35,sm_37,sm_52,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,sm_89'
 SMOID sm_53
-SMOIL sm_53 sm_30 sm_35 sm_37 sm_52 sm_70 sm_75 sm_80
+SMOIL sm_53 sm_30 sm_35 sm_37 sm_52 sm_70 sm_75 sm_80 sm_89
 AEMM .=misa?sm_53
 CMMC
 
@@ -135,6 +143,7 @@ AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_70', '--with-multilib-list=sm_70,sm_30'
@@ -147,6 +156,7 @@ AEMM misa?sm_30=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_70', '--with-multilib-list=sm_70,sm_53'
@@ -159,6 +169,7 @@ AEMM misa?sm_53=misa?sm_52
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_70', '--with-multilib-list=sm_70,sm_53,sm_30'
@@ -170,6 +181,7 @@ AEMM misa?sm_30=misa?sm_52
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 
@@ -183,6 +195,7 @@ AEMM misa?sm_30=misa?sm_53
 AEMM misa?sm_30=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_75', '--with-multilib-list=sm_75,sm_53'
@@ -195,6 +208,7 @@ AEMM misa?sm_53=misa?sm_52
 AEMM misa?sm_53=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_75', '--with-multilib-list=sm_75,sm_30,sm_53'
@@ -206,6 +220,7 @@ AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_53=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 
@@ -220,6 +235,7 @@ AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_80', '--with-multilib-list=sm_80,sm_30'
@@ -232,6 +248,7 @@ AEMM misa?sm_30=misa?sm_53
 AEMM misa?sm_30=misa?sm_70
 AEMM misa?sm_30=misa?sm_75
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
 CMMC
 
 BEGIN '--with-arch=sm_80', '--with-multilib-list=sm_80,sm_75'
@@ -244,10 +261,40 @@ 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
+AEMM .=misa?sm_89
 CMMC
 
-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_52 sm_53 sm_70 sm_75
+
+BEGIN '--with-arch=sm_89', '--with-multilib-list=sm_89'
+SMOID sm_89
+SMOIL sm_89
+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
 AEMM .=misa?sm_80
+AEMM .=misa?sm_89
+CMMC
+
+BEGIN '--with-arch=sm_89', '--with-multilib-list=sm_89,sm_52'
+SMOID sm_89
+SMOIL sm_89 sm_52
+AEMM misa?sm_52=misa?sm_30
+AEMM misa?sm_52=misa?sm_35
+AEMM misa?sm_52=misa?sm_37
+AEMM misa?sm_52=misa?sm_53
+AEMM misa?sm_52=misa?sm_70
+AEMM misa?sm_52=misa?sm_75
+AEMM misa?sm_52=misa?sm_80
+AEMM .=misa?sm_89
+CMMC
+
+
+BEGIN '--with-arch=sm_89', '--with-multilib-list=sm_89,sm_30,sm_35,sm_37,sm_52,sm_53,sm_70,sm_75,sm_80'
+SMOID sm_89
+SMOIL sm_89 sm_30 sm_35 sm_37 sm_52 sm_53 sm_70 sm_75 sm_80
+AEMM .=misa?sm_89
 CMMC
index 5f271a33c357e365399571cf80152208303d25d6..416ee8a26290b10fcbb8d2c1ca03cd88bca3fac4 100644 (file)
@@ -29,3 +29,4 @@
 #define TARGET_SM70 (ptx_isa_option >= PTX_ISA_SM70)
 #define TARGET_SM75 (ptx_isa_option >= PTX_ISA_SM75)
 #define TARGET_SM80 (ptx_isa_option >= PTX_ISA_SM80)
+#define TARGET_SM89 (ptx_isa_option >= PTX_ISA_SM89)
index 0d76885c475ee839cdeeb692cb62d203951aadf8..cc8492e086bc22f412f1c187adaae7dd446b0ecc 100644 (file)
@@ -46,3 +46,6 @@ Enum(ptx_isa) String(sm_75) Value(PTX_ISA_SM75)
 
 EnumValue
 Enum(ptx_isa) String(sm_80) Value(PTX_ISA_SM80)
+
+EnumValue
+Enum(ptx_isa) String(sm_89) Value(PTX_ISA_SM89)
index 0fafc8aeddfa8cb9869c8299997ec368676521c5..5656ac73cf734fe121e903fc8eba321e3d0a69d1 100644 (file)
@@ -27,6 +27,7 @@ NVPTX_SM (52, NVPTX_SM_SEP)
 NVPTX_SM (53, NVPTX_SM_SEP)
 NVPTX_SM (70, NVPTX_SM_SEP)
 NVPTX_SM (75, NVPTX_SM_SEP)
-NVPTX_SM (80,)
+NVPTX_SM (80, NVPTX_SM_SEP)
+NVPTX_SM (89,)
 
 #undef NVPTX_SM_SEP
index 65d339b36ede8c0770373e40a43d9203212e2dcf..96536a0e3d1330e856380f4e164dbbc17f163dfc 100644 (file)
@@ -226,6 +226,8 @@ first_ptx_version_supporting_sm (enum ptx_isa sm)
       return PTX_VERSION_6_3;
     case PTX_ISA_SM80:
       return PTX_VERSION_7_0;
+    case PTX_ISA_SM89:
+      return PTX_VERSION_7_8;
     default:
       gcc_unreachable ();
     }
index 842cbbbedeeebc164aa9af16586cf83e203932cd..f2077f4c750a45c2980cd0def157ff4dd9a9d048 100644 (file)
@@ -112,13 +112,13 @@ march-map=sm_87
 Target RejectNegative Alias(misa=,sm_80)
 
 march-map=sm_89
-Target RejectNegative Alias(misa=,sm_80)
+Target RejectNegative Alias(misa=,sm_89)
 
 march-map=sm_90
-Target RejectNegative Alias(misa=,sm_80)
+Target RejectNegative Alias(misa=,sm_89)
 
 march-map=sm_90a
-Target RejectNegative Alias(misa=,sm_80)
+Target RejectNegative Alias(misa=,sm_89)
 
 Enum
 Name(ptx_version) Type(enum ptx_version)
index 8271e6474817a8643c5ef734f2655232f559ab45..57b6ca126400ac9c9cb21433f9a4ccc81d9662e7 100644 (file)
@@ -30049,7 +30049,7 @@ Valid architecture strings are
 @samp{sm_30}, @samp{sm_35}, @samp{sm_37},
 @samp{sm_52}, @samp{sm_53},
 @samp{sm_70}, @samp{sm_75},
-and @samp{sm_80}.
+@samp{sm_80}, and @samp{sm_89}.
 The default depends on how the compiler has been configured, see
 @option{--with-arch}.
 
index 24aabf6710faa763c1bf4301efe7f7a2ef5766cb..996af781f5bd36c8348c7284164085145b568d2c 100644 (file)
@@ -1,18 +1,18 @@
 /* { dg-do assemble } */
 /* { dg-options {-march-map=sm_89 -mptx=_} } */
 /* { dg-additional-options -save-temps } */
-/* { dg-final { scan-assembler-times {(?n)^    \.version       7\.0$} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_80$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.version       7\.8$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_89$} 1 } } */
 
 #if __PTX_ISA_VERSION_MAJOR__ != 7
 #error wrong value for __PTX_ISA_VERSION_MAJOR__
 #endif
 
-#if __PTX_ISA_VERSION_MINOR__ != 0
+#if __PTX_ISA_VERSION_MINOR__ != 8
 #error wrong value for __PTX_ISA_VERSION_MINOR__
 #endif
 
-#if __PTX_SM__ != 800
+#if __PTX_SM__ != 890
 #error wrong value for __PTX_SM__
 #endif
 
index 77aea4e6c992f89f9bf11b4330e689c22652ef72..0915df7a150f641e929f99c49f1640a9c930245d 100644 (file)
@@ -1,18 +1,18 @@
 /* { dg-do assemble } */
 /* { dg-options {-march-map=sm_90 -mptx=_} } */
 /* { dg-additional-options -save-temps } */
-/* { dg-final { scan-assembler-times {(?n)^    \.version       7\.0$} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_80$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.version       7\.8$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_89$} 1 } } */
 
 #if __PTX_ISA_VERSION_MAJOR__ != 7
 #error wrong value for __PTX_ISA_VERSION_MAJOR__
 #endif
 
-#if __PTX_ISA_VERSION_MINOR__ != 0
+#if __PTX_ISA_VERSION_MINOR__ != 8
 #error wrong value for __PTX_ISA_VERSION_MINOR__
 #endif
 
-#if __PTX_SM__ != 800
+#if __PTX_SM__ != 890
 #error wrong value for __PTX_SM__
 #endif
 
index b83fe654cf66a3185e115d9757c9a7cef04f74b8..08a701502572d1051292f56dbcc70785105ca918 100644 (file)
@@ -1,18 +1,18 @@
 /* { dg-do assemble } */
 /* { dg-options {-march-map=sm_90a -mptx=_} } */
 /* { dg-additional-options -save-temps } */
-/* { dg-final { scan-assembler-times {(?n)^    \.version       7\.0$} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_80$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.version       7\.8$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_89$} 1 } } */
 
 #if __PTX_ISA_VERSION_MAJOR__ != 7
 #error wrong value for __PTX_ISA_VERSION_MAJOR__
 #endif
 
-#if __PTX_ISA_VERSION_MINOR__ != 0
+#if __PTX_ISA_VERSION_MINOR__ != 8
 #error wrong value for __PTX_ISA_VERSION_MINOR__
 #endif
 
-#if __PTX_SM__ != 800
+#if __PTX_SM__ != 890
 #error wrong value for __PTX_SM__
 #endif
 
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_89.c b/gcc/testsuite/gcc.target/nvptx/march=sm_89.c
new file mode 100644 (file)
index 0000000..bd57061
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_89 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^    \.version       7\.8$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_89$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 7
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 8
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 890
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm89.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm89.c
new file mode 100644 (file)
index 0000000..cd2e472
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do link { target { offload_target_nvptx } } } */
+/* { dg-additional-options -foffload=nvptx-none } */
+/* { dg-additional-options "-foffload=-misa=sm_89 -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 "= f89 \\(\\);" "optimized" } } */
index 8db0fc536adb3b15d9aff565e74252fbca2d4268..c9c8f4a385fba6f61b76bc4081b2fe6d7c806a83 100644 (file)
@@ -56,6 +56,13 @@ f80 (void)
   return 80;
 }
 
+__attribute__ ((noipa))
+int
+f89 (void)
+{
+  return 89;
+}
+
 #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")})
@@ -64,6 +71,7 @@ f80 (void)
 #pragma omp declare variant (f70) match (device={isa("sm_70")})
 #pragma omp declare variant (f75) match (device={isa("sm_75")})
 #pragma omp declare variant (f80) match (device={isa("sm_80")})
+#pragma omp declare variant (f89) match (device={isa("sm_89")})
 __attribute__ ((noipa))
 int
 f (void)