1; RUN: opt %loadPolly -basic-aa -polly-codegen -polly-vectorizer=polly -dce -S < %s | FileCheck %s
2
3;#define N 1024
4;float A[N];
5;float B[N];
6;
7;void simple_vec_const(void) {
8;  int i;
9;
10;  for (i = 0; i < 4; i++)
11;    B[i] = A[i] + i;
12;}
13;int main()
14;{
15;  simple_vec_const();
16;  return A[42];
17;}
18
19target 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"
20
21@A = common global [1024 x float] zeroinitializer, align 16
22@B = common global [1024 x float] zeroinitializer, align 16
23
24define void @simple_vec_const() nounwind {
25bb:
26  br label %bb2
27
28bb2:                                              ; preds = %bb6, %bb
29  %indvar = phi i64 [ %indvar.next, %bb6 ], [ 0, %bb ]
30  %scevgep = getelementptr [1024 x float], [1024 x float]* @B, i64 0, i64 %indvar
31  %i.0 = trunc i64 %indvar to i32
32  %scevgep1 = getelementptr [1024 x float], [1024 x float]* @A, i64 0, i64 %indvar
33  %exitcond = icmp ne i64 %indvar, 4
34  br i1 %exitcond, label %bb3, label %bb7
35
36bb3:                                              ; preds = %bb2
37  %tmp = load float, float* %scevgep1, align 4
38  %tmp4 = sitofp i32 %i.0 to float
39  %tmp5 = fadd float %tmp, %tmp4
40  store float %tmp5, float* %scevgep, align 4
41  br label %bb6
42
43bb6:                                              ; preds = %bb3
44  %indvar.next = add i64 %indvar, 1
45  br label %bb2
46
47bb7:                                              ; preds = %bb2
48  ret void
49}
50
51define i32 @main() nounwind {
52bb:
53  call void @simple_vec_const()
54  %tmp = load float, float* getelementptr inbounds ([1024 x float], [1024 x float]* @A, i64 0, i64 42), align 8
55  %tmp1 = fptosi float %tmp to i32
56  ret i32 %tmp1
57}
58
59
60; CHECK: insertelement <4 x float> undef, float %{{[^,]+}}, i32 0
61; CHECK: insertelement <4 x float> %0, float %{{[^,]+}}, i32 1
62; CHECK: insertelement <4 x float> %1, float %{{[^,]+}}, i32 2
63; CHECK: insertelement <4 x float> %2, float %{{[^,]+}}, i32 3
64; CHECK: fadd <4 x float> %tmp_p_vec_full, %3
65
66