OSDN Git Service

PR middle-end/40669
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Jul 2009 12:18:38 +0000 (12:18 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Jul 2009 12:18:38 +0000 (12:18 +0000)
* tree-tailcall.c (adjust_return_value_with_ops,
create_tailcall_accumulator): Set DECL_GIMPLE_REG_P on the temporary
if it has complex or vector type.

* gcc.dg/pr40669.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149319 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr40669.c [new file with mode: 0644]
gcc/tree-tailcall.c

index 46d5145..d659986 100644 (file)
@@ -1,3 +1,10 @@
+2009-07-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/40669
+       * tree-tailcall.c (adjust_return_value_with_ops,
+       create_tailcall_accumulator): Set DECL_GIMPLE_REG_P on the temporary
+       if it has complex or vector type.
+
 2009-07-07  Olivier Hainque  <hainque@adacore.com>
 
         * config/alpha/t-osf4 (SHLIB_LINK): Do not hide the dummy weak
index 0b889ae..2f8b25f 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/40669
+       * gcc.dg/pr40669.c: New test.
+
 2009-07-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        * gcc.dg/plugin/selfassign.c: Replace %H by an explicit
diff --git a/gcc/testsuite/gcc.dg/pr40669.c b/gcc/testsuite/gcc.dg/pr40669.c
new file mode 100644 (file)
index 0000000..cc6bbc9
--- /dev/null
@@ -0,0 +1,26 @@
+/* PR middle-end/40669 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+double _Complex
+test (int d, int t, double *x, double *y, double *z, int n,
+      double _Complex (*fnp) (double))
+{
+  int m = n / 2;
+  double min = y[t], max = z[t], med = x[m * d + t];
+  double _Complex result = 0.0;
+
+  if (n == 0)
+    return 0.0;
+
+  if (min > med)
+    result += test (d, (t + 1) % d, x + (m + 1) * d, y, z, n - m - 1, fnp);
+  else if (max < med)
+    result += test (d, (t + 1) % d, x, y, z, m, fnp);
+  else
+    {
+      result += fnp (y[0] + x[m]);
+      result += test (d, (t + 1) % d, x + (m + 1) * d, y, z, n - m - 1, fnp);
+    }
+  return result;
+}
index 23d849f..f2d58dd 100644 (file)
@@ -567,6 +567,9 @@ adjust_return_value_with_ops (enum tree_code code, const char *label,
   gimple stmt = gimple_build_assign_with_ops (code, tmp, op0, op1);
   tree result;
 
+  if (TREE_CODE (ret_type) == COMPLEX_TYPE
+      || TREE_CODE (ret_type) == VECTOR_TYPE)
+    DECL_GIMPLE_REG_P (tmp) = 1;
   add_referenced_var (tmp);
   result = make_ssa_name (tmp, stmt);
   gimple_assign_set_lhs (stmt, result);
@@ -861,6 +864,9 @@ create_tailcall_accumulator (const char *label, basic_block bb, tree init)
   tree tmp = create_tmp_var (ret_type, label);
   gimple phi;
 
+  if (TREE_CODE (ret_type) == COMPLEX_TYPE
+      || TREE_CODE (ret_type) == VECTOR_TYPE)
+    DECL_GIMPLE_REG_P (tmp) = 1;
   add_referenced_var (tmp);
   phi = create_phi_node (tmp, bb);
   /* RET_TYPE can be a float when -ffast-maths is enabled.  */