24 lines · c
1// REQUIRES: x86-registered-target2// RUN: %clang_cc1 -o %t.o -O2 -flto=thin -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s3// RUN: llvm-lto -thinlto -o %t %t.o4 5// Test to ensure the slp vectorize codegen option is passed down to the6// ThinLTO backend. -vectorize-slp is a cc1 option and will be added7// automatically when O2/O3/Os/Oz is available for clang. Also check that8// "-mllvm -vectorize-slp=false" will disable slp vectorization, overriding9// 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=SLP12// 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=NOSLP13// 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=NOSLP14// SLP: extractelement15// NOSLP-NOT: extractelement16 17int 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 24