continue;
rtx pat = PATTERN (insn);
- gcc_assert (GET_CODE (pat) == PARALLEL);
rtx master = nvptx_get_unisimt_master ();
bool shuffle_p = false;
- for (int i = 0; i < XVECLEN (pat, 0); i++)
- shuffle_p
- |= nvptx_unisimt_handle_set (XVECEXP (pat, 0, i), insn, master);
+ switch (GET_CODE (pat))
+ {
+ case PARALLEL:
+ for (int i = 0; i < XVECLEN (pat, 0); i++)
+ shuffle_p
+ |= nvptx_unisimt_handle_set (XVECEXP (pat, 0, i), insn, master);
+ break;
+ case SET:
+ shuffle_p |= nvptx_unisimt_handle_set (pat, insn, master);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
if (shuffle_p && TARGET_PTX_6_0)
{
/* The shuffle is a sync, so uniformity is guaranteed. */
if (TARGET_SM70)
{
- emit_insn (gen_nvptx_atomic_store<mode> (operands[0], operands[1],
- operands[2]));
+ emit_insn (gen_nvptx_atomic_store_sm70<mode> (operands[0], operands[1],
+ operands[2]));
DONE;
}
/* Fall back to expand_atomic_store. */
FAIL;
- rtx tmpreg = gen_reg_rtx (<MODE>mode);
- emit_insn (gen_atomic_exchange<mode> (tmpreg, operands[0], operands[1],
- operands[2]));
+ emit_insn (gen_nvptx_atomic_store<mode> (operands[0], operands[1],
+ operands[2]));
DONE;
})
-(define_insn "nvptx_atomic_store<mode>"
+(define_insn "nvptx_atomic_store_sm70<mode>"
[(set (match_operand:SDIM 0 "memory_operand" "+m") ;; memory
(unspec_volatile:SDIM
[(match_operand:SDIM 1 "nvptx_nonmemory_operand" "Ri") ;; input
}
[(set_attr "atomic" "false")]) ;; Note: st is not an atomic insn.
+(define_insn "nvptx_atomic_store<mode>"
+ [(set (match_operand:SDIM 0 "memory_operand" "+m") ;; memory
+ (unspec_volatile:SDIM
+ [(match_operand:SDIM 1 "nvptx_nonmemory_operand" "Ri") ;; input
+ (match_operand:SI 2 "const_int_operand")] ;; model
+ UNSPECV_ST))]
+ "!TARGET_SM70"
+ {
+ const char *t
+ = "%.\tatom%A0.exch.b%T0\t_, %0, %1;";
+ return nvptx_output_atomic_insn (t, operands, 0, 2);
+ }
+ [(set_attr "atomic" "true")])
+
(define_insn "atomic_fetch_add<mode>"
[(set (match_operand:SDIM 1 "memory_operand" "+m")
(unspec_volatile:SDIM
return 0;
}
-/* { dg-final { scan-assembler-times "atom.shared.exch.b32" 1 } } */
-/* { dg-final { scan-assembler-times "atom.shared.exch.b64" 1 } } */
+/* { dg-final { scan-assembler-times "atom.shared.exch.b32\[\t \]+_," 1 } } */
+/* { dg-final { scan-assembler-times "atom.shared.exch.b64\[\t \]+_," 1 } } */
/* { dg-final { scan-assembler-times "membar.cta" 4 } } */