public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-12] nvptx: Make default '-misa=sm_30' explicit
@ 2022-09-26 14:20 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-09-26 14:20 UTC (permalink / raw)
  To: gcc-cvs

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=

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-26 14:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 14:20 [gcc/devel/omp/gcc-12] nvptx: Make default '-misa=sm_30' explicit Thomas Schwinge

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).