Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp98.c
blob78d3bbaf4999a02279b4983b3e24d6a3bf692314
1 /* { dg-do compile } */
2 /* { dg-require-effective-target int128 } */
3 /* { dg-options "-Os -fdisable-tree-evrp -fdump-tree-vrp1-details" } */
5 #include <stdint.h>
6 #include <limits.h>
8 typedef unsigned int word __attribute__((mode(word)));
9 typedef unsigned __int128 bigger_than_word;
11 int
12 foo (bigger_than_word a, word b, uint8_t c)
14 /* Must fold use of t1 into use of b, as b is no wider than word_mode. */
15 const uint8_t t1 = b % UCHAR_MAX;
17 /* Must NOT fold use of t2 into use of a, as a is wider than word_mode. */
18 const uint8_t t2 = a % UCHAR_MAX;
20 /* Must fold use of t3 into use of c, as c is narrower than t3. */
21 const uint32_t t3 = (const uint32_t)(c >> 1);
23 uint16_t ret = 0;
25 if (t1 == 1)
26 ret = 20;
27 else if (t2 == 2)
28 ret = 30;
29 else if (t3 == 3)
30 ret = 40;
31 /* Th extra condition below is necessary to prevent a prior pass from
32 folding away the cast. Ignored in scan-tree-dump. */
33 else if (t3 == 4)
34 ret = 50;
36 return ret;
39 /* { dg-final { scan-tree-dump "Folded into: if \\(_\[0-9\]+ == 1\\)" "vrp1" } } */
40 /* { dg-final { scan-tree-dump-not "Folded into: if \\(_\[0-9\]+ == 2\\)" "vrp1" } } */
41 /* { dg-final { scan-tree-dump "Folded into: if \\(_\[0-9\]+ == 3\\)" "vrp1" } } */