| 1 |
// REQUIRES: x86-registered-target |
| 2 |
// RUN: %clang_cc1 -o %t.o -O2 -flto=thin -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s |
| 3 |
// RUN: llvm-lto -thinlto -o %t %t.o |
| 4 |
|
| 5 |
// Test to ensure the slp vectorize codegen option is passed down to the |
| 6 |
// ThinLTO backend. -vectorize-slp is a cc1 option and will be added |
| 7 |
// automatically when O2/O3/Os/Oz is available for clang. Also check that |
| 8 |
// "-mllvm -vectorize-slp=false" will disable slp vectorization, overriding |
| 9 |
// the cc1 option. |
| 10 |
// |
| 11 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O2 -vectorize-slp -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=SLP |
| 12 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O2 -vectorize-slp -mllvm -vectorize-slp=false -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=NOSLP |
| 13 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -vectorize-slp -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=NOSLP |
| 14 |
// SLP: extractelement |
| 15 |
// NOSLP-NOT: extractelement |
| 16 |
|
| 17 |
int foo(double *A, int n, int m) { |
| 18 |
double sum = 0, v1 = 2, v0 = 3; |
| 19 |
for (int i=0; i < n; ++i) |
| 20 |
sum += 7*A[i*2] + 7*A[i*2+1]; |
| 21 |
return sum; |
| 22 |
} |
| 23 |
|