• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -basic-aa -polly-codegen \
2; RUN: -polly-vectorizer=polly -dce -S < %s | FileCheck %s
3
4; RUN: opt %loadPolly -basic-aa -polly-codegen -polly-vectorizer=stripmine -dce -S < %s | FileCheck %s --check-prefix=STRIPMINE
5
6;#define N 1024
7;float A[N];
8;float B[N];
9;
10;void simple_vec_const(void) {
11;  int i;
12;
13;  for (i = 0; i < 4; i++)
14;    B[i] = A[i] + 1;
15;}
16;int main()
17;{
18;  simple_vec_const();
19;  return A[42];
20;}
21
22target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
23
24@A = common global [1024 x float] zeroinitializer, align 16
25@B = common global [1024 x float] zeroinitializer, align 16
26
27define void @simple_vec_const() nounwind {
28bb:
29  br label %bb2
30
31bb2:                                              ; preds = %bb5, %bb
32  %indvar = phi i64 [ %indvar.next, %bb5 ], [ 0, %bb ]
33  %scevgep = getelementptr [1024 x float], [1024 x float]* @B, i64 0, i64 %indvar
34  %scevgep1 = getelementptr [1024 x float], [1024 x float]* @A, i64 0, i64 %indvar
35  %exitcond = icmp ne i64 %indvar, 4
36  br i1 %exitcond, label %bb3, label %bb6
37
38bb3:                                              ; preds = %bb2
39  %tmp = load float, float* %scevgep1, align 4
40  %tmp4 = fadd float %tmp, 1.000000e+00
41  store float %tmp4, float* %scevgep, align 4
42  br label %bb5
43
44bb5:                                              ; preds = %bb3
45  %indvar.next = add i64 %indvar, 1
46  br label %bb2
47
48bb6:                                              ; preds = %bb2
49  ret void
50}
51
52define i32 @main() nounwind {
53bb:
54  call void @simple_vec_const()
55  %tmp = load float, float* getelementptr inbounds ([1024 x float], [1024 x float]* @A, i64 0, i64 42), align 8
56  %tmp1 = fptosi float %tmp to i32
57  ret i32 %tmp1
58}
59
60; STRIPMINE-NOT: <4 x float>
61
62; CHECK: %tmp_p_vec_full = load <4 x float>, <4 x float>* bitcast ([1024 x float]* @A to <4 x float>*), align 8, !alias.scope !0, !noalias !2
63; CHECK: %tmp4p_vec = fadd <4 x float> %tmp_p_vec_full, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
64; CHECK: store <4 x float> %tmp4p_vec, <4 x float>* bitcast ([1024 x float]* @B to <4 x float>*)
65