OSDN Git Service

Revert:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Jan 2012 16:55:40 +0000 (16:55 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Jan 2012 16:55:40 +0000 (16:55 +0000)
2008-09-18  Andrew Pinski  <andrew_pinski@playstation.sony.com>

PR rtl-opt/37451
* loop-doloop.c (doloop_modify): New argument zero_extend_p and
zero extend count after the correction to it is done.
(doloop_optimize): Update call to doloop_modify, don't zero extend
count before call.

2008-11-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>

PR rtl-opt/37782
* loop-doloop.c (doloop_modify): Add from_mode argument that says what
mode count is in.
(doloop_optimize): Update call to doloop_modify.

testsuite:
* gcc.c-torture/execute/doloop-1.c,
gcc.c-torture/execute/doloop-2.c: New tests.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@183071 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/loop-doloop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/doloop-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/doloop-2.c [new file with mode: 0644]

index feb3646..a7fcb17 100644 (file)
@@ -1,3 +1,22 @@
+2012-01-10  Joseph Myers  <joseph@codesourcery.com>
+
+       Revert:
+
+       2008-09-18  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR rtl-opt/37451
+       * loop-doloop.c (doloop_modify): New argument zero_extend_p and
+       zero extend count after the correction to it is done.
+       (doloop_optimize): Update call to doloop_modify, don't zero extend
+       count before call.
+
+       2008-11-03  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR rtl-opt/37782
+       * loop-doloop.c (doloop_modify): Add from_mode argument that says what
+       mode count is in.
+       (doloop_optimize): Update call to doloop_modify.
+
 2012-01-09  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/mips/mips.md (loadgp_newabi_<mode>): Add missing
index 1833954..dcc20b1 100644 (file)
@@ -334,14 +334,11 @@ add_test (rtx cond, edge *e, basic_block dest)
    describes the loop, DESC describes the number of iterations of the
    loop, and DOLOOP_INSN is the low-overhead looping insn to emit at the
    end of the loop.  CONDITION is the condition separated from the
-   DOLOOP_SEQ.  COUNT is the number of iterations of the LOOP.
-   ZERO_EXTEND_P says to zero extend COUNT after the increment of it to
-   word_mode from FROM_MODE.  */
+   DOLOOP_SEQ.  COUNT is the number of iterations of the LOOP.  */
 
 static void
 doloop_modify (struct loop *loop, struct niter_desc *desc,
-              rtx doloop_seq, rtx condition, rtx count,
-              bool zero_extend_p, enum machine_mode from_mode)
+              rtx doloop_seq, rtx condition, rtx count)
 {
   rtx counter_reg;
   rtx tmp, noloop = NULL_RTX;
@@ -415,11 +412,7 @@ doloop_modify (struct loop *loop, struct niter_desc *desc,
     }
 
   if (increment_count)
-    count = simplify_gen_binary (PLUS, from_mode, count, const1_rtx);
-
-  if (zero_extend_p)
-    count = simplify_gen_unary (ZERO_EXTEND, word_mode,
-                               count, from_mode);
+    count = simplify_gen_binary (PLUS, mode, count, const1_rtx);
 
   /* Insert initialization of the count register into the loop header.  */
   start_sequence ();
@@ -555,7 +548,6 @@ doloop_optimize (struct loop *loop)
   struct niter_desc *desc;
   unsigned word_mode_size;
   unsigned HOST_WIDE_INT word_mode_max;
-  bool zero_extend_p = false;
 
   if (dump_file)
     fprintf (dump_file, "Doloop: Processing loop %d.\n", loop->num);
@@ -630,7 +622,8 @@ doloop_optimize (struct loop *loop)
     {
       if (word_mode_size > GET_MODE_BITSIZE (mode))
        {
-         zero_extend_p = true;
+         count = simplify_gen_unary (ZERO_EXTEND, word_mode,
+                                     count, mode);
          iterations = simplify_gen_unary (ZERO_EXTEND, word_mode,
                                           iterations, mode);
          iterations_max = simplify_gen_unary (ZERO_EXTEND, word_mode,
@@ -674,8 +667,7 @@ doloop_optimize (struct loop *loop)
       return false;
     }
 
-  doloop_modify (loop, desc, doloop_seq, condition, count,
-                zero_extend_p, mode);
+  doloop_modify (loop, desc, doloop_seq, condition, count);
   return true;
 }
 
index bb3db62..ef596d4 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-10  Joseph Myers  <joseph@codesourcery.com>
+
+       * gcc.c-torture/execute/doloop-1.c,
+       gcc.c-torture/execute/doloop-2.c: New tests.
+
 2012-01-09  Martin Jambor  <mjambor@suse.cz>
 
         PR tree-optimization/51759
diff --git a/gcc/testsuite/gcc.c-torture/execute/doloop-1.c b/gcc/testsuite/gcc.c-torture/execute/doloop-1.c
new file mode 100644 (file)
index 0000000..d2394a6
--- /dev/null
@@ -0,0 +1,18 @@
+#include <limits.h>
+
+extern void exit (int);
+extern void abort (void);
+
+volatile unsigned int i;
+
+int
+main (void)
+{
+  unsigned char z = 0;
+
+  do ++i;
+  while (--z > 0);
+  if (i != UCHAR_MAX + 1U)
+    abort ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/doloop-2.c b/gcc/testsuite/gcc.c-torture/execute/doloop-2.c
new file mode 100644 (file)
index 0000000..f981180
--- /dev/null
@@ -0,0 +1,18 @@
+#include <limits.h>
+
+extern void exit (int);
+extern void abort (void);
+
+volatile unsigned int i;
+
+int
+main (void)
+{
+  unsigned short z = 0;
+
+  do ++i;
+  while (--z > 0);
+  if (i != USHRT_MAX + 1U)
+    abort ();
+  exit (0);
+}