aboutsummaryrefslogtreecommitdiff
path: root/gcc/config.gcc
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2021-08-24 18:02:18 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2021-08-24 18:02:18 +0100
commit3c496e92d795a8fe5c527e3c5b5a6606669ae50d (patch)
tree7e8fd24555d97b4e0f13a42aca74f9e5050d57f7 /gcc/config.gcc
parent820f0940d7ace1306430a9dcf1bd9577508a7a7e (diff)
downloadgcc-3c496e92d795a8fe5c527e3c5b5a6606669ae50d.zip
gcc-3c496e92d795a8fe5c527e3c5b5a6606669ae50d.tar.gz
gcc-3c496e92d795a8fe5c527e3c5b5a6606669ae50d.tar.bz2
nvptx: Add a __PTX_SM__ predefined macro based on target ISA.
This patch adds a __PTX_SM__ predefined macro to the nvptx backend that allows code to check the compute model being targeted by the compiler. This is equivalent to the __CUDA_ARCH__ macro defined by CUDA's nvcc compiler, but to avoid causing problems for source code that checks for that compiler, this macro uses GCC's nomenclature; it's easy enough for users to "#define __CUDA_ARCH__ __PTX_SM__". What might have been a four line patch is actually a little more complicated, as this patch takes the opportunity to upgrade the nvptx backend to use the now preferred nvptx-c.c idiom. 2021-08-24 Roger Sayle <roger@nextmovesoftware.com> Tom de Vries <tdevries@suse.de> gcc/ChangeLog * config.gcc (nvptx-*-*): Define {c,c++}_target_objs. * config/nvptx/nvptx-protos.h (nvptx_cpu_cpp_builtins): Prototype. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Implement with a call to the new nvptx_cpu_cpp_builtins function in nvptx-c.c. * config/nvptx/t-nvptx (nvptx-c.o): New rule. * config/nvptx/nvptx-c.c: New source file. (nvptx_cpu_cpp_builtins): Move implementation here.
Diffstat (limited to 'gcc/config.gcc')
-rw-r--r--gcc/config.gcc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 94199d7..0ff5cac 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -468,6 +468,8 @@ nios2-*-*)
;;
nvptx-*-*)
cpu_type=nvptx
+ c_target_objs="nvptx-c.o"
+ cxx_target_objs="nvptx-c.o"
;;
or1k*-*-*)
cpu_type=or1k