]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/loop-versioning-6.c
1 /* { dg-options "-O3 -fdump-tree-lversion-details" } */
3 /* The read from y in f1 will be hoisted to the outer loop. In general
4 it's not worth versioning outer loops when the inner loops don't also
7 This test is meant to be a slight counterexample, since versioning
8 does lead to cheaper outer-loop vectorization. However, the benefit
9 isn't enough to justify the cost. */
12 f1 (double *restrict x
, double *restrict y
, int step
, int n
)
14 for (int i
= 0; i
< n
; ++i
)
15 for (int j
= 0; j
< n
; ++j
)
16 x
[i
+ j
] = y
[i
* step
];
19 /* A similar example in which the read can't be hoisted, but could
20 for example be handled by vectorizer alias checks. */
23 f2 (double *x
, double *y
, int step
, int n
)
25 for (int i
= 0; i
< n
; ++i
)
26 for (int j
= 0; j
< n
; ++j
)
27 x
[i
+ j
] = y
[i
* step
];
30 /* { dg-final { scan-tree-dump-not {want to version} "lversion" } } */
31 /* { dg-final { scan-tree-dump-not {versioned} "lversion" } } */