1 /* Test builtin-memcpy (which may emit different code for different N). */
2
3 #define TESTSIZE 80
4
5 char src[TESTSIZE] __attribute__ ((aligned));
6 char dst[TESTSIZE] __attribute__ ((aligned));
7
8 void
check(char * test,char * match,int n)9 check (char *test, char *match, int n)
10 {
11 if (memcmp (test, match, n))
12 abort ();
13 }
14
15 #define TN(n) \
16 { memset (dst, 0, n); memcpy (dst, src, n); check (dst, src, n); }
17 #define T(n) \
18 TN (n) \
19 TN ((n) + 1) \
20 TN ((n) + 2) \
21 TN ((n) + 3)
22
main()23 main ()
24 {
25 int i,j;
26
27 for (i = 0; i < sizeof (src); ++i)
28 src[i] = 'a' + i % 26;
29
30 T (0);
31 T (4);
32 T (8);
33 T (12);
34 T (16);
35 T (20);
36 T (24);
37 T (28);
38 T (32);
39 T (36);
40 T (40);
41 T (44);
42 T (48);
43 T (52);
44 T (56);
45 T (60);
46 T (64);
47 T (68);
48 T (72);
49 T (76);
50
51 return 0;
52 }
53