2 /* { dg-do compile } */
3 /* { dg-options "-O2 -ftree-loop-if-convert -fdump-tree-widening_mul" } */
5 extern void abort (void);
8 unsigned int a
[16], b
[16], c
[16], d
;
11 __attribute__((noinline
, noclone
)) void
14 for (int i
= 0; i
< 16; i
++)
16 unsigned int r
= x
- a
[i
];
22 #define T(n, type, op, cond) \
23 __attribute__((noinline, noclone)) \
25 f##n (type x, type y) \
32 T (1, unsigned int, x
- y
, if (r
> x
) foo (0))
33 T (2, unsigned long, x
- y
, if (r
<= x
) foo (0))
34 T (3, unsigned short, x
- y
, if (x
< r
) foo (r
))
35 T (4, unsigned long long, x
- y
, if (x
>= r
) foo (0))
36 T (5, unsigned int, x
- y
, if (d
|| r
> x
) foo (0))
37 T (6, unsigned long, x
- y
, if (d
|| r
<= x
) foo (0))
38 T (7, unsigned char, x
- y
, if (d
|| x
< r
) foo (0))
39 T (8, unsigned long long, x
- y
, if (d
|| x
>= r
) foo (0))
40 T (9, unsigned int, x
+ y
, if (r
>= x
) foo (0))
41 T (10, unsigned long, x
+ y
, if (r
< x
) foo (0))
42 T (11, unsigned short, x
+ y
, if (x
<= r
) foo (r
))
43 T (12, unsigned long long, x
+ y
, if (d
|| x
> r
) foo (0))
44 T (13, unsigned int, x
+ y
, if (d
|| r
>= x
) foo (0))
45 T (14, unsigned long, x
+ y
, if (d
|| r
< x
) foo (0))
46 T (15, unsigned short, x
+ y
, if (d
|| x
<= r
) foo (0))
47 T (16, unsigned long long, x
+ y
, if (d
|| x
> r
) foo (0))
48 T (17, unsigned int, x
+ y
, if (r
>= y
) foo (0))
49 T (18, unsigned long, x
+ y
, if (r
< y
) foo (0))
50 T (19, unsigned short, x
+ y
, if (y
<= r
) foo (r
))
51 T (20, unsigned long long, x
+ y
, if (d
|| y
> r
) foo (0))
52 T (21, unsigned int, x
+ y
, if (d
|| r
>= y
) foo (0))
53 T (22, unsigned long, x
+ y
, if (d
|| r
< y
) foo (0))
54 T (23, unsigned short, x
+ y
, if (d
|| y
<= r
) foo (0))
55 T (24, unsigned long long, x
+ y
, if (d
|| y
> r
) foo (0))
56 T (25, unsigned short, 2U - x
, if (r
> 2U) foo (0))
57 T (26, unsigned char, 2U - x
, if (r
<= 2U) foo (0))
59 /* { dg-final { scan-tree-dump-times "ADD_OVERFLOW" 16 "widening_mul" { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } } */
60 /* { dg-final { scan-tree-dump-times "SUB_OVERFLOW" 11 "widening_mul" { target { { i?86-*-* x86_64-*-* } && { ! ia32 } } } } } */
61 /* { dg-final { scan-tree-dump-times "ADD_OVERFLOW" 12 "widening_mul" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */
62 /* { dg-final { scan-tree-dump-times "SUB_OVERFLOW" 9 "widening_mul" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */