var-expand1.c: New test.
authorRevital Eres <eres@il.ibm.com>
Mon, 5 Mar 2007 09:28:23 +0000 (09:28 +0000)
committerVictor Kaplansky <victork@gcc.gnu.org>
Mon, 5 Mar 2007 09:28:23 +0000 (09:28 +0000)
2007-03-05  Revital Eres  <eres@il.ibm.com>

      * gcc.dg/var-expand1.c: New test.
      * loop-unroll.c (analyze_insn_to_expand_var): Add dump info
      when an accumulator is expanded.

From-SVN: r122543

gcc/ChangeLog
gcc/loop-unroll.c
gcc/testsuite/gcc.dg/var-expand1.c [new file with mode: 0644]

index 47b83c8..5b125fd 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-05  Revital Eres  <eres@il.ibm.com>
+
+      * gcc.dg/var-expand1.c: New test.
+      * loop-unroll.c (analyze_insn_to_expand_var): Add dump info
+      when an accumulator is expanded.
+
 2007-03-04  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        PR other/30465
index 63eebed..8fb69b8 100644 (file)
@@ -1588,7 +1588,15 @@ analyze_insn_to_expand_var (struct loop *loop, rtx insn)
        || FLOAT_MODE_P (mode2)) 
       && !flag_unsafe_math_optimizations) 
     return NULL;
-  
+
+  if (dump_file)
+  {
+    fprintf (dump_file,
+    "\n;; Expanding Accumulator ");
+    print_rtl (dump_file, dest);
+    fprintf (dump_file, "\n");
+  }
+
   /* Record the accumulator to expand.  */
   ves = XNEW (struct var_to_expand);
   ves->insn = insn;
diff --git a/gcc/testsuite/gcc.dg/var-expand1.c b/gcc/testsuite/gcc.dg/var-expand1.c
new file mode 100644 (file)
index 0000000..3bb44e0
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -funroll-loops --fast-math -fvariable-expansion-in-unroller -dL" } */
+
+extern void abort (void);
+
+float array[10] = { 1,2,3,4,5,6,7,8,9,10 };
+
+int foo (int n)
+{
+  unsigned i;
+  float accum = 1.0;
+
+  for (i = 0; i < n; i++)
+    accum += array[i];
+
+  return accum;
+}
+
+int main (void)
+{
+  return foo (10);
+}
+
+/* { dg-final { scan-rtl-dump "Expanding Accumulator" "loop2_unroll" } } */
+/* { dg-final { cleanup-rtl-dump "loop*" } } */
\ No newline at end of file