1/* { dg-do compile } */
2/* { dg-options "-O3 -fdump-rtl-loop2_unroll -funroll-loops" } */
3/* { dg-require-effective-target int32plus } */
4
5void abort (void);
6int *a;
7/* Fails on MIPS16 because equality checks are implemented using XOR.
8   It's unlikely MIPS16 users would want unrolling anyway.  */
9#ifdef __mips
10__attribute__((nomips16))
11#endif
12int t()
13{
14   int i;
15  for (i=0;i<1000000;i++)
16    if (a[i])
17      return 1;
18  return 0;
19}
20#ifdef __mips
21__attribute__((nomips16))
22#endif
23int t2()
24{
25   int i;
26  for (i=0;i<3000000;i++)
27    if (a[i])
28        abort ();
29  return 0;
30}
31/* { dg-final { scan-rtl-dump-times "upper bound: 999999" 1 "loop2_unroll" } } */
32/* { dg-final { scan-rtl-dump-not "realistic bound: 999999" "loop2_unroll" } } */
33/* { dg-final { scan-rtl-dump-times "upper bound: 2999999" 1 "loop2_unroll" } } */
34/* { dg-final { scan-rtl-dump-times "realistic bound: 2999999" 1 "loop2_unroll" } } */
35/* { dg-final { cleanup-rtl-dump "loop2_unroll" } } */
36