File: pr53366-1.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (71 lines) | stat: -rw-r--r-- 1,776 bytes parent folder | download | duplicates (10)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* PR tree-optimization/53366 */
/* { dg-do run { target { size32plus } } } */
/* { dg-require-effective-target size32plus } */

extern void abort (void);

struct S { double v[3]; };
struct T { struct S r, i; };
struct U { struct T j[5]; };

void
foo (struct U *__restrict p1, struct U *__restrict p2,
     struct S l1, struct S l2, struct S l3, struct S l4,
     const double _Complex * __restrict x, int y, int z)
{
  int i, j;
  while (y < z - 2)
    {
      for (j = 0; j < 5; ++j)
	{
	  double a = __real__ x[5 * y + j];
	  double b = __imag__ x[5 * y + j];
	  double c = __real__ x[5 * (y + 2) + j];
	  double d = __imag__ x[5 * (y + 2) + j];
	  double e = __real__ x[5 * (y + 1) + j];
	  double f = __imag__ x[5 * (y + 1) + j];
	  double g = __real__ x[5 * (y + 3) + j];
	  double h = __imag__ x[5 * (y + 3) + j];
	  for (i = 0; i < 3; ++i)
	    {
	      p1->j[j].r.v[i] += l2.v[i] * a;
	      p1->j[j].r.v[i] += l4.v[i] * c;
	      p1->j[j].i.v[i] += l2.v[i] * b;
	      p1->j[j].i.v[i] += l4.v[i] * d;
	      p2->j[j].r.v[i] += l3.v[i] * e;
	      p2->j[j].r.v[i] += l1.v[i] * g;
	      p2->j[j].i.v[i] += l3.v[i] * f;
	      p2->j[j].i.v[i] += l1.v[i] * h;
	    }
	}
      y += 4;
    }
}

_Complex double x[5005];
struct U p1, p2;

int
main ()
{
  int i, j;
  struct S l1, l2, l3, l4;
  for (i = 0; i < 5005; ++i)
    x[i] = i + 1.0iF * (2 * i);
  for (i = 0; i < 3; ++i)
    {
      l1.v[i] = 1;
      l2.v[i] = 2;
      l3.v[i] = 3;
      l4.v[i] = 4;
    }
  foo (&p1, &p2, l1, l2, l3, l4, x, 5, 1000);
  for (j = 0; j < 5; ++j)
    for (i = 0; i < 3; ++i)
      if (p1.j[j].r.v[i] != 3752430 + j * 1494.0
	  || p1.j[j].i.v[i] != p1.j[j].r.v[i] * 2
	  || p2.j[j].r.v[i] != 2502450 + j * 996.0
	  || p2.j[j].i.v[i] != p2.j[j].r.v[i] * 2)
	abort ();
  return 0;
}