inner-full-unroll.ll
7.31 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
; RUN: opt -mtriple=thumbv7em -arm-parallel-dsp -dce -S %s -o - | FileCheck %s
; CHECK-LABEL: full_unroll
; CHECK: [[IV:%[^ ]+]] = phi i32
; CHECK: [[AI:%[^ ]+]] = getelementptr inbounds i32, i32* %a, i32 [[IV]]
; CHECK: [[BI:%[^ ]+]] = getelementptr inbounds i16*, i16** %b, i32 [[IV]]
; CHECK: [[BIJ:%[^ ]+]] = load i16*, i16** %arrayidx5, align 4
; CHECK: [[CI:%[^ ]+]] = getelementptr inbounds i16*, i16** %c, i32 [[IV]]
; CHECK: [[CIJ:%[^ ]+]] = load i16*, i16** [[CI]], align 4
; CHECK: [[BIJ_CAST:%[^ ]+]] = bitcast i16* [[BIJ]] to i32*
; CHECK: [[BIJ_LD:%[^ ]+]] = load i32, i32* [[BIJ_CAST]], align 2
; CHECK: [[CIJ_CAST:%[^ ]+]] = bitcast i16* [[CIJ]] to i32*
; CHECK: [[CIJ_LD:%[^ ]+]] = load i32, i32* [[CIJ_CAST]], align 2
; CHECK: [[SMLAD0:%[^ ]+]] = call i32 @llvm.arm.smlad(i32 [[CIJ_LD]], i32 [[BIJ_LD]], i32 0)
; CHECK: [[BIJ_2:%[^ ]+]] = getelementptr inbounds i16, i16* [[BIJ]], i32 2
; CHECK: [[BIJ_2_CAST:%[^ ]+]] = bitcast i16* [[BIJ_2]] to i32*
; CHECK: [[BIJ_2_LD:%[^ ]+]] = load i32, i32* [[BIJ_2_CAST]], align 2
; CHECK: [[CIJ_2:%[^ ]+]] = getelementptr inbounds i16, i16* [[CIJ]], i32 2
; CHECK: [[CIJ_2_CAST:%[^ ]+]] = bitcast i16* [[CIJ_2]] to i32*
; CHECK: [[CIJ_2_LD:%[^ ]+]] = load i32, i32* [[CIJ_2_CAST]], align 2
; CHECK: [[SMLAD1:%[^ ]+]] = call i32 @llvm.arm.smlad(i32 [[CIJ_2_LD]], i32 [[BIJ_2_LD]], i32 [[SMLAD0]])
; CHECK: store i32 [[SMLAD1]], i32* %arrayidx, align 4
define void @full_unroll(i32* noalias nocapture %a, i16** noalias nocapture readonly %b, i16** noalias nocapture readonly %c, i32 %N) {
entry:
%cmp29 = icmp eq i32 %N, 0
br i1 %cmp29, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %entry, %for.body
%i.030 = phi i32 [ %inc12, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %a, i32 %i.030
%arrayidx5 = getelementptr inbounds i16*, i16** %b, i32 %i.030
%0 = load i16*, i16** %arrayidx5, align 4
%arrayidx7 = getelementptr inbounds i16*, i16** %c, i32 %i.030
%1 = load i16*, i16** %arrayidx7, align 4
%2 = load i16, i16* %0, align 2
%conv = sext i16 %2 to i32
%3 = load i16, i16* %1, align 2
%conv9 = sext i16 %3 to i32
%mul = mul nsw i32 %conv9, %conv
%arrayidx6.1 = getelementptr inbounds i16, i16* %0, i32 1
%4 = load i16, i16* %arrayidx6.1, align 2
%conv.1 = sext i16 %4 to i32
%arrayidx8.1 = getelementptr inbounds i16, i16* %1, i32 1
%5 = load i16, i16* %arrayidx8.1, align 2
%conv9.1 = sext i16 %5 to i32
%mul.1 = mul nsw i32 %conv9.1, %conv.1
%add.1 = add nsw i32 %mul.1, %mul
%arrayidx6.2 = getelementptr inbounds i16, i16* %0, i32 2
%6 = load i16, i16* %arrayidx6.2, align 2
%conv.2 = sext i16 %6 to i32
%arrayidx8.2 = getelementptr inbounds i16, i16* %1, i32 2
%7 = load i16, i16* %arrayidx8.2, align 2
%conv9.2 = sext i16 %7 to i32
%mul.2 = mul nsw i32 %conv9.2, %conv.2
%add.2 = add nsw i32 %mul.2, %add.1
%arrayidx6.3 = getelementptr inbounds i16, i16* %0, i32 3
%8 = load i16, i16* %arrayidx6.3, align 2
%conv.3 = sext i16 %8 to i32
%arrayidx8.3 = getelementptr inbounds i16, i16* %1, i32 3
%9 = load i16, i16* %arrayidx8.3, align 2
%conv9.3 = sext i16 %9 to i32
%mul.3 = mul nsw i32 %conv9.3, %conv.3
%add.3 = add nsw i32 %mul.3, %add.2
store i32 %add.3, i32* %arrayidx, align 4
%inc12 = add nuw i32 %i.030, 1
%exitcond = icmp eq i32 %inc12, %N
br i1 %exitcond, label %for.cond.cleanup, label %for.body
}
; CHECK-LABEL: full_unroll_sub
; CHEC: [[IV:%[^ ]+]] = phi i32
; CHECK: [[AI:%[^ ]+]] = getelementptr inbounds i32, i32* %a, i32 [[IV]]
; CHECK: [[BI:%[^ ]+]] = getelementptr inbounds i16*, i16** %b, i32 [[IV]]
; CHECK: [[BIJ:%[^ ]+]] = load i16*, i16** [[BI]], align 4
; CHECK: [[CI:%[^ ]+]] = getelementptr inbounds i16*, i16** %c, i32 [[IV]]
; CHECK: [[CIJ:%[^ ]+]] = load i16*, i16** [[CI]], align 4
; CHECK: [[BIJ_LD:%[^ ]+]] = load i16, i16* [[BIJ]], align 2
; CHECK: [[BIJ_LD_SXT:%[^ ]+]] = sext i16 [[BIJ_LD]] to i32
; CHECK: [[CIJ_LD:%[^ ]+]] = load i16, i16* [[CIJ]], align 2
; CHECK: [[CIJ_LD_SXT:%[^ ]+]] = sext i16 [[CIJ_LD]] to i32
; CHECK: [[SUB:%[^ ]+]] = sub nsw i32 [[CIJ_LD_SXT]], [[BIJ_LD_SXT]]
; CHECK: [[BIJ_1:%[^ ]+]] = getelementptr inbounds i16, i16* [[BIJ]], i32 1
; CHECK: [[BIJ_1_LD:%[^ ]+]] = load i16, i16* [[BIJ_1]], align 2
; CHECK: [[BIJ_1_LD_SXT:%[^ ]+]] = sext i16 [[BIJ_1_LD]] to i32
; CHECK: [[CIJ_1:%[^ ]+]] = getelementptr inbounds i16, i16* [[CIJ]], i32 1
; CHECK: [[CIJ_1_LD:%[^ ]+]] = load i16, i16* [[CIJ_1]], align 2
; CHECK: [[CIJ_1_LD_SXT:%[^ ]+]] = sext i16 [[CIJ_1_LD]] to i32
; CHECK: [[MUL:%[^ ]+]] = mul nsw i32 [[CIJ_1_LD_SXT]], [[BIJ_1_LD_SXT]]
; CHECK: [[ACC:%[^ ]+]] = add nsw i32 [[MUL]], [[SUB]]
; CHECK: [[BIJ_2:%[^ ]+]] = getelementptr inbounds i16, i16* [[BIJ]], i32 2
; CHECK: [[BIJ_2_CAST:%[^ ]+]] = bitcast i16* [[BIJ_2]] to i32*
; CHECK: [[BIJ_2_LD:%[^ ]+]] = load i32, i32* [[BIJ_2_CAST]], align 2
; CHECK: [[CIJ_2:%[^ ]+]] = getelementptr inbounds i16, i16* [[CIJ]], i32 2
; CHECK: [[CIJ_2_CAST:%[^ ]+]] = bitcast i16* [[CIJ_2]] to i32*
; CHECK: [[CIJ_2_LD:%[^ ]+]] = load i32, i32* [[CIJ_2_CAST]], align 2
; CHECK: [[SMLAD0:%[^ ]+]] = call i32 @llvm.arm.smlad(i32 [[CIJ_2_LD]], i32 [[BIJ_2_LD]], i32 [[ACC]])
; CHECK: store i32 [[SMLAD0]], i32* %arrayidx, align 4
define void @full_unroll_sub(i32* noalias nocapture %a, i16** noalias nocapture readonly %b, i16** noalias nocapture readonly %c, i32 %N) {
entry:
%cmp29 = icmp eq i32 %N, 0
br i1 %cmp29, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret void
for.body: ; preds = %entry, %for.body
%i.030 = phi i32 [ %inc12, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, i32* %a, i32 %i.030
%arrayidx5 = getelementptr inbounds i16*, i16** %b, i32 %i.030
%0 = load i16*, i16** %arrayidx5, align 4
%arrayidx7 = getelementptr inbounds i16*, i16** %c, i32 %i.030
%1 = load i16*, i16** %arrayidx7, align 4
%2 = load i16, i16* %0, align 2
%conv = sext i16 %2 to i32
%3 = load i16, i16* %1, align 2
%conv9 = sext i16 %3 to i32
%sub = sub nsw i32 %conv9, %conv
%arrayidx6.1 = getelementptr inbounds i16, i16* %0, i32 1
%4 = load i16, i16* %arrayidx6.1, align 2
%conv.1 = sext i16 %4 to i32
%arrayidx8.1 = getelementptr inbounds i16, i16* %1, i32 1
%5 = load i16, i16* %arrayidx8.1, align 2
%conv9.1 = sext i16 %5 to i32
%mul.1 = mul nsw i32 %conv9.1, %conv.1
%add.1 = add nsw i32 %mul.1, %sub
%arrayidx6.2 = getelementptr inbounds i16, i16* %0, i32 2
%6 = load i16, i16* %arrayidx6.2, align 2
%conv.2 = sext i16 %6 to i32
%arrayidx8.2 = getelementptr inbounds i16, i16* %1, i32 2
%7 = load i16, i16* %arrayidx8.2, align 2
%conv9.2 = sext i16 %7 to i32
%mul.2 = mul nsw i32 %conv9.2, %conv.2
%add.2 = add nsw i32 %mul.2, %add.1
%arrayidx6.3 = getelementptr inbounds i16, i16* %0, i32 3
%8 = load i16, i16* %arrayidx6.3, align 2
%conv.3 = sext i16 %8 to i32
%arrayidx8.3 = getelementptr inbounds i16, i16* %1, i32 3
%9 = load i16, i16* %arrayidx8.3, align 2
%conv9.3 = sext i16 %9 to i32
%mul.3 = mul nsw i32 %conv9.3, %conv.3
%add.3 = add nsw i32 %mul.3, %add.2
store i32 %add.3, i32* %arrayidx, align 4
%inc12 = add nuw i32 %i.030, 1
%exitcond = icmp eq i32 %inc12, %N
br i1 %exitcond, label %for.cond.cleanup, label %for.body
}