public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-7405] [nvptx] Add -mptx=_
Date: Mon, 28 Feb 2022 09:14:30 +0000 (GMT)	[thread overview]
Message-ID: <20220228091430.1CF2B3858435@sourceware.org> (raw)

https://gcc.gnu.org/g:9d87ad0ca5cd18807546a081e7d539be8b5418bf

commit r12-7405-g9d87ad0ca5cd18807546a081e7d539be8b5418bf
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Feb 25 16:11:23 2022 +0100

    [nvptx] Add -mptx=_
    
    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.

Diff:
---
 gcc/config/nvptx/nvptx-opts.h | 1 +
 gcc/config/nvptx/nvptx.cc     | 3 ++-
 gcc/config/nvptx/nvptx.opt    | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/config/nvptx/nvptx-opts.h b/gcc/config/nvptx/nvptx-opts.h
index e918d43ea16..30852b6992c 100644
--- a/gcc/config/nvptx/nvptx-opts.h
+++ b/gcc/config/nvptx/nvptx-opts.h
@@ -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,
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index b9451c2ed09..7862a90a65a 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -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;
diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt
index 9776c3b9a1f..f555ad1d8bf 100644
--- a/gcc/config/nvptx/nvptx.opt
+++ b/gcc/config/nvptx/nvptx.opt
@@ -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.


                 reply	other threads:[~2022-02-28  9:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220228091430.1CF2B3858435@sourceware.org \
    --to=vries@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).