aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/nvptx/nvptx.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/nvptx/nvptx.cc')
-rw-r--r--gcc/config/nvptx/nvptx.cc89
1 files changed, 55 insertions, 34 deletions
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 022037f..a92a1e3 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -220,6 +220,8 @@ first_ptx_version_supporting_sm (enum ptx_isa sm)
return PTX_VERSION_4_1;
case PTX_ISA_SM53:
return PTX_VERSION_4_2;
+ case PTX_ISA_SM61:
+ return PTX_VERSION_5_0;
case PTX_ISA_SM70:
return PTX_VERSION_6_0;
case PTX_ISA_SM75:
@@ -268,6 +270,8 @@ ptx_version_to_string (enum ptx_version v)
return "4.1";
case PTX_VERSION_4_2:
return "4.2";
+ case PTX_VERSION_5_0:
+ return "5.0";
case PTX_VERSION_6_0:
return "6.0";
case PTX_VERSION_6_3:
@@ -294,6 +298,8 @@ ptx_version_to_number (enum ptx_version v, bool major_p)
return major_p ? 4 : 1;
case PTX_VERSION_4_2:
return major_p ? 4 : 2;
+ case PTX_VERSION_5_0:
+ return major_p ? 5 : 0;
case PTX_VERSION_6_0:
return major_p ? 6 : 0;
case PTX_VERSION_6_3:
@@ -470,9 +476,7 @@ nvptx_encode_section_info (tree decl, rtx rtl, int first)
{
nvptx_data_area area = DATA_AREA_GENERIC;
- if (TREE_CONSTANT (decl))
- area = DATA_AREA_CONST;
- else if (VAR_P (decl))
+ if (VAR_P (decl))
{
if (lookup_attribute ("shared", DECL_ATTRIBUTES (decl)))
{
@@ -482,7 +486,7 @@ nvptx_encode_section_info (tree decl, rtx rtl, int first)
" memory is not supported", decl);
}
else
- area = TREE_READONLY (decl) ? DATA_AREA_CONST : DATA_AREA_GLOBAL;
+ area = DATA_AREA_GLOBAL;
}
SET_SYMBOL_DATA_AREA (XEXP (rtl, 0), area);
@@ -2041,8 +2045,7 @@ nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind)
start_sequence ();
emit_insn (nvptx_gen_shuffle (dst_real, src_real, idx, kind));
emit_insn (nvptx_gen_shuffle (dst_imag, src_imag, idx, kind));
- res = get_insns ();
- end_sequence ();
+ res = end_sequence ();
}
break;
case E_SImode:
@@ -2062,8 +2065,7 @@ nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind)
emit_insn (nvptx_gen_shuffle (tmp0, tmp0, idx, kind));
emit_insn (nvptx_gen_shuffle (tmp1, tmp1, idx, kind));
emit_insn (nvptx_gen_pack (dst, tmp0, tmp1));
- res = get_insns ();
- end_sequence ();
+ res = end_sequence ();
}
break;
case E_V2SImode:
@@ -2081,8 +2083,7 @@ nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind)
emit_insn (nvptx_gen_shuffle (tmp1, tmp1, idx, kind));
emit_insn (gen_movsi (dst0, tmp0));
emit_insn (gen_movsi (dst1, tmp1));
- res = get_insns ();
- end_sequence ();
+ res = end_sequence ();
}
break;
case E_V2DImode:
@@ -2100,8 +2101,7 @@ nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind)
emit_insn (nvptx_gen_shuffle (tmp1, tmp1, idx, kind));
emit_insn (gen_movdi (dst0, tmp0));
emit_insn (gen_movdi (dst1, tmp1));
- res = get_insns ();
- end_sequence ();
+ res = end_sequence ();
}
break;
case E_BImode:
@@ -2112,8 +2112,7 @@ nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind)
emit_insn (gen_sel_truesi (tmp, src, GEN_INT (1), const0_rtx));
emit_insn (nvptx_gen_shuffle (tmp, tmp, idx, kind));
emit_insn (gen_rtx_SET (dst, gen_rtx_NE (BImode, tmp, const0_rtx)));
- res = get_insns ();
- end_sequence ();
+ res = end_sequence ();
}
break;
case E_QImode:
@@ -2126,8 +2125,7 @@ nvptx_gen_shuffle (rtx dst, rtx src, rtx idx, nvptx_shuffle_kind kind)
emit_insn (nvptx_gen_shuffle (tmp, tmp, idx, kind));
emit_insn (gen_rtx_SET (dst, gen_rtx_fmt_e (TRUNCATE, GET_MODE (dst),
tmp)));
- res = get_insns ();
- end_sequence ();
+ res = end_sequence ();
}
break;
@@ -2190,8 +2188,7 @@ nvptx_gen_shared_bcast (rtx reg, propagate_mask pm, unsigned rep,
emit_insn (nvptx_gen_shared_bcast (tmp, pm, rep, data, vector));
if (pm & PM_write)
emit_insn (gen_rtx_SET (reg, gen_rtx_NE (BImode, tmp, const0_rtx)));
- res = get_insns ();
- end_sequence ();
+ res = end_sequence ();
}
break;
@@ -2227,8 +2224,7 @@ nvptx_gen_shared_bcast (rtx reg, propagate_mask pm, unsigned rep,
emit_insn (res);
emit_insn (gen_adddi3 (data->ptr, data->ptr,
GEN_INT (GET_MODE_SIZE (GET_MODE (reg)))));
- res = get_insns ();
- end_sequence ();
+ res = end_sequence ();
}
else
rep = 1;
@@ -2361,7 +2357,25 @@ nvptx_assemble_integer (rtx x, unsigned int size, int ARG_UNUSED (aligned_p))
{
gcc_checking_assert (!init_frag.active);
/* Just use the default machinery; it's not getting used, anyway. */
- return default_assemble_integer (x, size, aligned_p);
+ bool ok = default_assemble_integer (x, size, aligned_p);
+ /* ..., but a few cases need special handling. */
+ switch (GET_CODE (x))
+ {
+ case SYMBOL_REF:
+ /* The default machinery won't work: we don't define the necessary
+ operations; don't use them outside of this. */
+ gcc_checking_assert (!ok);
+ {
+ /* Just emit something; it's not getting used, anyway. */
+ const char *op = "\t.symbol_ref\t";
+ ok = (assemble_integer_with_op (op, x), true);
+ }
+ break;
+
+ default:
+ break;
+ }
+ return ok;
}
gcc_checking_assert (init_frag.active);
@@ -2597,7 +2611,7 @@ nvptx_asm_declare_constant_name (FILE *file, const char *name,
fprintf (file, "\t");
tree type = TREE_TYPE (exp);
- nvptx_assemble_decl_begin (file, name, ".const", type, obj_size,
+ nvptx_assemble_decl_begin (file, name, ".global", type, obj_size,
TYPE_ALIGN (type));
}
@@ -4581,8 +4595,7 @@ nvptx_propagate (bool is_call, basic_block block, rtx_insn *insn,
}
emit_insn (gen_rtx_CLOBBER (GET_MODE (tmp), tmp));
emit_insn (gen_rtx_CLOBBER (GET_MODE (ptr), ptr));
- rtx cpy = get_insns ();
- end_sequence ();
+ rtx cpy = end_sequence ();
insn = emit_insn_after (cpy, insn);
}
@@ -5587,8 +5600,7 @@ workaround_uninit_method_1 (void)
if (nvptx_comment && first != NULL)
emit_insn (gen_comment ("Start: Added by -minit-regs=1"));
emit_move_insn (reg, CONST0_RTX (GET_MODE (reg)));
- rtx_insn *inits = get_insns ();
- end_sequence ();
+ rtx_insn *inits = end_sequence ();
if (dump_file && (dump_flags & TDF_DETAILS))
for (rtx_insn *init = inits; init != NULL; init = NEXT_INSN (init))
@@ -5644,8 +5656,7 @@ workaround_uninit_method_2 (void)
if (nvptx_comment && first != NULL)
emit_insn (gen_comment ("Start: Added by -minit-regs=2:"));
emit_move_insn (reg, CONST0_RTX (GET_MODE (reg)));
- rtx_insn *inits = get_insns ();
- end_sequence ();
+ rtx_insn *inits = end_sequence ();
if (dump_file && (dump_flags & TDF_DETAILS))
for (rtx_insn *init = inits; init != NULL; init = NEXT_INSN (init))
@@ -5715,8 +5726,7 @@ workaround_uninit_method_3 (void)
start_sequence ();
emit_move_insn (reg, CONST0_RTX (GET_MODE (reg)));
- rtx_insn *inits = get_insns ();
- end_sequence ();
+ rtx_insn *inits = end_sequence ();
if (dump_file && (dump_flags & TDF_DETAILS))
for (rtx_insn *init = inits; init != NULL;
@@ -5747,8 +5757,7 @@ workaround_uninit_method_3 (void)
emit_insn (gen_comment ("Start: Added by -minit-regs=3:"));
emit_insn (e->insns.r);
emit_insn (gen_comment ("End: Added by -minit-regs=3:"));
- e->insns.r = get_insns ();
- end_sequence ();
+ e->insns.r = end_sequence ();
}
}
@@ -7768,9 +7777,23 @@ nvptx_asm_output_def_from_decls (FILE *stream, tree name,
return;
}
+#ifdef ACCEL_COMPILER
emit_ptx_alias:
+#endif
cgraph_node *cnode = cgraph_node::get (name);
+#ifdef ACCEL_COMPILER
+ /* For nvptx offloading, make sure to emit C++ constructor, destructor aliases [PR97106]
+
+ For some reason (yet to be analyzed), they're not 'cnode->referred_to_p ()'.
+ (..., or that's not the right approach at all;
+ <https://inbox.sourceware.org/87v7rx8lbx.fsf@euler.schwinge.ddns.net>
+ "Re: [committed][nvptx] Use .alias directive for mptx >= 6.3"). */
+ if (DECL_CXX_CONSTRUCTOR_P (name)
+ || DECL_CXX_DESTRUCTOR_P (name))
+ ;
+ else
+#endif
if (!cnode->referred_to_p ())
/* Prevent "Internal error: reference to deleted section". */
return;
@@ -7875,8 +7898,6 @@ nvptx_asm_output_def_from_decls (FILE *stream, tree name,
#define TARGET_ASM_DECLARE_CONSTANT_NAME nvptx_asm_declare_constant_name
#undef TARGET_USE_BLOCKS_FOR_CONSTANT_P
#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_true
-#undef TARGET_ASM_NEED_VAR_DECL_BEFORE_USE
-#define TARGET_ASM_NEED_VAR_DECL_BEFORE_USE true
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG nvptx_reorg