1  /* Test builtin-memcpy (which may emit different code for different N).  */
       2  #include <string.h>
       3  
       4  #define TESTSIZE 80
       5  
       6  char src[TESTSIZE] __attribute__ ((aligned));
       7  char dst[TESTSIZE] __attribute__ ((aligned));
       8  
       9  void
      10  check (char *test, char *match, int n)
      11  {
      12    if (memcmp (test, match, n))
      13      abort ();
      14  }
      15  
      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)
      23  
      24  main ()
      25  {
      26    int i,j;
      27  
      28    for (i = 0; i < sizeof (src); ++i)
      29        src[i] = 'a' + i % 26;
      30  
      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);
      51  
      52    return 0;
      53  }