@@ -1,3 +1,16 @@
+2015-05-13 Bernd Schmidt <bernds@codesourcery.com>
+
+ * config/nvptx/nvptx-opts.h: New file.
+ * config/nvptx/nvptx.c (nvptx_file_start): Print the correct .target.
+ * config/nvptx/nvptx.h: Include "nvptx-opts.h".
+ (ASM_SPEC): Define.
+ (TARGET_SM35): New macro.
+ * config/nvptx/nvptx.md (atomic_fetch_<logic><mode>): Enable with the
+ correct predicate.
+ * config/nvptx/nvptx.opt (ptx_isa, sm_30, sm_35): New enum and its
+ values.
+ (misa=): New option.
+
2015-05-13 Cesar Philippidis <cesar@codesourcery.com>
* except.c (finish_eh_generation): Don't finalize exeception
new file mode 100644
@@ -0,0 +1,31 @@
+/* Definitions for the NVPTX port needed for option handling.
+ Copyright (C) 2015 Free Software Foundation, Inc.
+ Contributed by Bernd Schmidt <bernds@codesourcery.com>
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef NVPTX_OPTS_H
+#define NVPTX_OPTS_H
+
+enum ptx_isa
+{
+ PTX_ISA_SM30,
+ PTX_ISA_SM35
+};
+
+#endif
+
@@ -2048,7 +2048,10 @@ nvptx_file_start (void)
{
fputs ("// BEGIN PREAMBLE\n", asm_out_file);
fputs ("\t.version\t3.1\n", asm_out_file);
- fputs ("\t.target\tsm_30\n", asm_out_file);
+ if (TARGET_SM35)
+ fputs ("\t.target\tsm_35\n", asm_out_file);
+ else
+ fputs ("\t.target\tsm_30\n", asm_out_file);
fprintf (asm_out_file, "\t.address_size %d\n", GET_MODE_BITSIZE (Pmode));
fprintf (asm_out_file, "\t.extern .shared .u8 sdata[];\n");
fputs ("// END PREAMBLE\n", asm_out_file);
@@ -21,10 +21,16 @@
#ifndef GCC_NVPTX_H
#define GCC_NVPTX_H
+#ifndef NVPTX_OPTS_H
+#include "config/nvptx/nvptx-opts.h"
+#endif
+
/* Run-time Target. */
#define STARTFILE_SPEC "%{mmainkernel:crt0.o}"
+#define ASM_SPEC "%{misa=*:-m %*}"
+
#define TARGET_CPU_CPP_BUILTINS() \
do \
{ \
@@ -77,6 +83,8 @@
#define Pmode (TARGET_ABI64 ? DImode : SImode)
+#define TARGET_SM35 (ptx_isa_option >= PTX_ISA_SM35)
+
/* Registers. Since ptx is a virtual target, we just define a few
hard registers for special purposes and leave pseudos unallocated. */
@@ -1414,7 +1414,6 @@
(define_code_iterator any_logic [and ior xor])
(define_code_attr logic [(and "and") (ior "or") (xor "xor")])
-;; Currently disabled until we add better subtarget support - requires sm_32.
(define_insn "atomic_fetch_<logic><mode>"
[(set (match_operand:SDIM 1 "memory_operand" "+m")
(unspec_volatile:SDIM
@@ -1424,5 +1423,5 @@
UNSPECV_LOCK))
(set (match_operand:SDIM 0 "nvptx_register_operand" "=R")
(match_dup 1))]
- "0"
+ "<MODE>mode == SImode || TARGET_SM35"
"%.\\tatom%A1.b%T0.<logic>\\t%0, %1, %2;")
@@ -28,3 +28,17 @@ Generate code for a 64-bit ABI
mmainkernel
Target Report RejectNegative
Link in code for a __main kernel.
+
+Enum
+Name(ptx_isa) Type(int)
+Known PTX ISA versions (for use with the -misa= option):
+
+EnumValue
+Enum(ptx_isa) String(sm_30) Value(PTX_ISA_SM30)
+
+EnumValue
+Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)
+
+misa=
+Target RejectNegative ToLower Joined Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM30)
+Specify the version of the ptx ISA to use