From ae782b3d1db7a9b2dea744d2a718bec94ac57677 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sat, 11 Jun 2022 12:28:36 +0200 Subject: [PATCH 1/3] nvptx: Make default '-misa=sm_30' explicit ... primarily in preparation for later changes. --- gcc/config.gcc | 16 ++++++++++++++++ gcc/config/nvptx/nvptx.cc | 4 ++++ gcc/config/nvptx/nvptx.h | 4 ++++ gcc/config/nvptx/nvptx.opt | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) 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 e4297e2d6c3..071759b9582 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 b184f1d0150..629d4a5d8bc 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= -- 2.25.1