1 /* { dg-options "-O3 -fdump-tree-lversion-details" } */
3 /* Test that we can version a gather-like operation in which a variable
4 stride is applied to the index. */
7 f1 (int *x
, int *index
, int step
, int n
)
10 for (int i
= 0; i
< n
; ++i
)
11 res
+= x
[index
[i
] * step
];
16 f2 (int *x
, int *index
, int step
, int n
)
19 for (int i
= 0; i
< n
; ++i
)
21 int *ptr
= x
+ index
[i
] * step
;
30 g1 (int *index
, int step
, int n
)
33 for (int i
= 0; i
< n
; ++i
)
34 res
+= x
[index
[i
] * step
];
39 g2 (int *index
, int step
, int n
)
42 for (int i
= 0; i
< n
; ++i
)
44 int *ptr
= x
+ index
[i
] * step
;
50 /* { dg-final { scan-tree-dump-times {address term [^\n]* \* loop-invariant} 4 "lversion" } } */
51 /* { dg-final { scan-tree-dump-times {want to version containing loop} 4 "lversion" } } */
52 /* { dg-final { scan-tree-dump-times {versioned this loop} 4 "lversion" } } */