[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / ivopts-3.C
blob07ff1b770f87e01354b3c1e7f3f6bf106868eaa8
1 // { dg-do compile }
2 // { dg-options "-O2 -fdump-tree-ivopts-details" }
4 class MinimalVec3
6 protected:
7   double coords[3];
9 public:
11   MinimalVec3( ) {
12     for ( int i = 0; i < 3; ++i )
13       coords[i] = 0.;
14   }
16   inline const double& operator[] ( int I ) const {
17     return coords[I];
18   }
21 class MinimalVector
23 protected:
24   double *_pData;
25   double stuff;
27 public:
28   explicit MinimalVector ( int length ) {
29     _pData = new double[length];
30     for (int i = 0; i < length; ++i) _pData[i] = 0.;
31   }
33   inline double& operator[] ( int I ) {
34     return _pData[I];
35   }
37   inline const double& operator[] ( int I ) const {
38     return _pData[I];
39   }
43 int main ( int , char** ) {
44     int w = ( 1 << 7 )+1;
45     int wsqr = w*w;
46     int wcub = w*w*w;
48     MinimalVec3 * rows[9];
49     for ( int i = 0; i < 9; ++i ) {
50       rows[i] = new MinimalVec3[wcub];
51     }
53     MinimalVector img ( wcub ), res ( wcub );
55     for ( int c = 0; c < 1000; ++c ) {
57       for ( int i = 1; i < w-1; ++i )
58         for ( int j = 0; j < 3; ++j ) {
60           for ( int k = 1; k < w - 1; ++k )
61             for ( int l = 0; l < 3; ++l ) {
63               for ( int m = 1; m < w - 1; ++m )
64                 for ( int n = 0; n < 3; ++n )
65                   res[i*wsqr + k*w + m] += img[( i + j - 1 ) *wsqr + ( k + l - 1 ) *w + m + n - 1] * rows[j*3 + l][i*wsqr + k*w + m][n];
67             }
68         }
69     }
70     return 0;
73 // Verify that on x86_64 and i?86 we use a single IV for the innermost loop
75 // { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:64, 3 avg niters, 1 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }