public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] nvptx: Make default '-misa=sm_30' explicit
Date: Mon, 26 Sep 2022 14:20:58 +0000 (GMT)	[thread overview]
Message-ID: <20220926142058.D69BE3858412@sourceware.org> (raw)

https://gcc.gnu.org/g:38a225f9d39f494f5dba718befef39631eb5768c

commit 38a225f9d39f494f5dba718befef39631eb5768c
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Sat Jun 11 12:28:36 2022 +0200

    nvptx: Make default '-misa=sm_30' explicit
    
    ... primarily in preparation for later changes.
    
            gcc/
            * config.gcc (with_arch) [nvptx]: Set to 'sm_30'.
            * config/nvptx/nvptx.cc (nvptx_option_override): Assert that
            '-misa' appeared.
            * config/nvptx/nvptx.h (OPTION_DEFAULT_SPECS): Define.
            * config/nvptx/nvptx.opt (misa=): Remove 'Init'.
    
    (cherry picked from commit 108b99b6c45ed8fbad6776539a639244b63191f5)

Diff:
---
 gcc/ChangeLog.omp          | 11 +++++++++++
 gcc/config.gcc             | 16 ++++++++++++++++
 gcc/config/nvptx/nvptx.cc  |  4 ++++
 gcc/config/nvptx/nvptx.h   |  4 ++++
 gcc/config/nvptx/nvptx.opt |  2 +-
 5 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 662430dd6ec..7f5f932b9d6 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,14 @@
+2022-09-26  Thomas Schwinge  <thomas@codesourcery.com>
+
+	Backported from master:
+	2022-09-26  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* config.gcc (with_arch) [nvptx]: Set to 'sm_30'.
+	* config/nvptx/nvptx.cc (nvptx_option_override): Assert that
+	'-misa' appeared.
+	* config/nvptx/nvptx.h (OPTION_DEFAULT_SPECS): Define.
+	* config/nvptx/nvptx.opt (misa=): Remove 'Init'.
+
 2022-09-26  Thomas Schwinge  <thomas@codesourcery.com>
 
 	Backported from master:
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 16d304286d7..3b1bde78391 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4043,6 +4043,9 @@ if test x$with_arch = x ; then
     mips*-*-vxworks)
       with_arch=mips2
       ;;
+    nvptx-*)
+      with_arch=sm_30
+      ;;
   esac
 
   # Avoid overriding --with-arch-32 and --with-arch-64 values.
@@ -5436,6 +5439,19 @@ case "${target}" in
 			esac
 		;;
 
+	nvptx-*)
+		supported_defaults=arch
+		case $with_arch in
+			sm_30 )
+				# OK; default.
+				;;
+			* )
+				echo "Unknown arch used in --with-arch=$with_arch" 1>&2
+				exit 1
+				;;
+		esac
+		;;
+
 	powerpc*-*-* | rs6000-*-*)
 		supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64 advance_toolchain"
 
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 0c2f7012327..854ebe10bbd 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -335,6 +335,10 @@ nvptx_option_override (void)
 {
   init_machine_status = nvptx_init_machine_status;
 
+  /* Via nvptx 'OPTION_DEFAULT_SPECS', '-misa' always appears on the command
+     line.  */
+  gcc_checking_assert (OPTION_SET_P (ptx_isa_option));
+
   handle_ptx_version_option ();
 
   /* Set toplevel_reorder, unless explicitly disabled.  We need
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index 9c883ba272a..cfde6f191a4 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -27,6 +27,10 @@
 
 /* Run-time Target.  */
 
+/* Use '--with-arch' for default '-misa'.  */
+#define OPTION_DEFAULT_SPECS \
+  { "arch", "%{!misa=*:-misa=%(VALUE)}" }, \
+
 /* Assembler supports '-v' option; handle similar to
    '../../gcc.cc:asm_options', 'HAVE_GNU_AS'.  */
 #define ASM_SPEC "%{v}"
diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt
index c5a5668fce5..71d3b68510b 100644
--- a/gcc/config/nvptx/nvptx.opt
+++ b/gcc/config/nvptx/nvptx.opt
@@ -53,7 +53,7 @@ Target Mask(GOMP)
 Generate code for OpenMP offloading: enables -msoft-stack and -muniform-simt.
 
 misa=
-Target RejectNegative ToLower Joined Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM30)
+Target RejectNegative ToLower Joined Enum(ptx_isa) Var(ptx_isa_option)
 Specify the PTX ISA target architecture to use.
 
 march=

                 reply	other threads:[~2022-09-26 14:20 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=20220926142058.D69BE3858412@sourceware.org \
    --to=tschwinge@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).