1 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -Rpass-analysis -S %s -o - 2>&1 | FileCheck %s --check-prefix=RPASS
2 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -S %s -o - 2>&1 | FileCheck %s
3
4 // RPASS: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch statement
5 // CHECK-NOT: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch statement
6
foo(int N,int * Array)7 double foo(int N, int *Array) {
8 double v = 0.0;
9
10 #pragma clang loop vectorize(enable)
11 for (int i = 0; i < N; i++) {
12 switch(Array[i]) {
13 case 0: v += 1.0f; break;
14 case 1: v -= 0.5f; break;
15 case 2: v *= 2.0f; break;
16 default: v = 0.0f;
17 }
18 }
19
20 return v;
21 }
22