2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-bopcond-2.c
blob7a47449f93c6d7e8c4d353f470258cb5047c55e9
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 - 32768 : 32770);
45 return x;
48 /* { dg-final { scan-tree-dump-times "MAX_EXPR " 4 "ifcvt" } } */