summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/20181024-1.c
blob: f2cfe7f6d67b2286e07f36ee3fc258dee8b42dfa (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
/* { dg-do compile } */
/* { dg-additional-options "-march=core-avx2" { target { x86_64-*-* i?86-*-* } } } */

typedef enum {
 C = 0,               N, S, E, W, T, B,               NE, NW, SE, SW,               NT, NB, ST, SB,               ET, EB, WT, WB,               FLAGS, N_CELL_ENTRIES} CELL_ENTRIES;
typedef double LBM_Grid[(130)*100*100*N_CELL_ENTRIES];
void foo( LBM_Grid srcGrid )
{
  double ux , uy , uz , rho ,         ux1, uy1, uz1, rho1,         ux2, uy2, uz2, rho2,         u2, px, py;
  int i;
  for( i = 0;
       i < (N_CELL_ENTRIES*( 100*100));
       i += N_CELL_ENTRIES )
    {
      rho1 = + ((srcGrid)[((C)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((N)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((S)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((E)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((W)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((T)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((B)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((NE)+N_CELL_ENTRIES*( 100*100))+(i)]) 
	  + ((srcGrid)[((NW)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((SE)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((SW)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((NT)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((NB)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((ST)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((SB)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((ET)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((EB)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((WT)+N_CELL_ENTRIES*( 100*100))+(i)])
	  + ((srcGrid)[((WB)+N_CELL_ENTRIES*( 100*100))+(i)]);
      rho = 2.0*rho1 - rho2;
      px = (((i / N_CELL_ENTRIES) % 100) / (0.5*(100-1))) - 1.0;
      uz = 0.01 * (1.0-px*px) * (1.0-py*py);
      u2 = 1.5 * (ux*ux + uy*uy + uz*uz);
      (((srcGrid)[((C))+(i)])) = (1.0/ 3.0)*rho*(1.0 - u2);
      (((srcGrid)[((N))+(i)])) = (1.0/18.0)*rho*(1.0 + uy*(4.5*uy + 3.0) - u2);
    }
}