[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / loop-unroll.c
blob18d5b46908aa2ca29b355fc6e65f28208d562235
1 // RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 -O1 -funroll-loops -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-ENABLE-UNROLL
2 // RUN: %clang_cc1 -triple x86_64 -target-cpu x86-64 -O1 -fno-unroll-loops -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-DISABLE-UNROLL
3 // REQUIRES: x86-registered-target
5 // CHECK-ENABLE-UNROLL-LABEL: @for_test()
6 // CHECK-ENABLE-UNROLL: br label %[[FORBODY:[a-z0-9_\.]+]]
7 // CHECK-ENABLE-UNROLL: [[FORBODY]]:
8 // CHECK-ENABLE-UNROLL: store
9 // CHECK-ENABLE-UNROLL: store
10 // CHECK-ENABLE-UNROLL: br i1 %[[EXITCOND:[a-z0-9_\.]+]], label %[[FORBODY5:[a-z0-9_\.]+]], label %[[FORBODY]]
11 // CHECK-ENABLE-UNROLL: [[FORBODY5]]:
12 // CHECK-ENABLE-UNROLL: fmul
13 // CHECK-ENABLE-UNROLL: fadd
14 // CHECK-ENABLE-UNROLL: store
15 // CHECK-ENABLE-UNROLL: fmul
16 // CHECK-ENABLE-UNROLL: fadd
17 // CHECK-ENABLE-UNROLL: store
18 // CHECK-ENABLE-UNROLL: fmul
19 // CHECK-ENABLE-UNROLL: fadd
20 // CHECK-ENABLE-UNROLL: store
22 // CHECK-DISABLE-UNROLL-LABEL: @for_test()
23 // CHECK-DISABLE-UNROLL: br label %[[FORBODY:[a-z0-9_\.]+]]
24 // CHECK-DISABLE-UNROLL: [[FORBODY]]:
25 // CHECK-DISABLE-UNROLL: store
26 // CHECK-DISABLE-UNROLL-NOT: store
27 // CHECK-DISABLE-UNROLL: br i1 %[[EXITCOND:[a-z0-9_\.]+]], label %[[FORBODY5:[a-z0-9_\.]+]], label %[[FORBODY]]
28 // CHECK-DISABLE-UNROLL: [[FORBODY5]]:
29 // CHECK-DISABLE-UNROLL: fmul
30 // CHECK-DISABLE-UNROLL: fadd
31 // CHECK-DISABLE-UNROLL: store
32 // CHECK-DISABLE-UNROLL: fmul
33 // CHECK-DISABLE-UNROLL: fadd
34 // CHECK-DISABLE-UNROLL: store
35 // CHECK-DISABLE-UNROLL-NOT: fmul
36 // CHECK-DISABLE-UNROLL-NOT: fadd
37 // CHECK-DISABLE-UNROLL-NOT: store
38 // Limit scope of checking so this does not match "fadd" within git version string
39 // CHECK-DISABLE-UNROLL: !0 =
41 int printf(const char * restrict format, ...);
43 void for_test(void) {
44 double A[1000], B[1000];
45 int L = 500;
46 for (int i = 0; i < L; i++) {
47 A[i] = i;
49 for (int i = 0; i < L; i++) {
50 B[i] = A[i]*5;
51 B[i]++;
52 A[i] *= 7;
53 A[i]++;
55 printf("%lf %lf\n", A[0], B[0]);