gcc/
        * config/nvptx/nvptx-opts.h (enum ptx_version): Add
        'PTX_VERSION_7_3'.
        * config/nvptx/nvptx.cc (ptx_version_to_string)
        (ptx_version_to_number): Adjust.
        * config/nvptx/nvptx.h (TARGET_PTX_7_3): New.
        * config/nvptx/nvptx.opt (Enum(ptx_version)): Add 'EnumValue'
        '7.3' for 'PTX_VERSION_7_3'.
        * doc/invoke.texi (Nvidia PTX Options): Document '-mptx=7.3'.
        gcc/testsuite/
        * gcc.target/nvptx/mptx=7.3.c: New.
---
 gcc/config/nvptx/nvptx-opts.h             |  1 +
 gcc/config/nvptx/nvptx.cc                 |  4 ++++
 gcc/config/nvptx/nvptx.h                  |  1 +
 gcc/config/nvptx/nvptx.opt                |  3 +++
 gcc/doc/invoke.texi                       |  2 +-
 gcc/testsuite/gcc.target/nvptx/mptx=7.3.c | 19 +++++++++++++++++++
 6 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/nvptx/mptx=7.3.c

diff --git a/gcc/config/nvptx/nvptx-opts.h b/gcc/config/nvptx/nvptx-opts.h
index 86947d67bc8d..d8867017892b 100644
--- a/gcc/config/nvptx/nvptx-opts.h
+++ b/gcc/config/nvptx/nvptx-opts.h
@@ -43,6 +43,7 @@ enum ptx_version
   PTX_VERSION_6_0,
   PTX_VERSION_6_3,
   PTX_VERSION_7_0,
+  PTX_VERSION_7_3,
   PTX_VERSION_7_8
 };
 
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 8e79ece06240..eb948d5b07e1 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -267,6 +267,8 @@ ptx_version_to_string (enum ptx_version v)
       return "6.3";
     case PTX_VERSION_7_0:
       return "7.0";
+    case PTX_VERSION_7_3:
+      return "7.3";
     case PTX_VERSION_7_8:
       return "7.8";
     default:
@@ -291,6 +293,8 @@ ptx_version_to_number (enum ptx_version v, bool major_p)
       return major_p ? 6 : 3;
     case PTX_VERSION_7_0:
       return major_p ? 7 : 0;
+    case PTX_VERSION_7_3:
+      return major_p ? 7 : 3;
     case PTX_VERSION_7_8:
       return major_p ? 7 : 8;
     default:
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index 985f9bc69ceb..4b51d176103d 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -102,6 +102,7 @@
 #define TARGET_PTX_6_0 (ptx_version_option >= PTX_VERSION_6_0)
 #define TARGET_PTX_6_3 (ptx_version_option >= PTX_VERSION_6_3)
 #define TARGET_PTX_7_0 (ptx_version_option >= PTX_VERSION_7_0)
+#define TARGET_PTX_7_3 (ptx_version_option >= PTX_VERSION_7_3)
 #define TARGET_PTX_7_8 (ptx_version_option >= PTX_VERSION_7_8)
 
 /* Registers.  Since ptx is a virtual target, we just define a few
diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt
index f29877382f95..273d366d35e6 100644
--- a/gcc/config/nvptx/nvptx.opt
+++ b/gcc/config/nvptx/nvptx.opt
@@ -142,6 +142,9 @@ Enum(ptx_version) String(6.3) Value(PTX_VERSION_6_3)
 EnumValue
 Enum(ptx_version) String(7.0) Value(PTX_VERSION_7_0)
 
+EnumValue
+Enum(ptx_version) String(7.3) Value(PTX_VERSION_7_3)
+
 EnumValue
 Enum(ptx_version) String(7.8) Value(PTX_VERSION_7_8)
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index c9733d6cb009..480c48c5372a 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -30211,7 +30211,7 @@ Valid version strings are
 @samp{3.1},
 @samp{4.1}, @samp{4.2},
 @samp{6.0}, @samp{6.3},
-@samp{7.0}, and @samp{7.8}.
+@samp{7.0}, @samp{7.3}, and @samp{7.8}.
 The default PTX ISA version is 6.0, unless a higher
 version is required for specified PTX ISA target architecture via
 option @option{-march=}.
diff --git a/gcc/testsuite/gcc.target/nvptx/mptx=7.3.c 
b/gcc/testsuite/gcc.target/nvptx/mptx=7.3.c
new file mode 100644
index 000000000000..def7e71af6fa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/mptx=7.3.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_30 -mptx=7.3} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^    \.version       7\.3$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_30$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 7
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 3
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 300
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
-- 
2.34.1

Reply via email to