1*67e74705SXin Li // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -Rpass-analysis=loop-vectorize -emit-llvm -S %s -o - 2>&1 | FileCheck %s
2*67e74705SXin Li
3*67e74705SXin Li // CHECK: {{.*}}:9:11: remark: loop not vectorized: cannot prove it is safe to reorder floating-point operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop or by providing the compiler option '-ffast-math'.
4*67e74705SXin Li
foo(int N)5*67e74705SXin Li double foo(int N) {
6*67e74705SXin Li double v = 0.0;
7*67e74705SXin Li
8*67e74705SXin Li for (int i = 0; i < N; i++)
9*67e74705SXin Li v = v + 1.0;
10*67e74705SXin Li
11*67e74705SXin Li return v;
12*67e74705SXin Li }
13*67e74705SXin Li
14*67e74705SXin Li // CHECK: {{.*}}:17:3: remark: loop not vectorized: cannot prove it is safe to reorder memory operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop. If the arrays will always be independent specify '#pragma clang loop vectorize(assume_safety)' before the loop or provide the '__restrict__' qualifier with the independent array arguments. Erroneous results will occur if these options are incorrectly applied!
15*67e74705SXin Li
foo2(int * dw,int * uw,int * A,int * B,int * C,int * D,int N)16*67e74705SXin Li void foo2(int *dw, int *uw, int *A, int *B, int *C, int *D, int N) {
17*67e74705SXin Li for (int i = 0; i < N; i++) {
18*67e74705SXin Li dw[i] = A[i] + B[i - 1] + C[i - 2] + D[i - 3];
19*67e74705SXin Li uw[i] = A[i] + B[i + 1] + C[i + 2] + D[i + 3];
20*67e74705SXin Li }
21*67e74705SXin Li }
22