maddld.ll
5.88 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,CHECK-P9
; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,CHECK-P8
define signext i64 @maddld64(i64 signext %a, i64 signext %b) {
; CHECK-LABEL: maddld64:
; CHECK: # %bb.0: # %entry
; CHECK-P9-NEXT: maddld 3, 4, 3, 3
; CHECK-P8-NEXT: mulld 4, 4, 3
; CHECK-P8-NEXT: add 3, 4, 3
; CHECK-NEXT: blr
entry:
%mul = mul i64 %b, %a
%add = add i64 %mul, %a
ret i64 %add
}
define signext i32 @maddld32(i32 signext %a, i32 signext %b) {
; CHECK-LABEL: maddld32:
; CHECK: # %bb.0: # %entry
; CHECK-P9-NEXT: maddld 3, 4, 3, 3
; CHECK-P9-NEXT: extsw 3, 3
; CHECK-P8-NEXT: mullw 4, 4, 3
; CHECK-P8-NEXT: add 3, 4, 3
; CHECK-P8-NEXT: extsw 3, 3
; CHECK-NEXT: blr
entry:
%mul = mul i32 %b, %a
%add = add i32 %mul, %a
ret i32 %add
}
define signext i16 @maddld16(i16 signext %a, i16 signext %b, i16 signext %c) {
; CHECK-LABEL: maddld16:
; CHECK: # %bb.0: # %entry
; CHECK-P9-NEXT: maddld 3, 4, 3, 5
; CHECK-P9-NEXT: extsh 3, 3
; CHECK-P8-NEXT: mullw 3, 4, 3
; CHECK-P8-NEXT: add 3, 3, 5
; CHECK-P8-NEXT: extsh 3, 3
; CHECK-NEXT: blr
entry:
%mul = mul i16 %b, %a
%add = add i16 %mul, %c
ret i16 %add
}
define zeroext i32 @maddld32zeroext(i32 zeroext %a, i32 zeroext %b) {
; CHECK-LABEL: maddld32zeroext:
; CHECK: # %bb.0: # %entry
; CHECK-P9-NEXT: maddld 3, 4, 3, 3
; CHECK-P8-NEXT: mullw 4, 4, 3
; CHECK-P8-NEXT: add 3, 4, 3
; CHECK-NEXT: clrldi 3, 3, 32
; CHECK-NEXT: blr
entry:
%mul = mul i32 %b, %a
%add = add i32 %mul, %a
ret i32 %add
}
define signext i32 @maddld32nsw(i32 signext %a, i32 signext %b) {
; CHECK-LABEL: maddld32nsw:
; CHECK: # %bb.0: # %entry
; CHECK-P9-NEXT: maddld 3, 4, 3, 3
; CHECK-P8-NEXT: mullw 4, 4, 3
; CHECK-P8-NEXT: add 3, 4, 3
; CHECK-NEXT: extsw 3, 3
; CHECK-NEXT: blr
entry:
%mul = mul nsw i32 %b, %a
%add = add nsw i32 %mul, %a
ret i32 %add
}
define zeroext i32 @maddld32nuw(i32 zeroext %a, i32 zeroext %b) {
; CHECK-LABEL: maddld32nuw:
; CHECK: # %bb.0: # %entry
; CHECK-P9-NEXT: maddld 3, 4, 3, 3
; CHECK-P8-NEXT: mullw 4, 4, 3
; CHECK-P8-NEXT: add 3, 4, 3
; CHECK-NEXT: clrldi 3, 3, 32
; CHECK-NEXT: blr
entry:
%mul = mul nuw i32 %b, %a
%add = add nuw i32 %mul, %a
ret i32 %add
}
define signext i64 @maddld64_imm(i64 signext %a, i64 signext %b) {
; CHECK-LABEL: maddld64_imm:
; CHECK: # %bb.0: # %entry
; CHECK-NOT: maddld
; CHECK-NEXT: mulli 4, 4, 13
; CHECK-NEXT: add 3, 4, 3
; CHECK-NEXT: blr
entry:
%mul = mul i64 %b, 13
%add = add i64 %mul, %a
ret i64 %add
}
define signext i32 @maddld32_imm(i32 signext %a, i32 signext %b) {
; CHECK-LABEL: maddld32_imm:
; CHECK: # %bb.0: # %entry
; CHECK-NOT: maddld
; CHECK-NEXT: mullw 3, 4, 3
; CHECK-NEXT: addi 3, 3, 13
; CHECK-NEXT: extsw 3, 3
; CHECK-NEXT: blr
entry:
%mul = mul i32 %b, %a
%add = add i32 %mul, 13
ret i32 %add
}
define signext i16 @maddld16_imm(i16 signext %a, i16 signext %b, i16 signext %c) {
; CHECK-LABEL: maddld16_imm:
; CHECK: # %bb.0: # %entry
; CHECK-NOT: maddld
; CHECK-NEXT: mulli 3, 4, 13
; CHECK-NEXT: add 3, 3, 5
; CHECK-NEXT: extsh 3, 3
; CHECK-NEXT: blr
entry:
%mul = mul i16 %b, 13
%add = add i16 %mul, %c
ret i16 %add
}
define zeroext i32 @maddld32zeroext_imm(i32 zeroext %a, i32 zeroext %b) {
; CHECK-LABEL: maddld32zeroext_imm:
; CHECK: # %bb.0: # %entry
; CHECK-NOT: maddld
; CHECK-NEXT: mullw 3, 4, 3
; CHECK-NEXT: addi 3, 3, 13
; CHECK-NEXT: clrldi 3, 3, 32
; CHECK-NEXT: blr
entry:
%mul = mul i32 %b, %a
%add = add i32 %mul, 13
ret i32 %add
}
define signext i32 @maddld32nsw_imm(i32 signext %a, i32 signext %b) {
; CHECK-LABEL: maddld32nsw_imm:
; CHECK: # %bb.0: # %entry
; CHECK-NOT: maddld
; CHECK-NEXT: mulli 4, 4, 13
; CHECK-NEXT: add 3, 4, 3
; CHECK-NEXT: extsw 3, 3
; CHECK-NEXT: blr
entry:
%mul = mul nsw i32 %b, 13
%add = add nsw i32 %mul, %a
ret i32 %add
}
define zeroext i32 @maddld32nuw_imm(i32 zeroext %a, i32 zeroext %b) {
; CHECK-LABEL: maddld32nuw_imm:
; CHECK: # %bb.0: # %entry
; CHECK-NOT: maddld
; CHECK-NEXT: mullw 3, 4, 3
; CHECK-NEXT: addi 3, 3, 13
; CHECK-NEXT: clrldi 3, 3, 32
; CHECK-NEXT: blr
entry:
%mul = mul nuw i32 %b, %a
%add = add nuw i32 %mul, 13
ret i32 %add
}
define zeroext i32 @maddld32nuw_imm_imm(i32 zeroext %b) {
; CHECK-LABEL: maddld32nuw_imm_imm:
; CHECK: # %bb.0: # %entry
; CHECK-NOT: maddld
; CHECK-NEXT: mulli 3, 3, 18
; CHECK-NEXT: addi 3, 3, 13
; CHECK-NEXT: clrldi 3, 3, 32
; CHECK-NEXT: blr
entry:
%mul = mul nuw i32 %b, 18
%add = add nuw i32 %mul, 13
ret i32 %add
}
define zeroext i32 @maddld32nuw_bigimm_imm(i32 zeroext %b) {
; CHECK-LABEL: maddld32nuw_bigimm_imm:
; CHECK: # %bb.0: # %entry
; CHECK-NOT: maddld
; CHECK-NEXT: lis 4, 26127
; CHECK-NEXT: ori 4, 4, 63251
; CHECK-NEXT: mullw 3, 3, 4
; CHECK-NEXT: addi 3, 3, 13
; CHECK-NEXT: clrldi 3, 3, 32
; CHECK-NEXT: blr
entry:
%mul = mul nuw i32 %b, 1712322323
%add = add nuw i32 %mul, 13
ret i32 %add
}
define zeroext i32 @maddld32nuw_bigimm_bigimm(i32 zeroext %b) {
; CHECK-LABEL: maddld32nuw_bigimm_bigimm:
; CHECK: # %bb.0: # %entry
; CHECK-P9-NEXT: lis 4, -865
; CHECK-P9-NEXT: lis 5, 26127
; CHECK-P9-NEXT: ori 4, 4, 42779
; CHECK-P9-NEXT: ori 5, 5, 63251
; CHECK-P9-NEXT: maddld 3, 3, 5, 4
; CHECK-P8-NEXT: lis 4, 26127
; CHECK-P8-NEXT: ori 4, 4, 63251
; CHECK-P8-NEXT: mullw 3, 3, 4
; CHECK-P8-NEXT: addi 3, 3, -22757
; CHECK-P8-NEXT: addis 3, 3, -864
; CHECK-NEXT: clrldi 3, 3, 32
; CHECK-NEXT: blr
entry:
%mul = mul nuw i32 %b, 1712322323
%add = add nuw i32 %mul, 17123223323
ret i32 %add
}