]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C
generalized IPA predicate on parameter
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / tree-ssa / ivopts-3.C
CommitLineData
fca76508 1// { dg-do compile }
2// { dg-options "-O2 -fdump-tree-ivopts-details" }
3
4class MinimalVec3
5{
6protected:
7 double coords[3];
8
9public:
10
11 MinimalVec3( ) {
12 for ( int i = 0; i < 3; ++i )
13 coords[i] = 0.;
14 }
15
16 inline const double& operator[] ( int I ) const {
17 return coords[I];
18 }
19};
20
21class MinimalVector
22{
23protected:
24 double *_pData;
25 double stuff;
26
27public:
b3d74655 28 __attribute__((noinline)) explicit MinimalVector ( int length ) {
fca76508 29 _pData = new double[length];
30 for (int i = 0; i < length; ++i) _pData[i] = 0.;
31 }
32
33 inline double& operator[] ( int I ) {
34 return _pData[I];
35 }
36
37 inline const double& operator[] ( int I ) const {
38 return _pData[I];
39 }
40};
41
42
43int main ( int , char** ) {
44 int w = ( 1 << 7 )+1;
45 int wsqr = w*w;
46 int wcub = w*w*w;
47
48 MinimalVec3 * rows[9];
49 for ( int i = 0; i < 9; ++i ) {
50 rows[i] = new MinimalVec3[wcub];
51 }
52
53 MinimalVector img ( wcub ), res ( wcub );
54
55 for ( int c = 0; c < 1000; ++c ) {
56
57 for ( int i = 1; i < w-1; ++i )
58 for ( int j = 0; j < 3; ++j ) {
59
60 for ( int k = 1; k < w - 1; ++k )
61 for ( int l = 0; l < 3; ++l ) {
62
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];
66
67 }
68 }
69 }
70 return 0;
71}
72
446e879d 73// Verify that on x86_64 and i?86 we unroll the innsermost loop and
74// use three IVs for the then innermost loop
fca76508 75
446e879d 76// { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:63, 127 avg niters, 3 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }
77// { dg-final { scan-tree-dump-not "Selected IV set for loop \[0-9\]* at \[^ \]*:64" "ivopts" { target x86_64-*-* i?86-*-* } } }