PR tree-optimization/85826 - ICE in gimple-ssa-warn-restruct on
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / shorten-1.c
blobcecdd44a619bc881264b2c3295d3d321fc3bb4ab
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
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[];
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)
14 int ret = (mode_fbit [indx] - mode_ibit [indx]) & 3;
15 return ret;
18 signed char
19 msufubar (int indx)
21 int ret = (mode_fbit [indx] - mode_ibit [indx]) & 3;
22 return ret;
25 unsigned char
26 musfubar (int indx)
28 int ret = (smode_fbit [indx] - smode_ibit [indx]) & 3;
29 return ret;
32 signed char
33 mssfubar (int indx)
35 int ret = (smode_fbit [indx] - smode_ibit [indx]) & 3;
36 return ret;
40 unsigned char
41 puufubar (int indx)
43 int ret = (mode_fbit [indx] + mode_ibit [indx]) & 3;
44 return ret;
47 signed char
48 psufubar (int indx)
50 int ret = (mode_fbit [indx] + mode_ibit [indx]) & 3;
51 return ret;
54 unsigned char
55 pusfubar (int indx)
57 int ret = (smode_fbit [indx] + smode_ibit [indx]) & 3;
58 return ret;
61 signed char
62 pssfubar (int indx)
64 int ret = (smode_fbit [indx] + smode_ibit [indx]) & 3;
65 return ret;
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"} } */
73 /* We should have casted 4 operands from signed to unsigned char types. */
74 /* { dg-final {scan-tree-dump-times "\\(unsigned char\\)" 8 "optimized" } } */
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" } } */