summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr45720.c
blob: 9de8d1117f678d974ceffdfdea35270333b998d2 (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
/* { dg-do run } */
/* { dg-options "-ftree-vectorize" } */

float val[256];
float x;
void __attribute__((noinline,noclone))
foo(int len, int beg)
{
  int i;
  for (i = len - 1; i >= beg; --i)
    x += val[i] * 2;
}
void __attribute__((noinline,noclone))
bar(void)
{
  int i;
  for (i = 255; i >= 0; --i)
    x += val[i] * 2;
  for (i = 254; i >= 0; --i)
    x += val[i] * 2;
  for (i = 253; i >= 0; --i)
    x += val[i] * 2;
  for (i = 252; i >= 0; --i)
    x += val[i] * 2;
}
float y[256];
void __attribute__((noinline,noclone))
foobar(void)
{
  int i;
  for (i = 0; i < 252; ++i)
    {
      float l = 0;
      l += val[255 - i] * 2;
      l += val[254 - i] * 2;
      l += val[253 - i] * 2;
      l += val[252 - i] * 2;
      y[i] = l;
    }
}
int main()
{
  foo(256-1, 0);
  foo(256-2, 0);
  foo(256-3, 0);
  foo(256-4, 0);
  bar();
  foobar();
  return 0;
}