Hello!

Carry flag checks from overflow tests can propagate into FP cmove
instructions. However, while "c" and "nc" suffixes are allowed as
suffixes in integer cmove insns, they are not allowed in FP cmove
insns. Patch generates equivalent "b" and "nb" suffixes for FP mode.

2014-11-19  Uros Bizjak  <ubiz...@gmail.com>

    PR target/63947
    * config/i386/i386.c (put_condition_code) <case LTU, case GEU>:
    Output "b" and "nb" suffix for FP mode.

testsuite/ChangeLog:

2014-11-19  Uros Bizjak  <ubiz...@gmail.com>

    PR target/63947
    * gcc.target/i386/pr63947.c: New test.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Patch was committed to mainline SVN and will be backported to all
active branches.

Uros.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 217789)
+++ config/i386/i386.c  (working copy)
@@ -14953,7 +14953,7 @@ put_condition_code (enum rtx_code code, machine_mo
       if (mode == CCmode)
        suffix = "b";
       else if (mode == CCCmode)
-       suffix = "c";
+       suffix = fp ? "b" : "c";
       else
        gcc_unreachable ();
       break;
@@ -14976,9 +14976,9 @@ put_condition_code (enum rtx_code code, machine_mo
       break;
     case GEU:
       if (mode == CCmode)
-       suffix = fp ? "nb" : "ae";
+       suffix = "nb";
       else if (mode == CCCmode)
-       suffix = "nc";
+       suffix = fp ? "nb" : "nc";
       else
        gcc_unreachable ();
       break;
Index: testsuite/gcc.target/i386/pr63947.c
===================================================================
--- testsuite/gcc.target/i386/pr63947.c (revision 0)
+++ testsuite/gcc.target/i386/pr63947.c (working copy)
@@ -0,0 +1,9 @@
+/* PR target/63947 */
+/* { dg-do assemble } */
+/* { dg-options "-Os" } */
+/* { dg-additional-options "-march=i686" { target ia32 } } */
+
+long double foo (unsigned a, unsigned b)
+{
+  return a + b < a;
+}

Reply via email to