re PR target/53487 (Unrecognizable insn for conditional move)
authorMichael Meissner <meissner@linux.vnet.ibm.com>
Tue, 5 Jun 2012 19:40:34 +0000 (19:40 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Tue, 5 Jun 2012 19:40:34 +0000 (19:40 +0000)
[gcc]
2012-06-04  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/53487
* config/rs6000/rs6000.c (rs6000_generate_compare): If we are
doing an unsigned compare, make sure the second argument is not a
negative constant.
(rs6000_emit_cmove): Don't allow floating point comparisons when
generating ISEL moves.

[gcc/testsuite]
2012-06-04  Michael Meissner  <meissner@linux.vnet.ibm.com>

* gcc.target/powerpc/pr53487.c: New test.

From-SVN: r188248

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr53487.c [new file with mode: 0644]

index d11f0016788eaae3752896003ea98b6af4ee2ce3..7ed28072a10a26e5ed0ca1452e067a70cb16d675 100644 (file)
@@ -1,3 +1,12 @@
+2012-06-05  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/53487
+       * config/rs6000/rs6000.c (rs6000_generate_compare): If we are
+       doing an unsigned compare, make sure the second argument is not a
+       negative constant.
+       (rs6000_emit_cmove): Don't allow floating point comparisons when
+       generating ISEL moves.
+
 2012-06-05  Edmar Wienskoski  <edmar@freescale.com>
 
        * config/rs6000/e5500.md: New file.
index ffb00230acd7c5936df8f72db6f4ce297ad8ce55..11c4bf725ee25bc03f946f8e7224e2c26b176446 100644 (file)
@@ -15419,6 +15419,16 @@ rs6000_generate_compare (rtx cmp, enum machine_mode mode)
   else
     comp_mode = CCmode;
 
+  /* If we have an unsigned compare, make sure we don't have a signed value as
+     an immediate.  */
+  if (comp_mode == CCUNSmode && GET_CODE (op1) == CONST_INT
+      && INTVAL (op1) < 0)
+    {
+      op0 = copy_rtx_if_shared (op0);
+      op1 = force_reg (GET_MODE (op0), op1);
+      cmp = gen_rtx_fmt_ee (code, GET_MODE (cmp), op0, op1);
+    }
+
   /* First, the compare.  */
   compare_result = gen_reg_rtx (comp_mode);
 
@@ -16172,6 +16182,11 @@ rs6000_emit_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond)
   if (GET_MODE (false_cond) != result_mode)
     return 0;
 
+  /* Don't allow using floating point comparisons for integer results for
+     now.  */
+  if (FLOAT_MODE_P (compare_mode) && !FLOAT_MODE_P (result_mode))
+    return 0;
+
   /* First, work out if the hardware can do this at all, or
      if it's too slow....  */
   if (!FLOAT_MODE_P (compare_mode))
index a43d899d97526036a6a131f1b653b05d43905d2f..c25aadbc35ec6e4fe6336caa624c30fd0a80f1d6 100644 (file)
@@ -1,3 +1,7 @@
+2012-06-05  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       * gcc.target/powerpc/pr53487.c: New test.
+
 2012-06-05  Pat Haugen <pthaugen@us.ibm.com>
 
        * gcc.target/powerpc/lhs-1.c: Use parm instead of stack space.
diff --git a/gcc/testsuite/gcc.target/powerpc/pr53487.c b/gcc/testsuite/gcc.target/powerpc/pr53487.c
new file mode 100644 (file)
index 0000000..3e8265b
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O3 -mcpu=power7 -misel -ffast-math" } */
+
+struct phylo_s {
+  int left;
+};
+
+int Cluster(float **dmx, int N, struct phylo_s *tree)
+{
+  float **mx;
+  int *coord;
+  int i;
+  int Np;
+  int row, col;
+  float min;
+  for (col = 0; col < N; Np--)
+    {
+      for (row = 0; row < Np; row++)
+       for (col = row+1; col < Np; col++)
+         if (mx[row][col] < min)
+           i = row;
+      tree[Np-2].left = coord[i];
+    }
+  Free2DArray((void **) mx, N);
+}