summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/unsorted/bcopy.c
blob: aed994e578a0d0c453e514ff9cc2a47aef156e4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
void
bcopy1 (s, d, c)
     long long *s;
     long long *d;
     int c;
{
  int i;
  c = c / 8;
  for (i = 0;  i < c;  i++)
    d[i] = s[i];
}

void
bcopy2 (s, d, c)
     long *s;
     long *d;
     int c;
{
  int i;
  c = c / 4;
  for (i = 0;  i < c;  i++)
    d[i] = s[i];
}


void
bcopy3 (s, d, c)
     char *s;
     char *d;
     int c;
{
  long long z0, z1;
  int r = d - s;

  int i;

  c /= 16;

  z0 = *((long long *) s);
  s += 8;
  z1 = *((long long *) s);
  s += 8;
  for (i = 0; i < c; i++)
    {
      *(long long *)(s + r) = z0;
      z0 = *((long long *) s);
      s += 8;
      *(long long *)(s + r) = z1;
      z1 = *((long long *) s);
      s += 8;
    }
}

#if defined(STACK_SIZE) && STACK_SIZE < 16384
#define BYTES STACK_SIZE
#else
#define BYTES 16384
#endif

main ()
{
  long long s[BYTES / 8];
  long long d[BYTES / 8];
  int i;

  for (i = 1; i < 67108864 / BYTES; i++)
    bcopy (s, d, BYTES);
}