@@ -195,3 +195,82 @@ loop:
195
195
exit:
196
196
ret void
197
197
}
198
+
199
+
200
+ ; Negative tests, currently we don't convert to f16/bf16 via `tbl`.
201
+ define void @sitofp_v8i8_to_v8f16 (ptr %src , ptr %dst ) {
202
+ ; CHECK-LABEL: sitofp_v8i8_to_v8f16:
203
+ ; CHECK: // %bb.0: // %entry
204
+ ; CHECK-NEXT: mov x8, xzr
205
+ ; CHECK-NEXT: .LBB2_1: // %loop
206
+ ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
207
+ ; CHECK-NEXT: ldr d0, [x0, x8, lsl #3]
208
+ ; CHECK-NEXT: sshll v0.8h, v0.8b, #0
209
+ ; CHECK-NEXT: sshll v1.4s, v0.4h, #0
210
+ ; CHECK-NEXT: sshll2 v0.4s, v0.8h, #0
211
+ ; CHECK-NEXT: scvtf v1.4s, v1.4s
212
+ ; CHECK-NEXT: scvtf v0.4s, v0.4s
213
+ ; CHECK-NEXT: fcvtn v1.4h, v1.4s
214
+ ; CHECK-NEXT: fcvtn2 v1.8h, v0.4s
215
+ ; CHECK-NEXT: str q1, [x1, x8, lsl #4]
216
+ ; CHECK-NEXT: add x8, x8, #1
217
+ ; CHECK-NEXT: cmp x8, #1000
218
+ ; CHECK-NEXT: b.eq .LBB2_1
219
+ ; CHECK-NEXT: // %bb.2: // %exit
220
+ ; CHECK-NEXT: ret
221
+ entry:
222
+ br label %loop
223
+
224
+ loop:
225
+ %iv = phi i64 [ 0 , %entry ], [ %iv.next , %loop ]
226
+ %gep.src = getelementptr inbounds <8 x i8 >, ptr %src , i64 %iv
227
+ %l = load <8 x i8 >, ptr %gep.src
228
+ %conv = sitofp <8 x i8 > %l to <8 x half >
229
+ %gep.dst = getelementptr inbounds <8 x half >, ptr %dst , i64 %iv
230
+ store <8 x half > %conv , ptr %gep.dst
231
+ %iv.next = add i64 %iv , 1
232
+ %ec = icmp eq i64 %iv.next , 1000
233
+ br i1 %ec , label %loop , label %exit
234
+
235
+ exit:
236
+ ret void
237
+ }
238
+
239
+
240
+ ; Negative test, conversion to double with the help of `tbl` not implemented (TODO)
241
+ define void @sitofp_v2i8_to_v2f64 (ptr %src , ptr %dst ) {
242
+ ; CHECK-LABEL: sitofp_v2i8_to_v2f64:
243
+ ; CHECK: // %bb.0: // %entry
244
+ ; CHECK-NEXT: mov x8, xzr
245
+ ; CHECK-NEXT: .LBB3_1: // %loop
246
+ ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
247
+ ; CHECK-NEXT: add x9, x0, x8, lsl #1
248
+ ; CHECK-NEXT: ldrsb w10, [x9]
249
+ ; CHECK-NEXT: ldrsb w9, [x9, #1]
250
+ ; CHECK-NEXT: fmov s0, w10
251
+ ; CHECK-NEXT: mov v0.s[1], w9
252
+ ; CHECK-NEXT: sshll v0.2d, v0.2s, #0
253
+ ; CHECK-NEXT: scvtf v0.2d, v0.2d
254
+ ; CHECK-NEXT: str q0, [x1, x8, lsl #4]
255
+ ; CHECK-NEXT: add x8, x8, #1
256
+ ; CHECK-NEXT: cmp x8, #1000
257
+ ; CHECK-NEXT: b.eq .LBB3_1
258
+ ; CHECK-NEXT: // %bb.2: // %exit
259
+ ; CHECK-NEXT: ret
260
+ entry:
261
+ br label %loop
262
+
263
+ loop:
264
+ %iv = phi i64 [ 0 , %entry ], [ %iv.next , %loop ]
265
+ %gep.src = getelementptr inbounds <2 x i8 >, ptr %src , i64 %iv
266
+ %l = load <2 x i8 >, ptr %gep.src
267
+ %conv = sitofp <2 x i8 > %l to <2 x double >
268
+ %gep.dst = getelementptr inbounds <2 x double >, ptr %dst , i64 %iv
269
+ store <2 x double > %conv , ptr %gep.dst
270
+ %iv.next = add i64 %iv , 1
271
+ %ec = icmp eq i64 %iv.next , 1000
272
+ br i1 %ec , label %loop , label %exit
273
+
274
+ exit:
275
+ ret void
276
+ }
0 commit comments