bfin.md (doloop_end): Fail for loops that can iterate 2^32-1 or more times unless...
authorBernd Schmidt <bernd.schmidt@analog.com>
Fri, 23 Feb 2007 15:52:27 +0000 (15:52 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Fri, 23 Feb 2007 15:52:27 +0000 (15:52 +0000)
* config/bfin/bfin.md (doloop_end): Fail for loops that can iterate
2^32-1 or more times unless flag_unsafe_loop_optimizations.

From-SVN: r122262

gcc/ChangeLog
gcc/config/bfin/bfin.md

index c0fcb118c42a1860fb93843129aea118cadb310d..fed1961f66622e6c577828b79b4005320f16f74b 100644 (file)
@@ -1,3 +1,8 @@
+2007-02-23  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+       * config/bfin/bfin.md (doloop_end): Fail for loops that can iterate
+       2^32-1 or more times unless flag_unsafe_loop_optimizations.
+
 2007-02-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * builtins.c (fold_builtin_logb, fold_builtin_significand): New.
index 8c088f93cafab7bce92c273caf210631fea20adf..63a651a5035b26e4ee96c8f69a06d93180511aef 100644 (file)
              (unspec [(const_int 0)] UNSPEC_LSETUP_END)
              (clobber (match_scratch:SI 5 ""))])]
   ""
-  {bfin_hardware_loop ();})
+{
+  /* Due to limitations in the hardware (an initial loop count of 0
+     does not loop 2^32 times) we must avoid to generate a hardware
+     loops when we cannot rule out this case.  */
+
+  if (!flag_unsafe_loop_optimizations
+      && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) >= 0xFFFFFFFF)
+    FAIL;
+  bfin_hardware_loop ();
+})
 
 (define_insn "loop_end"
   [(set (pc)