+2012-05-14 Andrew Pinski <apinski@cavium.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR target/53315
+ * config/i386/i386.md (xbegin_1): Use + in constraint and
+ match_dup.
+ (xbegin): Updated.
+
2012-05-14 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (dwarf2out_define, dwarf2out_undef): Treat
operands[1] = force_reg (SImode, constm1_rtx);
- emit_jump_insn (gen_xbegin_1 (operands[0], operands[1], label));
+ emit_jump_insn (gen_xbegin_1 (operands[1], label));
emit_label (label);
LABEL_NUSES (label) = 1;
+ emit_move_insn (operands[0], operands[1]);
+
DONE;
})
[(set (pc)
(if_then_else (ne (unspec [(const_int 0)] UNSPEC_XBEGIN_ABORT)
(const_int 0))
- (label_ref (match_operand 2))
+ (label_ref (match_operand 1))
(pc)))
- (set (match_operand:SI 0 "register_operand" "=a")
- (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "0")]
- UNSPECV_XBEGIN))]
+ (set (match_operand:SI 0 "register_operand" "+a")
+ (unspec_volatile:SI [(match_dup 0)] UNSPECV_XBEGIN))]
"TARGET_RTM"
- "xbegin\t%l2"
+ "xbegin\t%l1"
[(set_attr "type" "other")
(set_attr "length" "6")])
+2012-05-14 Andi Kleen <ak@linux.intel.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR target/53315
+ * gcc.target/i386/i386.exp (check_effective_target_rtm): New.
+ * gcc.target/i386/rtm-check.h: New file.
+ * gcc.target/i386/pr53315.c: New test.
+
2012-05-14 Tobias Burnus <burnus@net-b.de>
PR fortran/49110
-# Copyright (C) 1997, 2004, 2007, 2008, 2009, 2010
+# Copyright (C) 1997, 2004, 2007, 2008, 2009, 2010, 2011, 2012
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
} "-mbmi2" ]
}
+# Return 1 if rtm instructions can be compiled.
+proc check_effective_target_rtm { } {
+ return [check_no_compiler_messages rtm object {
+ void
+ _rtm_xend (void)
+ {
+ return __builtin_ia32_xend ();
+ }
+ } "-mrtm" ]
+}
+
# If the linker used understands -M <mapfile>, pass it to clear hardware
# capabilities set by the Sun assembler.
set clearcap_ldflags "-Wl,-M,$srcdir/$subdir/clearcap.map"
--- /dev/null
+/* PR target/53315 and PR target/53291 */
+/* { dg-do run } */
+/* { dg-options "-O2 -mrtm" } */
+/* { dg-require-effective-target rtm } */
+
+#include <x86intrin.h>
+#include "rtm-check.h"
+
+static void
+rtm_test (void)
+{
+ int flag = -1;
+ unsigned status;
+
+ if ((status = _xbegin ()) == _XBEGIN_STARTED)
+ {
+ flag = _xtest ();
+ _xend ();
+ }
+ else
+ return;
+
+ if (flag != 1)
+ abort ();
+ if (_xtest () != 0)
+ abort ();
+}
--- /dev/null
+#include <stdlib.h>
+#include "cpuid.h"
+
+static void rtm_test (void);
+
+static void __attribute__ ((noinline)) do_test (void)
+{
+ rtm_test ();
+}
+
+int
+main ()
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ if (__get_cpuid_max (0, NULL) >= 7)
+ {
+ __cpuid_count (7, 0, eax, ebx, ecx, edx);
+ if (ebx & bit_RTM)
+ {
+ do_test ();
+#ifdef DEBUG
+ printf ("PASSED\n");
+#endif
+ return 0;
+ }
+ }
+#ifdef DEBUG
+ printf ("SKIPPED\n");
+#endif
+ return 0;
+}