Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/shorten-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 extern const unsigned char mode_ibit[];
5 extern const unsigned char mode_fbit[];
6 extern const signed char smode_ibit[];
7 extern const signed char smode_fbit[];
8
9 /* We use bit-and rather than modulo to ensure we're actually
10 testing the desired match.pd pattern. */
11 unsigned char
12 muufubar (int indx)
13 {
14 int ret = (mode_fbit [indx] - mode_ibit [indx]) & 3;
15 return ret;
16 }
17
18 signed char
19 msufubar (int indx)
20 {
21 int ret = (mode_fbit [indx] - mode_ibit [indx]) & 3;
22 return ret;
23 }
24
25 unsigned char
26 musfubar (int indx)
27 {
28 int ret = (smode_fbit [indx] - smode_ibit [indx]) & 3;
29 return ret;
30 }
31
32 signed char
33 mssfubar (int indx)
34 {
35 int ret = (smode_fbit [indx] - smode_ibit [indx]) & 3;
36 return ret;
37 }
38
39
40 unsigned char
41 puufubar (int indx)
42 {
43 int ret = (mode_fbit [indx] + mode_ibit [indx]) & 3;
44 return ret;
45 }
46
47 signed char
48 psufubar (int indx)
49 {
50 int ret = (mode_fbit [indx] + mode_ibit [indx]) & 3;
51 return ret;
52 }
53
54 unsigned char
55 pusfubar (int indx)
56 {
57 int ret = (smode_fbit [indx] + smode_ibit [indx]) & 3;
58 return ret;
59 }
60
61 signed char
62 pssfubar (int indx)
63 {
64 int ret = (smode_fbit [indx] + smode_ibit [indx]) & 3;
65 return ret;
66 }
67
68 /* The shortening patterns in match.pd should arrange to do the
69 arithmetic in char modes and thus any casts to ints should
70 have been removed. */
71 /* { dg-final {scan-tree-dump-not "\\(int\\)" "optimized"} } */
72
73 /* We should have casted 4 operands from signed to unsigned char types. */
74 /* { dg-final {scan-tree-dump-times "\\(unsigned char\\)" 8 "optimized" } } */
75
76 /* And two return values should have been casted from unsigned char to
77 a normal char. */
78 /* { dg-final {scan-tree-dump-times "\\(signed char\\)" 4 "optimized" } } */