ix86_tune_features[X86_TUNE_AVOID_FALSE_DEP_FOR_BMI]
#define TARGET_ONE_IF_CONV_INSN \
ix86_tune_features[X86_TUNE_ONE_IF_CONV_INSN]
-#define TARGET_USE_XCHG_FOR_ATOMIC_STORE \
- ix86_tune_features[X86_TUNE_USE_XCHG_FOR_ATOMIC_STORE]
+#define TARGET_AVOID_MFENCE ix86_tune_features[X86_TUNE_AVOID_MFENCE]
#define TARGET_EMIT_VZEROUPPER \
ix86_tune_features[X86_TUNE_EMIT_VZEROUPPER]
#define TARGET_EXPAND_ABS \
(define_insn "mfence_sse2"
[(set (match_operand:BLK 0)
(unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
- "TARGET_64BIT || TARGET_SSE2"
+ "(TARGET_64BIT || TARGET_SSE2)
+ && !TARGET_AVOID_MFENCE"
"mfence"
[(set_attr "type" "sse")
(set_attr "length_address" "0")
[(set (match_operand:BLK 0)
(unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))
(clobber (reg:CC FLAGS_REG))]
- "!(TARGET_64BIT || TARGET_SSE2)"
- "lock{%;} or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}"
+ "!(TARGET_64BIT || TARGET_SSE2)
+ || TARGET_AVOID_MFENCE"
+{
+ rtx mem = gen_rtx_MEM (word_mode, stack_pointer_rtx);
+
+ output_asm_insn ("lock{%;} or%z0\t{$0, %0|%0, 0}", &mem);
+ return "";
+}
[(set_attr "memory" "unknown")])
(define_expand "mem_thread_fence"
rtx (*mfence_insn)(rtx);
rtx mem;
- if (TARGET_64BIT || TARGET_SSE2)
+ if ((TARGET_64BIT || TARGET_SSE2)
+ && !TARGET_AVOID_MFENCE)
mfence_insn = gen_mfence_sse2;
else
mfence_insn = gen_mfence_nosse;
{
operands[1] = force_reg (<MODE>mode, operands[1]);
- /* For seq-cst stores, use XCHG when we lack MFENCE
- or when target prefers XCHG. */
+ /* For seq-cst stores, use XCHG when we lack MFENCE. */
if (is_mm_seq_cst (model)
&& (!(TARGET_64BIT || TARGET_SSE2)
- || TARGET_USE_XCHG_FOR_ATOMIC_STORE))
+ || TARGET_AVOID_MFENCE))
{
emit_insn (gen_atomic_exchange<mode> (gen_reg_rtx (<MODE>mode),
operands[0], operands[1],
m_SILVERMONT | m_KNL | m_KNM | m_INTEL | m_CORE_ALL | m_GOLDMONT
| m_GOLDMONT_PLUS | m_TREMONT | m_GENERIC)
-/* X86_TUNE_USE_XCHG_FOR_ATOMIC_STORE: Use xchg instead of mov+mfence. */
-DEF_TUNE (X86_TUNE_USE_XCHG_FOR_ATOMIC_STORE, "use_xchg_for_atomic_store",
+/* X86_TUNE_AVOID_MFENCE: Use lock prefixed instructions instead of mfence. */
+DEF_TUNE (X86_TUNE_AVOID_MFENCE, "avoid_mfence",
m_CORE_ALL | m_BDVER | m_ZNVER | m_GENERIC)
/* X86_TUNE_EXPAND_ABS: This enables a new abs pattern by