summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/20020729-1.c
blob: d4ef9bfcd2e49f2ad7da3cdff4a6648a7b3954b4 (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
/* { dg-do compile } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O2 -march=k6" } */

static inline void *
baz (void *s, unsigned long c, unsigned int count)
{
  int d0, d1;
  __asm__ __volatile__ (""
			: "=&c" (d0), "=&D" (d1)
			:"a" (c), "q" (count), "0" (count / 4), "1" ((long) s)
			:"memory");
  return s;
}

struct A
{
  unsigned long *a;
};

inline static void *
bar (struct A *x, int y)
{
  char *ptr;

  ptr = (void *) x->a[y >> 12];
  ptr += y % (1UL << 12);
  return (void *) ptr;
}

int
foo (struct A *x, unsigned int *y, int z, int u)
{
  int a, b, c, d, e;

  z += *y;
  c = z + u;
  a = (z >> 12) + 1;
  do
    {
      b = (a << 12);
      d = b - z;
      e = c - z;
      if (e < d)
	d = e;
      baz (bar (x, z), 0, d);
      z = b;
      a++;
    }
  while (z < c);
  return 0;
}