summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr65779.c
blob: 7d5c522d042e59582d920a7830e17f97d745ca3e (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
/* PR debug/65779 */
/* { dg-do assemble } */
/* { dg-options "-O2 -fcompare-debug" } */

unsigned long
foo (unsigned long x, unsigned char *y, unsigned int z)
{
  unsigned long a = x & 0xffff;
  unsigned long b = (x >> 16) & 0xffff;
  int k;
  if (y == 0) return 1L;
  while (z > 0)
    {
      k = z < 5552 ? z : 5552;
      z -= k;
      while (k >= 16)
	{
          a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  a += *y++; b += a;
	  k -= 16;
        }
      if (k != 0)
	do { a += *y++; b += a; } while (--k);
      a %= 65521L;
      b %= 65521L;
    }
  return (b << 16) | a;
}