1 // REQUIRES: x86-registered-target 2 // RUN: %clang_cc1 -o %t.o -O2 -flto=thin -fexperimental-new-pass-manager -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 loop vectorize codegen option is passed down to the 6 // ThinLTO backend. -vectorize-loops is a cc1 option and will be added 7 // automatically when O2/O3/Os is available for clang. Also check that 8 // "-mllvm -vectorize-loops=false" will disable loop vectorization, overriding 9 // the cc1 option. 10 // 11 // Check both the new and old PMs. 12 // 13 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -vectorize-loops -mllvm -force-vector-width=2 -mllvm -force-vector-interleave=1 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-LPV 14 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -vectorize-loops -mllvm -force-vector-width=2 -mllvm -force-vector-interleave=1 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=O2-LPV 15 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -vectorize-loops -mllvm -vectorize-loops=false -mllvm -force-vector-width=2 -mllvm -force-vector-interleave=1 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-NOLPV 16 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -vectorize-loops -mllvm -vectorize-loops=false -mllvm -force-vector-width=2 -mllvm -force-vector-interleave=1 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=O2-NOLPV 17 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -vectorize-loops -mllvm -force-vector-width=2 -mllvm -force-vector-interleave=1 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-LPV 18 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -vectorize-loops -mllvm -force-vector-width=2 -mllvm -force-vector-interleave=1 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=O0-LPV 19 // O2-LPV: = !{!"llvm.loop.isvectorized", i32 1} 20 // O2-NOLPV-NOT: = !{!"llvm.loop.isvectorized", i32 1} 21 // O0-LPV-NOT: = !{!"llvm.loop.isvectorized", i32 1} 22 23 // Test to ensure the loop interleave codegen option is passed down to the 24 // ThinLTO backend. The internal loop interleave codegen option will be 25 // enabled automatically when O2/O3 is available for clang. Also check that 26 // "-mllvm -interleave-loops=false" will disable the interleaving, overriding 27 // the cc1 option. 28 // 29 // Check both the new and old PMs. 30 // 31 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -vectorize-loops -mllvm -force-vector-width=2 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-InterLeave 32 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -vectorize-loops -mllvm -interleave-loops=false -mllvm -force-vector-width=2 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-NoInterLeave 33 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -vectorize-loops -mllvm -force-vector-width=2 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-InterLeave 34 // O2-InterLeave-COUNT-2: store <2 x double> 35 // O2-InterLeave: = !{!"llvm.loop.isvectorized", i32 1} 36 // O2-NoInterLeave-COUNT-1: store <2 x double> 37 // O2-NoInterLeave-NOT: store <2 x double> 38 // O2-NoInterLeave: = !{!"llvm.loop.isvectorized", i32 1} 39 // O0-InterLeave-NOT: = !{!"llvm.loop.isvectorized", i32 1} 40 41 void foo(double *a) { 42 for (int i = 0; i < 1000; i++) 43 a[i] = 10; 44 } 45