More coverage for execute/memcpy-2.c

Joern Rennecke joern.rennecke@superh.com
Fri May 17 06:18:00 GMT 2002


The current MAX_COPY value of memcpy-2.c is just below the cut-off
length of the SHmedia memcpy to use a cacheline-at-a-time loop with
advance cache preallocation.  By Bumping up the multiplier for
MAX_COPY to 10, this case also becomes covered, in all variants of
alignment.
I've also added some code so that the pattern being copied is a repeating
sequence of 31 characters, so that copying the wrong bytes or words should
also be caught.

-- 
--------------------------
SuperH
2430 Aztec West / Almondsbury / BRISTOL / BS32 4AQ
T:+44 1454 462330
-------------- next part --------------
Fri May 17 12:50:38 2002  J"orn Rennecke <joern.rennecke@superh.com>

	* gcc.c-torture/execute/memcpy-2.c (SEQUENCE_LENGTH): Define.
	(MAX_COPY): Bump up to 10 times sizeof (long long).
	(main): Use a pattern of SEQUENCE_LENGTH different characters to copy.

*** memcpy-2.c-apr25	Thu Apr 25 11:23:32 2002
--- memcpy-2.c	Fri May 17 12:37:42 2002
***************
*** 12,18 ****
  #endif
  
  #ifndef MAX_COPY
! #define MAX_COPY (8 * sizeof (long long))
  #endif
  
  #ifndef MAX_EXTRA
--- 12,18 ----
  #endif
  
  #ifndef MAX_COPY
! #define MAX_COPY (10 * sizeof (long long))
  #endif
  
  #ifndef MAX_EXTRA
***************
*** 21,26 ****
--- 21,31 ----
  
  #define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA)
  
+ 
+ /* Use a sequence length that is not divisible by two, to make it more
+    likely to detect when words are mixed up.  */
+ #define SEQUENCE_LENGTH 31
+ 
  static union {
    char buf[MAX_LENGTH];
    long long align_int;
*************** static union {
*** 30,45 ****
  main ()
  {
    int off1, off2, len, i;
!   char *p, *q;
  
    for (off1 = 0; off1 < MAX_OFFSET; off1++)
      for (off2 = 0; off2 < MAX_OFFSET; off2++)
        for (len = 1; len < MAX_COPY; len++)
  	{
! 	  for (i = 0; i < MAX_LENGTH; i++)
  	    {
  	      u1.buf[i] = 'a';
! 	      u2.buf[i] = 'A';
  	    }
  
  	  p = memcpy (u1.buf + off1, u2.buf + off2, len);
--- 35,52 ----
  main ()
  {
    int off1, off2, len, i;
!   char *p, *q, c;
  
    for (off1 = 0; off1 < MAX_OFFSET; off1++)
      for (off2 = 0; off2 < MAX_OFFSET; off2++)
        for (len = 1; len < MAX_COPY; len++)
  	{
! 	  for (i = 0, c = 'A'; i < MAX_LENGTH; i++, c++)
  	    {
  	      u1.buf[i] = 'a';
! 	      if (c >= 'A' + SEQUENCE_LENGTH)
! 		c = 'A';
! 	      u2.buf[i] = c;
  	    }
  
  	  p = memcpy (u1.buf + off1, u2.buf + off2, len);
*************** main ()
*** 51,59 ****
  	    if (*q != 'a')
  	      abort ();
  
! 	  for (i = 0; i < len; i++, q++)
! 	    if (*q != 'A')
! 	      abort ();
  
  	  for (i = 0; i < MAX_EXTRA; i++, q++)
  	    if (*q != 'a')
--- 58,70 ----
  	    if (*q != 'a')
  	      abort ();
  
! 	  for (i = 0, c = 'A' + off2; i < len; i++, q++, c++)
! 	    {
! 	      if (c >= 'A' + SEQUENCE_LENGTH)
! 		c = 'A';
! 	      if (*q != c)
! 		abort ();
! 	    }
  
  	  for (i = 0; i < MAX_EXTRA; i++, q++)
  	    if (*q != 'a')


More information about the Gcc-patches mailing list