summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr64316.c
blob: f478aa611785fe154d19f43c4f7624f1bb471ea8 (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 rtl-optimization/64316 */
/* { dg-do compile } */
/* { dg-options "-O3" } */
/* { dg-additional-options "-mavx2" { target { i?86-*-* x86_64-*-* } } } */

struct S
{
  unsigned int s;
  unsigned long w[];
};

struct S **s;

int
foo (struct S *x, struct S *y, struct S *z)
{
  unsigned int i;
  unsigned long *a, *b, *c;
  int r = 0;
  for (a = x->w, b = y->w, c = z->w, i = 0; i < x->s; i++, a++)
    {
      unsigned long d = *b++ & *c++;
      if (*a != d)
	{
	  r = 1;
	  *a = d;
	}
    }
  return r;
}

void
bar (int x)
{
  int p = x - 1;
  do
    {
      foo (s[x], s[x], s[p]);
      p--;
    }
  while (p > 0);
}