+2015-01-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/64338
+ * config/i386/i386.c (ix86_expand_int_movcc): Don't reverse
+ compare_code when it is unconditionally overwritten afterwards.
+ Use ix86_reverse_condition instead of reverse_condition. Don't
+ change code if *reverse_condition* returned UNKNOWN and don't
+ swap ct/cf and negate diff in that case.
+
2015-01-08 Mike Stump <mikestump@comcast.net>
* tsan.c (pass_tsan::gate): Add no_sanitize_thread support.
if (diff < 0)
{
machine_mode cmp_mode = GET_MODE (op0);
-
- std::swap (ct, cf);
- diff = -diff;
+ enum rtx_code new_code;
if (SCALAR_FLOAT_MODE_P (cmp_mode))
{
is not valid in general (we may convert non-trapping condition
to trapping one), however on i386 we currently emit all
comparisons unordered. */
- compare_code = reverse_condition_maybe_unordered (compare_code);
- code = reverse_condition_maybe_unordered (code);
+ new_code = reverse_condition_maybe_unordered (code);
}
else
+ new_code = ix86_reverse_condition (code, cmp_mode);
+ if (new_code != UNKNOWN)
{
- compare_code = reverse_condition (compare_code);
- code = reverse_condition (code);
+ std::swap (ct, cf);
+ diff = -diff;
+ code = new_code;
}
}
if (cf == 0)
{
machine_mode cmp_mode = GET_MODE (op0);
-
- cf = ct;
- ct = 0;
+ enum rtx_code new_code;
if (SCALAR_FLOAT_MODE_P (cmp_mode))
{
that is not valid in general (we may convert non-trapping
condition to trapping one), however on i386 we currently
emit all comparisons unordered. */
- code = reverse_condition_maybe_unordered (code);
+ new_code = reverse_condition_maybe_unordered (code);
}
else
{
- code = reverse_condition (code);
- if (compare_code != UNKNOWN)
+ new_code = ix86_reverse_condition (code, cmp_mode);
+ if (compare_code != UNKNOWN && new_code != UNKNOWN)
compare_code = reverse_condition (compare_code);
}
+
+ if (new_code != UNKNOWN)
+ {
+ cf = ct;
+ ct = 0;
+ code = new_code;
+ }
}
if (compare_code != UNKNOWN)
--- /dev/null
+// PR target/64338
+// { dg-do compile }
+// { dg-options "-O2" }
+// { dg-additional-options "-mtune=nehalem -march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } }
+
+enum O {};
+struct A { A (); };
+struct B { int fn1 (); };
+struct C { struct D; D *fn2 (); void fn3 (); int fn4 (); };
+struct F { void fn5 (const int & = 0); };
+struct G { F *fn6 (); };
+struct H { int h; };
+struct C::D { friend class C; G *fn7 (); };
+O a;
+
+void
+C::fn3 ()
+{
+ int b = a;
+ H c;
+ if (b)
+ fn2 ()->fn7 ()->fn6 ()->fn5 ();
+ double d;
+ if (fn4 ())
+ d = c.h > 0;
+ A e (b ? A () : A ());
+ B f;
+ f.fn1 () && d && fn2 ();
+}