if (tail_branch)
{
label_insn = emit_label_before (label, before);
- if (TARGET_PTX_6_0 && mode == GOMP_DIM_VECTOR)
- warp_sync = emit_insn_after (gen_nvptx_warpsync (), label_insn);
+ if (mode == GOMP_DIM_VECTOR)
+ {
+ if (TARGET_PTX_6_0)
+ warp_sync = emit_insn_after (gen_nvptx_warpsync (),
+ label_insn);
+ else
+ warp_sync = emit_insn_after (gen_nvptx_uniform_warp_check (),
+ label_insn);
+ }
before = label_insn;
}
else
{
label_insn = emit_label_after (label, tail);
- if (TARGET_PTX_6_0 && mode == GOMP_DIM_VECTOR)
- warp_sync = emit_insn_after (gen_nvptx_warpsync (), label_insn);
+ if (mode == GOMP_DIM_VECTOR)
+ {
+ if (TARGET_PTX_6_0)
+ warp_sync = emit_insn_after (gen_nvptx_warpsync (),
+ label_insn);
+ else
+ warp_sync = emit_insn_after (gen_nvptx_uniform_warp_check (),
+ label_insn);
+ }
if ((mode == GOMP_DIM_VECTOR || mode == GOMP_DIM_WORKER)
&& CALL_P (tail) && find_reg_note (tail, REG_NORETURN, NULL))
emit_insn_after (gen_exit (), label_insn);
UNSPECV_XCHG
UNSPECV_BARSYNC
UNSPECV_WARPSYNC
+ UNSPECV_UNIFORM_WARP_CHECK
UNSPECV_MEMBAR
UNSPECV_MEMBAR_CTA
UNSPECV_MEMBAR_GL
"\\tbar.warp.sync\\t0xffffffff;"
[(set_attr "predicable" "false")])
+(define_insn "nvptx_uniform_warp_check"
+ [(unspec_volatile [(const_int 0)] UNSPECV_UNIFORM_WARP_CHECK)]
+ ""
+ {
+ output_asm_insn ("{", NULL);
+ output_asm_insn ("\\t" ".reg.b32" "\\t" "act;", NULL);
+ output_asm_insn ("\\t" "vote.ballot.b32" "\\t" "act,1;", NULL);
+ output_asm_insn ("\\t" ".reg.pred" "\\t" "uni;", NULL);
+ output_asm_insn ("\\t" "setp.eq.b32" "\\t" "uni,act,0xffffffff;",
+ NULL);
+ output_asm_insn ("@ !uni\\t" "trap;", NULL);
+ output_asm_insn ("@ !uni\\t" "exit;", NULL);
+ output_asm_insn ("}", NULL);
+ return "";
+ }
+ [(set_attr "predicable" "false")])
+
(define_expand "memory_barrier"
[(set (match_dup 0)
(unspec_volatile:BLK [(match_dup 0)] UNSPECV_MEMBAR))]