PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-bopcond-1.c
blob7324c166c8e702ad6c21daa60dab1f915364e5cb
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-tree-ifcvt" } */
4 int foo1 (unsigned short a[], unsigned int x)
6 unsigned int i;
7 for (i = 0; i < 1000; i++)
9 x = a[i];
10 a[i] = (unsigned short)(x <= 32768 ? x + 32768 : 0);
12 return x;
15 int foo2 (unsigned short a[], unsigned int x)
17 unsigned int i;
18 for (i = 0; i < 1000; i++)
20 x = a[i];
21 a[i] = (unsigned short)(x < 32768 ? x + 32768 : 0);
23 return x;
26 int foo3 (unsigned short a[], unsigned int x)
28 unsigned int i;
29 for (i = 0; i < 1000; i++)
31 x = a[i];
32 a[i] = (unsigned short)(x < 1000 ? x - 1000 : 0);
34 return x;
37 int foo4 (unsigned short a[], unsigned int x)
39 unsigned int i;
40 for (i = 0; i < 1000; i++)
42 x = a[i];
43 a[i] = (unsigned short)(x <= 2 ? x + 999 : 1001);
45 return x;
48 /* { dg-final { scan-tree-dump-times "MIN_EXPR " 4 "ifcvt" } } */