annotate gcc/testsuite/gcc.dg/tree-ssa/vrp98.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-require-effective-target int128 } */
kono
parents:
diff changeset
3 /* { dg-options "-Os -fdump-tree-vrp1-details" } */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 #include <stdint.h>
kono
parents:
diff changeset
6 #include <limits.h>
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 typedef unsigned int word __attribute__((mode(word)));
kono
parents:
diff changeset
9 typedef unsigned __int128 bigger_than_word;
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 int
kono
parents:
diff changeset
12 foo (bigger_than_word a, word b, uint8_t c)
kono
parents:
diff changeset
13 {
kono
parents:
diff changeset
14 /* Must fold use of t1 into use of b, as b is no wider than word_mode. */
kono
parents:
diff changeset
15 const uint8_t t1 = b % UCHAR_MAX;
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 /* Must NOT fold use of t2 into use of a, as a is wider than word_mode. */
kono
parents:
diff changeset
18 const uint8_t t2 = a % UCHAR_MAX;
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 /* Must fold use of t3 into use of c, as c is narrower than t3. */
kono
parents:
diff changeset
21 const uint32_t t3 = (const uint32_t)(c >> 1);
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 uint16_t ret = 0;
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 if (t1 == 1)
kono
parents:
diff changeset
26 ret = 20;
kono
parents:
diff changeset
27 else if (t2 == 2)
kono
parents:
diff changeset
28 ret = 30;
kono
parents:
diff changeset
29 else if (t3 == 3)
kono
parents:
diff changeset
30 ret = 40;
kono
parents:
diff changeset
31 /* Th extra condition below is necessary to prevent a prior pass from
kono
parents:
diff changeset
32 folding away the cast. Ignored in scan-tree-dump. */
kono
parents:
diff changeset
33 else if (t3 == 4)
kono
parents:
diff changeset
34 ret = 50;
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 return ret;
kono
parents:
diff changeset
37 }
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 /* { dg-final { scan-tree-dump "Folded into: if \\(_\[0-9\]+ == 1\\)" "vrp1" } } */
kono
parents:
diff changeset
40 /* { dg-final { scan-tree-dump-not "Folded into: if \\(_\[0-9\]+ == 2\\)" "vrp1" } } */
kono
parents:
diff changeset
41 /* { dg-final { scan-tree-dump "Folded into: if \\(_\[0-9\]+ == 3\\)" "vrp1" } } */