https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104283
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tom de Vries <vr...@gcc.gnu.org>: https://gcc.gnu.org/g:decde11183bdccc46587d6614b75f3d56a2f2e4a commit r12-7098-gdecde11183bdccc46587d6614b75f3d56a2f2e4a Author: Tom de Vries <tdevr...@suse.de> Date: Fri Feb 4 08:53:52 2022 +0100 [nvptx] Choose -mptx default based on -misa While testing with driver version 390.147 I ran into the problem that it doesn't support ptx isa version 6.3 (the new default), only 6.1. Furthermore, using the -mptx option is a bit user-unfriendly. Say we want to compile for sm_80. We can use -misa=sm_80 to specify that, but then run into errors because the default ptx version is 6.3, which doesn't support sm_80 yet. Address both these issues by: - picking a default -mptx based on the active -misa, and - ensuring that the default -mptx is at least 6.0 (instead of 6.3). Also add an error in case of incompatible options like "-misa=sm_80 -mptx=6.3": ... cc1: error: PTX version (-mptx) needs to be at least 7.0 to support \ selected -misa (sm_80) ... Tested on x86_64-linux with nvptx accelerator. gcc/ChangeLog: 2022-02-08 Tom de Vries <tdevr...@suse.de> PR target/104283 * config/nvptx/nvptx-opts.h (enum ptx_version): Add PTX_VERSION_3_0 and PTX_VERSION_4_2. * config/nvptx/nvptx.cc (first_ptx_version_supporting_sm) (default_ptx_version_option, ptx_version_to_string) (sm_version_to_string, handle_ptx_version_option): New function. (nvptx_option_override): Call handle_ptx_version_option. (nvptx_file_start): Use ptx_version_to_string and sm_version_to_string. * config/nvptx/nvptx.md (define_insn "nvptx_shuffle<mode>") (define_insn "nvptx_vote_ballot"): Use TARGET_PTX_6_0. * config/nvptx/nvptx.opt (mptx): Remove 'Init'.