diff mbox

[i386] : Fix PR 63947, Wrong fcmov suffix

Message ID CAFULd4Z_iJfU=T8vYdfsE_LPfENDto9TCTt4f+4yvPx-LEFxag@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Nov. 19, 2014, 8:34 p.m. UTC
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  <ubizjak@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  <ubizjak@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.
diff mbox

Patch

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;
+}