PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / memcpy-bi.c
blob40b1030802e65c0797558f07f9d8344e978912f4
1 /* Test builtin-memcpy (which may emit different code for different N). */
2 #include <string.h>
4 #define TESTSIZE 80
6 char src[TESTSIZE] __attribute__ ((aligned));
7 char dst[TESTSIZE] __attribute__ ((aligned));
9 void
10 check (char *test, char *match, int n)
12 if (memcmp (test, match, n))
13 abort ();
16 #define TN(n) \
17 { memset (dst, 0, n); memcpy (dst, src, n); check (dst, src, n); }
18 #define T(n) \
19 TN (n) \
20 TN ((n) + 1) \
21 TN ((n) + 2) \
22 TN ((n) + 3)
24 main ()
26 int i,j;
28 for (i = 0; i < sizeof (src); ++i)
29 src[i] = 'a' + i % 26;
31 T (0);
32 T (4);
33 T (8);
34 T (12);
35 T (16);
36 T (20);
37 T (24);
38 T (28);
39 T (32);
40 T (36);
41 T (40);
42 T (44);
43 T (48);
44 T (52);
45 T (56);
46 T (60);
47 T (64);
48 T (68);
49 T (72);
50 T (76);
52 return 0;