]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[nvptx] Add -mptx=_
authorTom de Vries <tdevries@suse.de>
Fri, 25 Feb 2022 15:11:23 +0000 (16:11 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 28 Feb 2022 09:10:50 +0000 (10:10 +0100)
Add an -mptx=_ value, that indicates the default ptx version.

It can be used to undo an explicit -mptx setting, so this:
...
$ gcc test.c -mptx=3.1 -mptx=_
...
has the same effect as:
...
$ gcc test.c
...

Tested on nvptx.

gcc/ChangeLog:

2022-02-28  Tom de Vries  <tdevries@suse.de>

* config/nvptx/nvptx-opts.h (enum ptx_version): Add
PTX_VERSION_default.
* config/nvptx/nvptx.cc (handle_ptx_version_option): Handle
PTX_VERSION_default.
* config/nvptx/nvptx.opt: Add EnumValue "_" / PTX_VERSION_default.

gcc/config/nvptx/nvptx-opts.h
gcc/config/nvptx/nvptx.cc
gcc/config/nvptx/nvptx.opt

index e918d43ea166feabc9e25291f333a9eb0228e90a..30852b6992ccc16ce6f8ca9d306c9912fe935eec 100644 (file)
@@ -32,6 +32,7 @@ enum ptx_isa
 
 enum ptx_version
 {
+  PTX_VERSION_default,
   PTX_VERSION_3_0,
   PTX_VERSION_3_1,
   PTX_VERSION_4_2,
index b9451c2ed0905ad91f6c7e15b432147b78054fbd..7862a90a65a7e5d8192f39b96bba599ce1f79eb9 100644 (file)
@@ -296,7 +296,8 @@ sm_version_to_string (enum ptx_isa sm)
 static void
 handle_ptx_version_option (void)
 {
-  if (!OPTION_SET_P (ptx_version_option))
+  if (!OPTION_SET_P (ptx_version_option)
+      || ptx_version_option == PTX_VERSION_default)
     {
       ptx_version_option = default_ptx_version_option ();
       return;
index 9776c3b9a1f43fde5c2af9937074f32147489a69..f555ad1d8bf2495c903856ce107f57b22dad4b3f 100644 (file)
@@ -94,6 +94,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(_) Value(PTX_VERSION_default)
+
 mptx=
 Target RejectNegative ToLower Joined Enum(ptx_version) Var(ptx_version_option)
 Specify the version of the ptx version to use.