brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 18fcf75 Raw
38 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 loop vectorize codegen option is passed down to the6// ThinLTO backend. -vectorize-loops is a cc1 option and will be added7// automatically when O2/O3/Os is available for clang. Also check that8// "-mllvm -vectorize-loops=false" will disable loop vectorization, overriding9// the cc1 option.10//11// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -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-LPV12// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -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-NOLPV13// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -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-LPV14// O2-LPV: = !{!"llvm.loop.isvectorized", i32 1}15// O2-NOLPV-NOT: = !{!"llvm.loop.isvectorized", i32 1}16// O0-LPV-NOT: = !{!"llvm.loop.isvectorized", i32 1}17 18// Test to ensure the loop interleave codegen option is passed down to the19// ThinLTO backend. The internal loop interleave codegen option will be20// enabled automatically when O2/O3 is available for clang. Also check that21// "-mllvm -interleave-loops=false" will disable the interleaving, overriding22// the cc1 option.23//24// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -vectorize-loops -mllvm -force-vector-width=2 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=O2-InterLeave25// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O2 -vectorize-loops -mllvm -interleave-loops=false -mllvm -force-vector-width=2 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=O2-NoInterLeave26// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O0 -vectorize-loops -mllvm -force-vector-width=2 -emit-llvm -o - -x ir %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s --check-prefix=O0-InterLeave27// O2-InterLeave-COUNT-2: store <2 x double>28// O2-InterLeave: = !{!"llvm.loop.isvectorized", i32 1}29// O2-NoInterLeave-COUNT-1: store <2 x double>30// O2-NoInterLeave-NOT: store <2 x double>31// O2-NoInterLeave: = !{!"llvm.loop.isvectorized", i32 1}32// O0-InterLeave-NOT: = !{!"llvm.loop.isvectorized", i32 1}33 34void foo(double *a) {35  for (int i = 0; i < 1000; i++)36    a[i] = 10;37}38