On 06/02/16 17:22, Alexander Monakov wrote:
On Wed, 25 May 2016, Nathan Sidwell wrote:
It seems like we should reject the combination of -msoft-stack -fopenacc?
Possibly; the doc text makes it explicit that the option is exposed only for
the purpose of testing the compiler, anyway.
It is always best to prevent the user doing something you don't recommend,
rather than presume they'll be sensible.
No change for that yet in the respin; do you want something like
if (flag_openacc && TARGET_SOFT_STACK)
sorry ("-fopenacc and -msoft-stack are mutually exclusive");
in nvptx_override_options?
Yes, but it's not a sorry, just a regular error.
+static void
+init_softstack_frame (FILE *file, unsigned alignment, unsigned size)
+{
+ /* Maintain 64-bit stack alignment. */
This still needs blank lines to aid readibility.
@@ -1027,6 +1186,21 @@ nvptx_declare_function_name (FILE *file, const char
*name, const_tree decl)
REGNO (cfun->machine->axis_predicate[1]), "x");
}
+/* Output instruction that sets soft stack pointer in shared memory to the
+ value in register given by SRC_REGNO. */
+
+const char *
+nvptx_output_set_softstack (unsigned src_regno)
+{
+ if (cfun->machine->has_softstack && !crtl->is_leaf)
+ {
+ fprintf (asm_out_file, "\tst.shared.u%d\t[%s], ",
+ POINTER_SIZE, reg_names[SOFTSTACK_SLOT_REGNUM]);
+ output_reg (asm_out_file, src_regno, VOIDmode);
+ fprintf (asm_out_file, ";\n");
+ }
+ return "";
I think this would be clearer by having the softstack insn's pattern mention
both the SRC and softstack reg and then simply return either "" or
"st.shared%t\\t%0, %1" (and do that directly in the insn's emitter section
rather than an fn call?) Then also have an epilogue expander emit the insn,
rather than embed it in the return emitter.
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
(define_expand "restore_stack_block"
[(match_operand 0 "register_operand" "")
(match_operand 1 "register_operand" "")]
you've not addressed my previous comments about this.
@@ -0,0 +1,25 @@
+char *__nvptx_stacks[32] __attribute__((shared,nocommon));
Is there a reason this can't be in crt0?
It should be 'void *' Also, why '32' when only slot zero is initialized? ISTM
that this should be size 1.