summaryrefslogtreecommitdiff
path: root/gcc/config/bfin/bfin.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/bfin/bfin.c')
-rw-r--r--gcc/config/bfin/bfin.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 18457f8f7b6..bd677f88bab 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -2438,7 +2438,7 @@ cbranch_predicted_taken_p (rtx insn)
if (x)
{
- int pred_val = INTVAL (XEXP (x, 0));
+ int pred_val = XINT (x, 0);
return pred_val >= REG_BR_PROB_BASE / 2;
}
@@ -3366,6 +3366,22 @@ find_prev_insn_start (rtx insn)
return insn;
}
+/* Implement TARGET_CAN_USE_DOLOOP_P. */
+
+static bool
+bfin_can_use_doloop_p (double_int, double_int iterations_max,
+ unsigned int, bool)
+{
+ /* 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
+ && (iterations_max.high != 0
+ || iterations_max.low >= 0xFFFFFFFF))
+ return false;
+ return true;
+}
+
/* Increment the counter for the number of loop instructions in the
current function. */
@@ -5810,4 +5826,7 @@ bfin_conditional_register_usage (void)
#undef TARGET_DELAY_VARTRACK
#define TARGET_DELAY_VARTRACK true
+#undef TARGET_CAN_USE_DOLOOP_P
+#define TARGET_CAN_USE_DOLOOP_P bfin_can_use_doloop_p
+
struct gcc_target targetm = TARGET_INITIALIZER;