struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-usad-run.c
blobfae97e796b64fe06275951dcecac1e88000d2107
1 /*
2 usad-run.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 extern int abs (int __x);
9 static int
10 foo (unsigned char *w, int i, unsigned char *x, int j)
12 int tot = 0;
13 for (int a = 0; a < 16; a++)
15 for (int b = 0; b < 16; b++)
16 tot += abs (w[b] - x[b]);
17 w += i;
18 x += j;
20 return tot;
23 void
24 bar (unsigned char *w, unsigned char *x, int i, int *result)
26 *result = foo (w, 16, x, i);
29 void
30 testTortureExecute (void)
32 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pdk13) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) && !( (defined (__SDCC_mos6502) || defined(__SDCC_mos65c02 )) && defined(__SDCC_STACK_AUTO) ) // Lack of memory
33 unsigned char m[256];
34 unsigned char n[256];
35 int sum, i;
37 for (i = 0; i < 256; ++i)
38 if (i % 2 == 0)
40 m[i] = (i % 8) * 2 + 1;
41 n[i] = -(i % 8);
43 else
45 m[i] = -((i % 8) * 2 + 2);
46 n[i] = -((i % 8) >> 1);
49 bar (m, n, 16, &sum);
51 if (sum != 32384)
52 ASSERT (0);
54 return;
55 #endif