summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr47564.c
blob: 5d3f25d1089f6917eb3a6129ff6833623a0e2b4a (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 target/47564 */
/* { dg-do compile } */
/* { dg-options "-O2 -msse2" } */

static inline unsigned long long
foo (const unsigned char *p)
{
  return 1;
}

__attribute__ ((__target__ ("sse4"))) void
bar (unsigned long long *x, const void *b, long long m)
{
  const unsigned char *p = (const unsigned char *) b;
  const unsigned char *e = p + m;
  unsigned int l = *x;
  unsigned long long n = l;

  if ((e - p) >= 8192)
    {
      while ((e - p) >= 128)
	{
	  n = __builtin_ia32_crc32di (n, foo (p));
	  n = __builtin_ia32_crc32di (n, foo (p));
	  n = __builtin_ia32_crc32di (n, foo (p));
	  n = __builtin_ia32_crc32di (n, foo (p));
	  n = __builtin_ia32_crc32di (n, foo (p));
	  n = __builtin_ia32_crc32di (n, foo (p));
	  n = __builtin_ia32_crc32di (n, foo (p));
	  n = __builtin_ia32_crc32di (n, foo (p));
	  n = __builtin_ia32_crc32di (n, foo (p));
	}
    }

  while ((e - p) >= 16)
    {
      n = __builtin_ia32_crc32di (n, foo (p));
      n = __builtin_ia32_crc32di (n, foo (p));
    }
  l = n;
  *x = l;
}