3 /* { dg-options "-O2 -ftree-loop-if-convert" } */
5 extern void abort (void);
8 unsigned int a
[16], b
[16], c
[16];
10 __attribute__((noinline
, noclone
))
13 asm volatile ("" : : "g" (x
) : "memory");
17 __attribute__((noinline
, noclone
)) void
20 for (int i
= 0; i
< 16; i
++)
22 unsigned int r
= x
- a
[i
];
28 #define T(n, type, op, cond) \
29 __attribute__((noinline, noclone)) \
38 T (1, unsigned int, x
- 2U, if (r
> x
) foo (0))
39 T (2, unsigned long, x
- 2U, if (r
<= x
) foo (0))
40 T (3, unsigned short, 2U - x
, if (r
> 2U) foo (0))
41 T (4, unsigned char, 2U - x
, if (r
<= 2U) foo (0))
42 T (5, unsigned int, x
+ -2U, if (r
> x
) foo (0))
43 T (6, unsigned long, x
+ -2UL, if (r
<= x
) foo (0))
44 T (7, unsigned short, (unsigned short) -2 + x
, if (r
> (unsigned short) -2) foo (0))
45 T (8, unsigned char, (unsigned char) -2 + x
, if (r
<= (unsigned char) -2) foo (0))
51 for (i
= 0; i
< 16; i
++)
54 for (i
= 0; i
< 16; i
++)
55 if (b
[i
] != 12U - i
|| c
[i
] != 7 - 2 * (i
>= 7 && i
< 13))
57 if (f1 (3) != 1 || cnt
!= 0) abort ();
58 if (f1 (2) != 0 || cnt
!= 0) abort ();
59 if (f1 (1) != -1U || cnt
!= 1) abort ();
60 if (f2 (3) != 1 || cnt
!= 2) abort ();
61 if (f2 (2) != 0 || cnt
!= 3) abort ();
62 if (f2 (1) != -1UL || cnt
!= 3) abort ();
63 if (f3 (3) != (unsigned short) -1 || cnt
!= 4) abort ();
64 if (f3 (2) != 0 || cnt
!= 4) abort ();
65 if (f3 (1) != 1 || cnt
!= 4) abort ();
66 if (f4 (3) != (unsigned char) -1 || cnt
!= 4) abort ();
67 if (f4 (2) != 0 || cnt
!= 5) abort ();
68 if (f4 (1) != 1 || cnt
!= 6) abort ();
69 if (f5 (3) != 1 || cnt
!= 6) abort ();
70 if (f5 (2) != 0 || cnt
!= 6) abort ();
71 if (f5 (1) != -1U || cnt
!= 7) abort ();
72 if (f6 (3) != 1 || cnt
!= 8) abort ();
73 if (f6 (2) != 0 || cnt
!= 9) abort ();
74 if (f6 (1) != -1UL || cnt
!= 9) abort ();
75 if (f7 (3) != 1 || cnt
!= 9) abort ();
76 if (f7 (2) != 0 || cnt
!= 9) abort ();
77 if (f7 (1) != (unsigned short) -1 || cnt
!= 10) abort ();
78 if (f8 (3) != 1 || cnt
!= 11) abort ();
79 if (f8 (2) != 0 || cnt
!= 12) abort ();
80 if (f8 (1) != (unsigned char) -1 || cnt
!= 12) abort ();