111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-O2 -fsplit-paths -fdump-tree-dom3-details" } */
|
|
3
|
|
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"} } */
|
|
8
|
|
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"} } */
|
|
12
|
|
13 /* The XOR operations should have been optimized to constants. */
|
|
14 /* { dg-final { scan-tree-dump-not "bit_xor" "dom3"} } */
|
|
15
|
|
16
|
|
17 extern int *stepsizeTable;
|
|
18
|
|
19 void
|
|
20 adpcm_coder (signed char *outdata, int len)
|
|
21 {
|
|
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--)
|
|
31 {
|
|
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;
|
|
41 }
|
|
42 }
|