===================================================================
@@ -18093,6 +18093,17 @@
DONE;
})
+(define_expand "xbegin_label"
+ [(parallel
+ [(set (pc)
+ (if_then_else (ne (unspec [(const_int 0)] UNSPEC_XBEGIN_ABORT)
+ (const_int 0))
+ (match_operand 1)
+ (pc)))
+ (set (match_operand:SI 0 "register_operand")
+ (unspec_volatile:SI [(match_dup 0)] UNSPECV_XBEGIN))])]
+ "TARGET_RTM")
+
(define_insn "xbegin_1"
[(set (pc)
(if_then_else (ne (unspec [(const_int 0)] UNSPEC_XBEGIN_ABORT)
===================================================================
@@ -26570,6 +26570,7 @@ enum ix86_builtins
/* RTM */
IX86_BUILTIN_XBEGIN,
+ IX86_BUILTIN_XBEGIN_LABEL,
IX86_BUILTIN_XEND,
IX86_BUILTIN_XABORT,
IX86_BUILTIN_XTEST,
@@ -26942,6 +26943,7 @@ static const struct builtin_description bdesc_spec
/* RTM */
{ OPTION_MASK_ISA_RTM, CODE_FOR_xbegin, "__builtin_ia32_xbegin", IX86_BUILTIN_XBEGIN, UNKNOWN, (int) UNSIGNED_FTYPE_VOID },
+ { OPTION_MASK_ISA_RTM, CODE_FOR_xbegin_label, "__builtin_ia32_xbegin_label", IX86_BUILTIN_XBEGIN_LABEL, UNKNOWN, (int) VOID_FTYPE_PCVOID },
{ OPTION_MASK_ISA_RTM, CODE_FOR_xend, "__builtin_ia32_xend", IX86_BUILTIN_XEND, UNKNOWN, (int) VOID_FTYPE_VOID },
{ OPTION_MASK_ISA_RTM, CODE_FOR_xtest, "__builtin_ia32_xtest", IX86_BUILTIN_XTEST, UNKNOWN, (int) INT_FTYPE_VOID },
};
@@ -32239,6 +32241,17 @@ addcarryx:
return target;
+ case IX86_BUILTIN_XBEGIN_LABEL:
+ arg0 = CALL_EXPR_ARG (exp, 0);
+ op0 = expand_normal (arg0);
+ if (GET_CODE (op0) != LABEL_REF)
+ {
+ error ("the xbegin's argument must be a label");
+ return const0_rtx;
+ }
+ emit_jump_insn (gen_xbegin_label (gen_rtx_REG (SImode, AX_REG), op0));
+ return 0;
+
case IX86_BUILTIN_XABORT:
icode = CODE_FOR_xabort;
arg0 = CALL_EXPR_ARG (exp, 0);