On 10/29/2014 04:31 AM, Andi Kleen wrote:
> 2014-10-28  Andi Kleen  <a...@linux.intel.com>
> 
>       PR target/63672
>       * config/i386/i386.c (ix86_expand_builtin): Generate memory
>       barrier after abort.
>       * config/i386/i386.md (xbegin): Add memory barrier.
>       (xend): Rename to ...
>       (xend_1): New. Generate memory barrier and emit xend.

Richi's comment is spot on.

The insns themselves should hold the barrier, not being separate like

> 
> -(define_insn "xend"
> +(define_insn "xend_1"
>    [(unspec_volatile [(const_int 0)] UNSPECV_XEND)]
>    "TARGET_RTM"
>    "xend"
>    [(set_attr "type" "other")
>     (set_attr "length" "3")])
>  
> +(define_expand "xend"
> +  [(set (match_dup 0)
> +     (unspec:BLK [(const_int 0)] UNSPECV_XEND))] /* or match_dup 0 ? */
> +  "TARGET_RTM"
> +{
> +  emit_insn (gen_xend_1 ());
> +
> +  operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
> +  MEM_VOLATILE_P (operands[0]) = 1;
> +
> +  DONE;
> +})

this, which generates two separate insns.  C.f. sse2_lfence.


r~

Reply via email to