1/* { dg-do compile } */
2/* { dg-options "-O3 -ffast-math -march=core-avx2" } */
3
4#define XX 0
5#define YY 1
6#define ZZ 2
7#define DIM 3
8typedef float matrix[DIM][DIM];
9typedef float rvec[DIM];
10extern int det (matrix);
11extern void foo(matrix);
12
13void bar1 (int n,int *index,rvec x[],matrix trans)
14{
15  float   xt,yt,zt;
16  int    i,ii;
17
18  for(i=0; (i<n); i++) {
19    ii=index ? index[i] : i;
20    xt=x[ii][XX];
21    yt=x[ii][YY];
22    zt=x[ii][ZZ];
23    x[ii][XX]=trans[XX][XX]*xt+trans[XX][YY]*yt+trans[XX][ZZ]*zt;
24    x[ii][YY]=trans[YY][XX]*xt+trans[YY][YY]*yt+trans[YY][ZZ]*zt;
25    x[ii][ZZ]=trans[ZZ][XX]*xt+trans[ZZ][YY]*yt+trans[ZZ][ZZ]*zt;
26  }
27}
28
29
30void bar2 (int n, rvec x[])
31{
32  int     m;
33  matrix  trans;
34
35  foo (trans);
36
37  if (det (trans) < 0) {
38    for(m=0; (m<DIM); m++)
39      trans[ZZ][m] = -trans[ZZ][m];
40  }
41  bar1 (n,(int*) 0,x,trans);
42}
43