PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr69270.c
blob0d66cc4383f2d77ba9cf05ff52de8a1bea8d452a
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fsplit-paths -fdump-tree-dom3-details" } */
4 /* There should be two references to bufferstep that turn into
5 constants. */
6 /* { dg-final { scan-tree-dump-times "Replaced .bufferstep_\[0-9\]+. with constant .0." 1 "dom3"} } */
7 /* { dg-final { scan-tree-dump-times "Replaced .bufferstep_\[0-9\]+. with constant .1." 1 "dom3"} } */
9 /* And some assignments ought to fold down to constants. */
10 /* { dg-final { scan-tree-dump-times "Folded to: _\[0-9\]+ = 1;" 1 "dom3"} } */
11 /* { dg-final { scan-tree-dump-times "Folded to: _\[0-9\]+ = 0;" 1 "dom3"} } */
13 /* The XOR operations should have been optimized to constants. */
14 /* { dg-final { scan-tree-dump-not "bit_xor" "dom3"} } */
17 extern int *stepsizeTable;
19 void
20 adpcm_coder (signed char *outdata, int len)
22 signed char *outp;
23 int delta;
24 int outputbuffer;
25 int bufferstep = 0;
26 outp = (signed char *) outdata;
27 int step = 0;
28 int index = 0;
29 int diff = 0;
30 for (; len > 0; len--)
32 delta = 0;
33 if (diff >= step)
34 delta = 4;
35 step = stepsizeTable[index];
36 if (bufferstep)
37 outputbuffer = (delta << 4) & 0xf0;
38 else
39 *outp++ = (delta & 0x0f) | outputbuffer;
40 bufferstep = !bufferstep;