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