1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown -ppc-vsr-nums-as-vr \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown -ppc-vsr-nums-as-vr \
5 ; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=CHECK-PWR8 %s
7 ; ==========================================
8 ; Tests for store of fp_to_sint converstions
9 ; ==========================================
11 ; Function Attrs: norecurse nounwind
12 define void @qpConv2sdw(fp128* nocapture readonly %a, i64* nocapture %b) {
13 ; CHECK-LABEL: qpConv2sdw:
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: lxv 2, 0(3)
16 ; CHECK-NEXT: xscvqpsdz 2, 2
17 ; CHECK-NEXT: stxsd 2, 0(4)
20 ; CHECK-PWR8-LABEL: qpConv2sdw:
21 ; CHECK-PWR8: # %bb.0: # %entry
22 ; CHECK-PWR8-NEXT: mflr 0
23 ; CHECK-PWR8-NEXT: .cfi_def_cfa_offset 48
24 ; CHECK-PWR8-NEXT: .cfi_offset lr, 16
25 ; CHECK-PWR8-NEXT: .cfi_offset r30, -16
26 ; CHECK-PWR8-NEXT: std 30, -16(1) # 8-byte Folded Spill
27 ; CHECK-PWR8-NEXT: std 0, 16(1)
28 ; CHECK-PWR8-NEXT: stdu 1, -48(1)
29 ; CHECK-PWR8-NEXT: lvx 2, 0, 3
30 ; CHECK-PWR8-NEXT: mr 30, 4
31 ; CHECK-PWR8-NEXT: bl __fixkfdi
32 ; CHECK-PWR8-NEXT: nop
33 ; CHECK-PWR8-NEXT: std 3, 0(30)
34 ; CHECK-PWR8-NEXT: addi 1, 1, 48
35 ; CHECK-PWR8-NEXT: ld 0, 16(1)
36 ; CHECK-PWR8-NEXT: ld 30, -16(1) # 8-byte Folded Reload
37 ; CHECK-PWR8-NEXT: mtlr 0
38 ; CHECK-PWR8-NEXT: blr
40 %0 = load fp128, fp128* %a, align 16
41 %conv = fptosi fp128 %0 to i64
42 store i64 %conv, i64* %b, align 8
48 ; Function Attrs: norecurse nounwind
49 define void @qpConv2sw(fp128* nocapture readonly %a, i32* nocapture %b) {
50 ; CHECK-LABEL: qpConv2sw:
51 ; CHECK: # %bb.0: # %entry
52 ; CHECK-NEXT: lxv 2, 0(3)
53 ; CHECK-NEXT: xscvqpswz 2, 2
54 ; CHECK-NEXT: stxsiwx 2, 0, 4
57 ; CHECK-PWR8-LABEL: qpConv2sw:
58 ; CHECK-PWR8: # %bb.0: # %entry
59 ; CHECK-PWR8-NEXT: mflr 0
60 ; CHECK-PWR8-NEXT: .cfi_def_cfa_offset 48
61 ; CHECK-PWR8-NEXT: .cfi_offset lr, 16
62 ; CHECK-PWR8-NEXT: .cfi_offset r30, -16
63 ; CHECK-PWR8-NEXT: std 30, -16(1) # 8-byte Folded Spill
64 ; CHECK-PWR8-NEXT: std 0, 16(1)
65 ; CHECK-PWR8-NEXT: stdu 1, -48(1)
66 ; CHECK-PWR8-NEXT: lvx 2, 0, 3
67 ; CHECK-PWR8-NEXT: mr 30, 4
68 ; CHECK-PWR8-NEXT: bl __fixkfsi
69 ; CHECK-PWR8-NEXT: nop
70 ; CHECK-PWR8-NEXT: stw 3, 0(30)
71 ; CHECK-PWR8-NEXT: addi 1, 1, 48
72 ; CHECK-PWR8-NEXT: ld 0, 16(1)
73 ; CHECK-PWR8-NEXT: ld 30, -16(1) # 8-byte Folded Reload
74 ; CHECK-PWR8-NEXT: mtlr 0
75 ; CHECK-PWR8-NEXT: blr
77 %0 = load fp128, fp128* %a, align 16
78 %conv = fptosi fp128 %0 to i32
79 store i32 %conv, i32* %b, align 4
85 ; Function Attrs: norecurse nounwind
86 define void @qpConv2udw(fp128* nocapture readonly %a, i64* nocapture %b) {
87 ; CHECK-LABEL: qpConv2udw:
88 ; CHECK: # %bb.0: # %entry
89 ; CHECK-NEXT: lxv 2, 0(3)
90 ; CHECK-NEXT: xscvqpudz 2, 2
91 ; CHECK-NEXT: stxsd 2, 0(4)
94 ; CHECK-PWR8-LABEL: qpConv2udw:
95 ; CHECK-PWR8: # %bb.0: # %entry
96 ; CHECK-PWR8-NEXT: mflr 0
97 ; CHECK-PWR8-NEXT: .cfi_def_cfa_offset 48
98 ; CHECK-PWR8-NEXT: .cfi_offset lr, 16
99 ; CHECK-PWR8-NEXT: .cfi_offset r30, -16
100 ; CHECK-PWR8-NEXT: std 30, -16(1) # 8-byte Folded Spill
101 ; CHECK-PWR8-NEXT: std 0, 16(1)
102 ; CHECK-PWR8-NEXT: stdu 1, -48(1)
103 ; CHECK-PWR8-NEXT: lvx 2, 0, 3
104 ; CHECK-PWR8-NEXT: mr 30, 4
105 ; CHECK-PWR8-NEXT: bl __fixunskfdi
106 ; CHECK-PWR8-NEXT: nop
107 ; CHECK-PWR8-NEXT: std 3, 0(30)
108 ; CHECK-PWR8-NEXT: addi 1, 1, 48
109 ; CHECK-PWR8-NEXT: ld 0, 16(1)
110 ; CHECK-PWR8-NEXT: ld 30, -16(1) # 8-byte Folded Reload
111 ; CHECK-PWR8-NEXT: mtlr 0
112 ; CHECK-PWR8-NEXT: blr
114 %0 = load fp128, fp128* %a, align 16
115 %conv = fptoui fp128 %0 to i64
116 store i64 %conv, i64* %b, align 8
122 ; Function Attrs: norecurse nounwind
123 define void @qpConv2uw(fp128* nocapture readonly %a, i32* nocapture %b) {
124 ; CHECK-LABEL: qpConv2uw:
125 ; CHECK: # %bb.0: # %entry
126 ; CHECK-NEXT: lxv 2, 0(3)
127 ; CHECK-NEXT: xscvqpuwz 2, 2
128 ; CHECK-NEXT: stxsiwx 2, 0, 4
131 ; CHECK-PWR8-LABEL: qpConv2uw:
132 ; CHECK-PWR8: # %bb.0: # %entry
133 ; CHECK-PWR8-NEXT: mflr 0
134 ; CHECK-PWR8-NEXT: .cfi_def_cfa_offset 48
135 ; CHECK-PWR8-NEXT: .cfi_offset lr, 16
136 ; CHECK-PWR8-NEXT: .cfi_offset r30, -16
137 ; CHECK-PWR8-NEXT: std 30, -16(1) # 8-byte Folded Spill
138 ; CHECK-PWR8-NEXT: std 0, 16(1)
139 ; CHECK-PWR8-NEXT: stdu 1, -48(1)
140 ; CHECK-PWR8-NEXT: lvx 2, 0, 3
141 ; CHECK-PWR8-NEXT: mr 30, 4
142 ; CHECK-PWR8-NEXT: bl __fixunskfsi
143 ; CHECK-PWR8-NEXT: nop
144 ; CHECK-PWR8-NEXT: stw 3, 0(30)
145 ; CHECK-PWR8-NEXT: addi 1, 1, 48
146 ; CHECK-PWR8-NEXT: ld 0, 16(1)
147 ; CHECK-PWR8-NEXT: ld 30, -16(1) # 8-byte Folded Reload
148 ; CHECK-PWR8-NEXT: mtlr 0
149 ; CHECK-PWR8-NEXT: blr
151 %0 = load fp128, fp128* %a, align 16
152 %conv = fptoui fp128 %0 to i32
153 store i32 %conv, i32* %b, align 4
159 ; Function Attrs: norecurse nounwind
160 define void @dpConv2sdw(double* nocapture readonly %a, i64* nocapture %b) {
161 ; CHECK-LABEL: dpConv2sdw:
162 ; CHECK: # %bb.0: # %entry
163 ; CHECK-NEXT: lfd 0, 0(3)
164 ; CHECK-NEXT: xscvdpsxds 2, 0
165 ; CHECK-NEXT: stxsd 2, 0(4)
168 ; CHECK-PWR8-LABEL: dpConv2sdw:
169 ; CHECK-PWR8: # %bb.0: # %entry
170 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
171 ; CHECK-PWR8-NEXT: xscvdpsxds 0, 0
172 ; CHECK-PWR8-NEXT: stxsdx 0, 0, 4
173 ; CHECK-PWR8-NEXT: blr
175 %0 = load double, double* %a, align 8
176 %conv = fptosi double %0 to i64
177 store i64 %conv, i64* %b, align 8
183 ; Function Attrs: norecurse nounwind
184 define void @dpConv2sw(double* nocapture readonly %a, i32* nocapture %b) {
185 ; CHECK-LABEL: dpConv2sw:
186 ; CHECK: # %bb.0: # %entry
187 ; CHECK-NEXT: lfd 0, 0(3)
188 ; CHECK-NEXT: xscvdpsxws 0, 0
189 ; CHECK-NEXT: stfiwx 0, 0, 4
192 ; CHECK-PWR8-LABEL: dpConv2sw:
193 ; CHECK-PWR8: # %bb.0: # %entry
194 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
195 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
196 ; CHECK-PWR8-NEXT: stfiwx 0, 0, 4
197 ; CHECK-PWR8-NEXT: blr
199 %0 = load double, double* %a, align 8
200 %conv = fptosi double %0 to i32
201 store i32 %conv, i32* %b, align 4
207 ; Function Attrs: norecurse nounwind
208 define void @dpConv2shw(double* nocapture readonly %a, i16* nocapture %b) {
209 ; CHECK-LABEL: dpConv2shw:
210 ; CHECK: # %bb.0: # %entry
211 ; CHECK-NEXT: lfd 0, 0(3)
212 ; CHECK-NEXT: xscvdpsxws 0, 0
213 ; CHECK-NEXT: stxsihx 0, 0, 4
216 ; CHECK-PWR8-LABEL: dpConv2shw:
217 ; CHECK-PWR8: # %bb.0: # %entry
218 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
219 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
220 ; CHECK-PWR8-NEXT: mffprwz 3, 0
221 ; CHECK-PWR8-NEXT: sth 3, 0(4)
222 ; CHECK-PWR8-NEXT: blr
224 %0 = load double, double* %a, align 8
225 %conv = fptosi double %0 to i16
226 store i16 %conv, i16* %b, align 2
232 ; Function Attrs: norecurse nounwind
233 define void @dpConv2sb(double* nocapture readonly %a, i8* nocapture %b) {
234 ; CHECK-LABEL: dpConv2sb:
235 ; CHECK: # %bb.0: # %entry
236 ; CHECK-NEXT: lfd 0, 0(3)
237 ; CHECK-NEXT: xscvdpsxws 0, 0
238 ; CHECK-NEXT: stxsibx 0, 0, 4
241 ; CHECK-PWR8-LABEL: dpConv2sb:
242 ; CHECK-PWR8: # %bb.0: # %entry
243 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
244 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
245 ; CHECK-PWR8-NEXT: mffprwz 3, 0
246 ; CHECK-PWR8-NEXT: stb 3, 0(4)
247 ; CHECK-PWR8-NEXT: blr
249 %0 = load double, double* %a, align 8
250 %conv = fptosi double %0 to i8
251 store i8 %conv, i8* %b, align 1
257 ; Function Attrs: norecurse nounwind
258 define void @spConv2sdw(float* nocapture readonly %a, i64* nocapture %b) {
259 ; CHECK-LABEL: spConv2sdw:
260 ; CHECK: # %bb.0: # %entry
261 ; CHECK-NEXT: lfs 0, 0(3)
262 ; CHECK-NEXT: xscvdpsxds 2, 0
263 ; CHECK-NEXT: stxsd 2, 0(4)
266 ; CHECK-PWR8-LABEL: spConv2sdw:
267 ; CHECK-PWR8: # %bb.0: # %entry
268 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
269 ; CHECK-PWR8-NEXT: xscvdpsxds 0, 0
270 ; CHECK-PWR8-NEXT: stxsdx 0, 0, 4
271 ; CHECK-PWR8-NEXT: blr
273 %0 = load float, float* %a, align 4
274 %conv = fptosi float %0 to i64
275 store i64 %conv, i64* %b, align 8
281 ; Function Attrs: norecurse nounwind
282 define void @spConv2sw(float* nocapture readonly %a, i32* nocapture %b) {
283 ; CHECK-LABEL: spConv2sw:
284 ; CHECK: # %bb.0: # %entry
285 ; CHECK-NEXT: lfs 0, 0(3)
286 ; CHECK-NEXT: xscvdpsxws 0, 0
287 ; CHECK-NEXT: stfiwx 0, 0, 4
290 ; CHECK-PWR8-LABEL: spConv2sw:
291 ; CHECK-PWR8: # %bb.0: # %entry
292 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
293 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
294 ; CHECK-PWR8-NEXT: stfiwx 0, 0, 4
295 ; CHECK-PWR8-NEXT: blr
297 %0 = load float, float* %a, align 4
298 %conv = fptosi float %0 to i32
299 store i32 %conv, i32* %b, align 4
305 ; Function Attrs: norecurse nounwind
306 define void @spConv2shw(float* nocapture readonly %a, i16* nocapture %b) {
307 ; CHECK-LABEL: spConv2shw:
308 ; CHECK: # %bb.0: # %entry
309 ; CHECK-NEXT: lfs 0, 0(3)
310 ; CHECK-NEXT: xscvdpsxws 0, 0
311 ; CHECK-NEXT: stxsihx 0, 0, 4
314 ; CHECK-PWR8-LABEL: spConv2shw:
315 ; CHECK-PWR8: # %bb.0: # %entry
316 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
317 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
318 ; CHECK-PWR8-NEXT: mffprwz 3, 0
319 ; CHECK-PWR8-NEXT: sth 3, 0(4)
320 ; CHECK-PWR8-NEXT: blr
322 %0 = load float, float* %a, align 4
323 %conv = fptosi float %0 to i16
324 store i16 %conv, i16* %b, align 2
330 ; Function Attrs: norecurse nounwind
331 define void @spConv2sb(float* nocapture readonly %a, i8* nocapture %b) {
332 ; CHECK-LABEL: spConv2sb:
333 ; CHECK: # %bb.0: # %entry
334 ; CHECK-NEXT: lfs 0, 0(3)
335 ; CHECK-NEXT: xscvdpsxws 0, 0
336 ; CHECK-NEXT: stxsibx 0, 0, 4
339 ; CHECK-PWR8-LABEL: spConv2sb:
340 ; CHECK-PWR8: # %bb.0: # %entry
341 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
342 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
343 ; CHECK-PWR8-NEXT: mffprwz 3, 0
344 ; CHECK-PWR8-NEXT: stb 3, 0(4)
345 ; CHECK-PWR8-NEXT: blr
347 %0 = load float, float* %a, align 4
348 %conv = fptosi float %0 to i8
349 store i8 %conv, i8* %b, align 1
355 ; Function Attrs: norecurse nounwind
356 define void @dpConv2sdw_x(double* nocapture readonly %a, i64* nocapture %b,
357 ; CHECK-LABEL: dpConv2sdw_x:
358 ; CHECK: # %bb.0: # %entry
359 ; CHECK-NEXT: lfd 0, 0(3)
360 ; CHECK-NEXT: sldi 3, 5, 3
361 ; CHECK-NEXT: xscvdpsxds 0, 0
362 ; CHECK-NEXT: stxsdx 0, 4, 3
365 ; CHECK-PWR8-LABEL: dpConv2sdw_x:
366 ; CHECK-PWR8: # %bb.0: # %entry
367 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
368 ; CHECK-PWR8-NEXT: sldi 3, 5, 3
369 ; CHECK-PWR8-NEXT: xscvdpsxds 0, 0
370 ; CHECK-PWR8-NEXT: stxsdx 0, 4, 3
371 ; CHECK-PWR8-NEXT: blr
374 %0 = load double, double* %a, align 8
375 %conv = fptosi double %0 to i64
376 %idxprom = sext i32 %idx to i64
377 %arrayidx = getelementptr inbounds i64, i64* %b, i64 %idxprom
378 store i64 %conv, i64* %arrayidx, align 8
384 ; Function Attrs: norecurse nounwind
385 define void @dpConv2sw_x(double* nocapture readonly %a, i32* nocapture %b,
386 ; CHECK-LABEL: dpConv2sw_x:
387 ; CHECK: # %bb.0: # %entry
388 ; CHECK-NEXT: lfd 0, 0(3)
389 ; CHECK-NEXT: sldi 3, 5, 2
390 ; CHECK-NEXT: xscvdpsxws 0, 0
391 ; CHECK-NEXT: stfiwx 0, 4, 3
394 ; CHECK-PWR8-LABEL: dpConv2sw_x:
395 ; CHECK-PWR8: # %bb.0: # %entry
396 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
397 ; CHECK-PWR8-NEXT: sldi 3, 5, 2
398 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
399 ; CHECK-PWR8-NEXT: stfiwx 0, 4, 3
400 ; CHECK-PWR8-NEXT: blr
403 %0 = load double, double* %a, align 8
404 %conv = fptosi double %0 to i32
405 %idxprom = sext i32 %idx to i64
406 %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
407 store i32 %conv, i32* %arrayidx, align 4
413 ; Function Attrs: norecurse nounwind
414 define void @dpConv2shw_x(double* nocapture readonly %a, i16* nocapture %b,
415 ; CHECK-LABEL: dpConv2shw_x:
416 ; CHECK: # %bb.0: # %entry
417 ; CHECK-NEXT: lfd 0, 0(3)
418 ; CHECK-NEXT: sldi 3, 5, 1
419 ; CHECK-NEXT: xscvdpsxws 0, 0
420 ; CHECK-NEXT: stxsihx 0, 4, 3
423 ; CHECK-PWR8-LABEL: dpConv2shw_x:
424 ; CHECK-PWR8: # %bb.0: # %entry
425 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
426 ; CHECK-PWR8-NEXT: sldi 5, 5, 1
427 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
428 ; CHECK-PWR8-NEXT: mffprwz 3, 0
429 ; CHECK-PWR8-NEXT: sthx 3, 4, 5
430 ; CHECK-PWR8-NEXT: blr
433 %0 = load double, double* %a, align 8
434 %conv = fptosi double %0 to i16
435 %idxprom = sext i32 %idx to i64
436 %arrayidx = getelementptr inbounds i16, i16* %b, i64 %idxprom
437 store i16 %conv, i16* %arrayidx, align 2
443 ; Function Attrs: norecurse nounwind
444 define void @dpConv2sb_x(double* nocapture readonly %a, i8* nocapture %b,
445 ; CHECK-LABEL: dpConv2sb_x:
446 ; CHECK: # %bb.0: # %entry
447 ; CHECK-NEXT: lfd 0, 0(3)
448 ; CHECK-NEXT: xscvdpsxws 0, 0
449 ; CHECK-NEXT: stxsibx 0, 4, 5
452 ; CHECK-PWR8-LABEL: dpConv2sb_x:
453 ; CHECK-PWR8: # %bb.0: # %entry
454 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
455 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
456 ; CHECK-PWR8-NEXT: mffprwz 3, 0
457 ; CHECK-PWR8-NEXT: stbx 3, 4, 5
458 ; CHECK-PWR8-NEXT: blr
461 %0 = load double, double* %a, align 8
462 %conv = fptosi double %0 to i8
463 %idxprom = sext i32 %idx to i64
464 %arrayidx = getelementptr inbounds i8, i8* %b, i64 %idxprom
465 store i8 %conv, i8* %arrayidx, align 1
471 ; Function Attrs: norecurse nounwind
472 define void @spConv2sdw_x(float* nocapture readonly %a, i64* nocapture %b,
473 ; CHECK-LABEL: spConv2sdw_x:
474 ; CHECK: # %bb.0: # %entry
475 ; CHECK-NEXT: lfs 0, 0(3)
476 ; CHECK-NEXT: xscvdpsxds 0, 0
477 ; CHECK-NEXT: sldi 5, 5, 3
478 ; CHECK-NEXT: stxsdx 0, 4, 5
481 ; CHECK-PWR8-LABEL: spConv2sdw_x:
482 ; CHECK-PWR8: # %bb.0: # %entry
483 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
484 ; CHECK-PWR8-NEXT: sldi 3, 5, 3
485 ; CHECK-PWR8-NEXT: xscvdpsxds 0, 0
486 ; CHECK-PWR8-NEXT: stxsdx 0, 4, 3
487 ; CHECK-PWR8-NEXT: blr
490 %0 = load float, float* %a, align 4
491 %conv = fptosi float %0 to i64
492 %idxprom = sext i32 %idx to i64
493 %arrayidx = getelementptr inbounds i64, i64* %b, i64 %idxprom
494 store i64 %conv, i64* %arrayidx, align 8
500 ; Function Attrs: norecurse nounwind
501 define void @spConv2sw_x(float* nocapture readonly %a, i32* nocapture %b,
502 ; CHECK-LABEL: spConv2sw_x:
503 ; CHECK: # %bb.0: # %entry
504 ; CHECK-NEXT: lfs 0, 0(3)
505 ; CHECK-NEXT: xscvdpsxws 0, 0
506 ; CHECK-NEXT: sldi 5, 5, 2
507 ; CHECK-NEXT: stfiwx 0, 4, 5
510 ; CHECK-PWR8-LABEL: spConv2sw_x:
511 ; CHECK-PWR8: # %bb.0: # %entry
512 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
513 ; CHECK-PWR8-NEXT: sldi 3, 5, 2
514 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
515 ; CHECK-PWR8-NEXT: stfiwx 0, 4, 3
516 ; CHECK-PWR8-NEXT: blr
519 %0 = load float, float* %a, align 4
520 %conv = fptosi float %0 to i32
521 %idxprom = sext i32 %idx to i64
522 %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
523 store i32 %conv, i32* %arrayidx, align 4
529 ; Function Attrs: norecurse nounwind
530 define void @spConv2shw_x(float* nocapture readonly %a, i16* nocapture %b,
531 ; CHECK-LABEL: spConv2shw_x:
532 ; CHECK: # %bb.0: # %entry
533 ; CHECK-NEXT: lfs 0, 0(3)
534 ; CHECK-NEXT: xscvdpsxws 0, 0
535 ; CHECK-NEXT: sldi 5, 5, 1
536 ; CHECK-NEXT: stxsihx 0, 4, 5
539 ; CHECK-PWR8-LABEL: spConv2shw_x:
540 ; CHECK-PWR8: # %bb.0: # %entry
541 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
542 ; CHECK-PWR8-NEXT: sldi 5, 5, 1
543 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
544 ; CHECK-PWR8-NEXT: mffprwz 3, 0
545 ; CHECK-PWR8-NEXT: sthx 3, 4, 5
546 ; CHECK-PWR8-NEXT: blr
549 %0 = load float, float* %a, align 4
550 %conv = fptosi float %0 to i16
551 %idxprom = sext i32 %idx to i64
552 %arrayidx = getelementptr inbounds i16, i16* %b, i64 %idxprom
553 store i16 %conv, i16* %arrayidx, align 2
559 ; Function Attrs: norecurse nounwind
560 define void @spConv2sb_x(float* nocapture readonly %a, i8* nocapture %b,
561 ; CHECK-LABEL: spConv2sb_x:
562 ; CHECK: # %bb.0: # %entry
563 ; CHECK-NEXT: lfs 0, 0(3)
564 ; CHECK-NEXT: xscvdpsxws 0, 0
565 ; CHECK-NEXT: stxsibx 0, 4, 5
568 ; CHECK-PWR8-LABEL: spConv2sb_x:
569 ; CHECK-PWR8: # %bb.0: # %entry
570 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
571 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
572 ; CHECK-PWR8-NEXT: mffprwz 3, 0
573 ; CHECK-PWR8-NEXT: stbx 3, 4, 5
574 ; CHECK-PWR8-NEXT: blr
577 %0 = load float, float* %a, align 4
578 %conv = fptosi float %0 to i8
579 %idxprom = sext i32 %idx to i64
580 %arrayidx = getelementptr inbounds i8, i8* %b, i64 %idxprom
581 store i8 %conv, i8* %arrayidx, align 1
587 ; ==========================================
588 ; Tests for store of fp_to_uint converstions
589 ; ==========================================
591 ; Function Attrs: norecurse nounwind
592 define void @dpConv2udw(double* nocapture readonly %a, i64* nocapture %b) {
593 ; CHECK-LABEL: dpConv2udw:
594 ; CHECK: # %bb.0: # %entry
595 ; CHECK-NEXT: lfd 0, 0(3)
596 ; CHECK-NEXT: xscvdpuxds 2, 0
597 ; CHECK-NEXT: stxsd 2, 0(4)
600 ; CHECK-PWR8-LABEL: dpConv2udw:
601 ; CHECK-PWR8: # %bb.0: # %entry
602 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
603 ; CHECK-PWR8-NEXT: xscvdpuxds 0, 0
604 ; CHECK-PWR8-NEXT: stxsdx 0, 0, 4
605 ; CHECK-PWR8-NEXT: blr
607 %0 = load double, double* %a, align 8
608 %conv = fptoui double %0 to i64
609 store i64 %conv, i64* %b, align 8
615 ; Function Attrs: norecurse nounwind
616 define void @dpConv2uw(double* nocapture readonly %a, i32* nocapture %b) {
617 ; CHECK-LABEL: dpConv2uw:
618 ; CHECK: # %bb.0: # %entry
619 ; CHECK-NEXT: lfd 0, 0(3)
620 ; CHECK-NEXT: xscvdpuxws 0, 0
621 ; CHECK-NEXT: stfiwx 0, 0, 4
624 ; CHECK-PWR8-LABEL: dpConv2uw:
625 ; CHECK-PWR8: # %bb.0: # %entry
626 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
627 ; CHECK-PWR8-NEXT: xscvdpuxws 0, 0
628 ; CHECK-PWR8-NEXT: stfiwx 0, 0, 4
629 ; CHECK-PWR8-NEXT: blr
631 %0 = load double, double* %a, align 8
632 %conv = fptoui double %0 to i32
633 store i32 %conv, i32* %b, align 4
639 ; Function Attrs: norecurse nounwind
640 define void @dpConv2uhw(double* nocapture readonly %a, i16* nocapture %b) {
641 ; CHECK-LABEL: dpConv2uhw:
642 ; CHECK: # %bb.0: # %entry
643 ; CHECK-NEXT: lfd 0, 0(3)
644 ; CHECK-NEXT: xscvdpuxws 0, 0
645 ; CHECK-NEXT: stxsihx 0, 0, 4
648 ; CHECK-PWR8-LABEL: dpConv2uhw:
649 ; CHECK-PWR8: # %bb.0: # %entry
650 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
651 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
652 ; CHECK-PWR8-NEXT: mffprwz 3, 0
653 ; CHECK-PWR8-NEXT: sth 3, 0(4)
654 ; CHECK-PWR8-NEXT: blr
656 %0 = load double, double* %a, align 8
657 %conv = fptoui double %0 to i16
658 store i16 %conv, i16* %b, align 2
664 ; Function Attrs: norecurse nounwind
665 define void @dpConv2ub(double* nocapture readonly %a, i8* nocapture %b) {
666 ; CHECK-LABEL: dpConv2ub:
667 ; CHECK: # %bb.0: # %entry
668 ; CHECK-NEXT: lfd 0, 0(3)
669 ; CHECK-NEXT: xscvdpuxws 0, 0
670 ; CHECK-NEXT: stxsibx 0, 0, 4
673 ; CHECK-PWR8-LABEL: dpConv2ub:
674 ; CHECK-PWR8: # %bb.0: # %entry
675 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
676 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
677 ; CHECK-PWR8-NEXT: mffprwz 3, 0
678 ; CHECK-PWR8-NEXT: stb 3, 0(4)
679 ; CHECK-PWR8-NEXT: blr
681 %0 = load double, double* %a, align 8
682 %conv = fptoui double %0 to i8
683 store i8 %conv, i8* %b, align 1
689 ; Function Attrs: norecurse nounwind
690 define void @spConv2udw(float* nocapture readonly %a, i64* nocapture %b) {
691 ; CHECK-LABEL: spConv2udw:
692 ; CHECK: # %bb.0: # %entry
693 ; CHECK-NEXT: lfs 0, 0(3)
694 ; CHECK-NEXT: xscvdpuxds 2, 0
695 ; CHECK-NEXT: stxsd 2, 0(4)
698 ; CHECK-PWR8-LABEL: spConv2udw:
699 ; CHECK-PWR8: # %bb.0: # %entry
700 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
701 ; CHECK-PWR8-NEXT: xscvdpuxds 0, 0
702 ; CHECK-PWR8-NEXT: stxsdx 0, 0, 4
703 ; CHECK-PWR8-NEXT: blr
705 %0 = load float, float* %a, align 4
706 %conv = fptoui float %0 to i64
707 store i64 %conv, i64* %b, align 8
713 ; Function Attrs: norecurse nounwind
714 define void @spConv2uw(float* nocapture readonly %a, i32* nocapture %b) {
715 ; CHECK-LABEL: spConv2uw:
716 ; CHECK: # %bb.0: # %entry
717 ; CHECK-NEXT: lfs 0, 0(3)
718 ; CHECK-NEXT: xscvdpuxws 0, 0
719 ; CHECK-NEXT: stfiwx 0, 0, 4
722 ; CHECK-PWR8-LABEL: spConv2uw:
723 ; CHECK-PWR8: # %bb.0: # %entry
724 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
725 ; CHECK-PWR8-NEXT: xscvdpuxws 0, 0
726 ; CHECK-PWR8-NEXT: stfiwx 0, 0, 4
727 ; CHECK-PWR8-NEXT: blr
729 %0 = load float, float* %a, align 4
730 %conv = fptoui float %0 to i32
731 store i32 %conv, i32* %b, align 4
737 ; Function Attrs: norecurse nounwind
738 define void @spConv2uhw(float* nocapture readonly %a, i16* nocapture %b) {
739 ; CHECK-LABEL: spConv2uhw:
740 ; CHECK: # %bb.0: # %entry
741 ; CHECK-NEXT: lfs 0, 0(3)
742 ; CHECK-NEXT: xscvdpuxws 0, 0
743 ; CHECK-NEXT: stxsihx 0, 0, 4
746 ; CHECK-PWR8-LABEL: spConv2uhw:
747 ; CHECK-PWR8: # %bb.0: # %entry
748 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
749 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
750 ; CHECK-PWR8-NEXT: mffprwz 3, 0
751 ; CHECK-PWR8-NEXT: sth 3, 0(4)
752 ; CHECK-PWR8-NEXT: blr
754 %0 = load float, float* %a, align 4
755 %conv = fptoui float %0 to i16
756 store i16 %conv, i16* %b, align 2
762 ; Function Attrs: norecurse nounwind
763 define void @spConv2ub(float* nocapture readonly %a, i8* nocapture %b) {
764 ; CHECK-LABEL: spConv2ub:
765 ; CHECK: # %bb.0: # %entry
766 ; CHECK-NEXT: lfs 0, 0(3)
767 ; CHECK-NEXT: xscvdpuxws 0, 0
768 ; CHECK-NEXT: stxsibx 0, 0, 4
771 ; CHECK-PWR8-LABEL: spConv2ub:
772 ; CHECK-PWR8: # %bb.0: # %entry
773 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
774 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
775 ; CHECK-PWR8-NEXT: mffprwz 3, 0
776 ; CHECK-PWR8-NEXT: stb 3, 0(4)
777 ; CHECK-PWR8-NEXT: blr
779 %0 = load float, float* %a, align 4
780 %conv = fptoui float %0 to i8
781 store i8 %conv, i8* %b, align 1
787 ; Function Attrs: norecurse nounwind
788 define void @dpConv2udw_x(double* nocapture readonly %a, i64* nocapture %b,
789 ; CHECK-LABEL: dpConv2udw_x:
790 ; CHECK: # %bb.0: # %entry
791 ; CHECK-NEXT: lfd 0, 0(3)
792 ; CHECK-NEXT: sldi 3, 5, 3
793 ; CHECK-NEXT: xscvdpuxds 0, 0
794 ; CHECK-NEXT: stxsdx 0, 4, 3
797 ; CHECK-PWR8-LABEL: dpConv2udw_x:
798 ; CHECK-PWR8: # %bb.0: # %entry
799 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
800 ; CHECK-PWR8-NEXT: sldi 3, 5, 3
801 ; CHECK-PWR8-NEXT: xscvdpuxds 0, 0
802 ; CHECK-PWR8-NEXT: stxsdx 0, 4, 3
803 ; CHECK-PWR8-NEXT: blr
806 %0 = load double, double* %a, align 8
807 %conv = fptoui double %0 to i64
808 %idxprom = zext i32 %idx to i64
809 %arrayidx = getelementptr inbounds i64, i64* %b, i64 %idxprom
810 store i64 %conv, i64* %arrayidx, align 8
816 ; Function Attrs: norecurse nounwind
817 define void @dpConv2uw_x(double* nocapture readonly %a, i32* nocapture %b,
818 ; CHECK-LABEL: dpConv2uw_x:
819 ; CHECK: # %bb.0: # %entry
820 ; CHECK-NEXT: lfd 0, 0(3)
821 ; CHECK-NEXT: sldi 3, 5, 2
822 ; CHECK-NEXT: xscvdpuxws 0, 0
823 ; CHECK-NEXT: stfiwx 0, 4, 3
826 ; CHECK-PWR8-LABEL: dpConv2uw_x:
827 ; CHECK-PWR8: # %bb.0: # %entry
828 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
829 ; CHECK-PWR8-NEXT: sldi 3, 5, 2
830 ; CHECK-PWR8-NEXT: xscvdpuxws 0, 0
831 ; CHECK-PWR8-NEXT: stfiwx 0, 4, 3
832 ; CHECK-PWR8-NEXT: blr
835 %0 = load double, double* %a, align 8
836 %conv = fptoui double %0 to i32
837 %idxprom = zext i32 %idx to i64
838 %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
839 store i32 %conv, i32* %arrayidx, align 4
845 ; Function Attrs: norecurse nounwind
846 define void @dpConv2uhw_x(double* nocapture readonly %a, i16* nocapture %b,
847 ; CHECK-LABEL: dpConv2uhw_x:
848 ; CHECK: # %bb.0: # %entry
849 ; CHECK-NEXT: lfd 0, 0(3)
850 ; CHECK-NEXT: sldi 3, 5, 1
851 ; CHECK-NEXT: xscvdpuxws 0, 0
852 ; CHECK-NEXT: stxsihx 0, 4, 3
855 ; CHECK-PWR8-LABEL: dpConv2uhw_x:
856 ; CHECK-PWR8: # %bb.0: # %entry
857 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
858 ; CHECK-PWR8-NEXT: sldi 5, 5, 1
859 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
860 ; CHECK-PWR8-NEXT: mffprwz 3, 0
861 ; CHECK-PWR8-NEXT: sthx 3, 4, 5
862 ; CHECK-PWR8-NEXT: blr
865 %0 = load double, double* %a, align 8
866 %conv = fptoui double %0 to i16
867 %idxprom = zext i32 %idx to i64
868 %arrayidx = getelementptr inbounds i16, i16* %b, i64 %idxprom
869 store i16 %conv, i16* %arrayidx, align 2
875 ; Function Attrs: norecurse nounwind
876 define void @dpConv2ub_x(double* nocapture readonly %a, i8* nocapture %b,
877 ; CHECK-LABEL: dpConv2ub_x:
878 ; CHECK: # %bb.0: # %entry
879 ; CHECK-NEXT: lfd 0, 0(3)
880 ; CHECK-NEXT: xscvdpuxws 0, 0
881 ; CHECK-NEXT: stxsibx 0, 4, 5
884 ; CHECK-PWR8-LABEL: dpConv2ub_x:
885 ; CHECK-PWR8: # %bb.0: # %entry
886 ; CHECK-PWR8-NEXT: lfd 0, 0(3)
887 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
888 ; CHECK-PWR8-NEXT: mffprwz 3, 0
889 ; CHECK-PWR8-NEXT: stbx 3, 4, 5
890 ; CHECK-PWR8-NEXT: blr
893 %0 = load double, double* %a, align 8
894 %conv = fptoui double %0 to i8
895 %idxprom = zext i32 %idx to i64
896 %arrayidx = getelementptr inbounds i8, i8* %b, i64 %idxprom
897 store i8 %conv, i8* %arrayidx, align 1
903 ; Function Attrs: norecurse nounwind
904 define void @spConv2udw_x(float* nocapture readonly %a, i64* nocapture %b,
905 ; CHECK-LABEL: spConv2udw_x:
906 ; CHECK: # %bb.0: # %entry
907 ; CHECK-NEXT: lfs 0, 0(3)
908 ; CHECK-NEXT: xscvdpuxds 0, 0
909 ; CHECK-NEXT: sldi 5, 5, 3
910 ; CHECK-NEXT: stxsdx 0, 4, 5
913 ; CHECK-PWR8-LABEL: spConv2udw_x:
914 ; CHECK-PWR8: # %bb.0: # %entry
915 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
916 ; CHECK-PWR8-NEXT: sldi 3, 5, 3
917 ; CHECK-PWR8-NEXT: xscvdpuxds 0, 0
918 ; CHECK-PWR8-NEXT: stxsdx 0, 4, 3
919 ; CHECK-PWR8-NEXT: blr
922 %0 = load float, float* %a, align 4
923 %conv = fptoui float %0 to i64
924 %idxprom = zext i32 %idx to i64
925 %arrayidx = getelementptr inbounds i64, i64* %b, i64 %idxprom
926 store i64 %conv, i64* %arrayidx, align 8
932 ; Function Attrs: norecurse nounwind
933 define void @spConv2uw_x(float* nocapture readonly %a, i32* nocapture %b,
934 ; CHECK-LABEL: spConv2uw_x:
935 ; CHECK: # %bb.0: # %entry
936 ; CHECK-NEXT: lfs 0, 0(3)
937 ; CHECK-NEXT: xscvdpuxws 0, 0
938 ; CHECK-NEXT: sldi 5, 5, 2
939 ; CHECK-NEXT: stfiwx 0, 4, 5
942 ; CHECK-PWR8-LABEL: spConv2uw_x:
943 ; CHECK-PWR8: # %bb.0: # %entry
944 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
945 ; CHECK-PWR8-NEXT: sldi 3, 5, 2
946 ; CHECK-PWR8-NEXT: xscvdpuxws 0, 0
947 ; CHECK-PWR8-NEXT: stfiwx 0, 4, 3
948 ; CHECK-PWR8-NEXT: blr
951 %0 = load float, float* %a, align 4
952 %conv = fptoui float %0 to i32
953 %idxprom = zext i32 %idx to i64
954 %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
955 store i32 %conv, i32* %arrayidx, align 4
961 ; Function Attrs: norecurse nounwind
962 define void @spConv2uhw_x(float* nocapture readonly %a, i16* nocapture %b,
963 ; CHECK-LABEL: spConv2uhw_x:
964 ; CHECK: # %bb.0: # %entry
965 ; CHECK-NEXT: lfs 0, 0(3)
966 ; CHECK-NEXT: xscvdpuxws 0, 0
967 ; CHECK-NEXT: sldi 5, 5, 1
968 ; CHECK-NEXT: stxsihx 0, 4, 5
971 ; CHECK-PWR8-LABEL: spConv2uhw_x:
972 ; CHECK-PWR8: # %bb.0: # %entry
973 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
974 ; CHECK-PWR8-NEXT: sldi 5, 5, 1
975 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
976 ; CHECK-PWR8-NEXT: mffprwz 3, 0
977 ; CHECK-PWR8-NEXT: sthx 3, 4, 5
978 ; CHECK-PWR8-NEXT: blr
981 %0 = load float, float* %a, align 4
982 %conv = fptoui float %0 to i16
983 %idxprom = zext i32 %idx to i64
984 %arrayidx = getelementptr inbounds i16, i16* %b, i64 %idxprom
985 store i16 %conv, i16* %arrayidx, align 2
991 ; Function Attrs: norecurse nounwind
992 define void @spConv2ub_x(float* nocapture readonly %a, i8* nocapture %b,
993 ; CHECK-LABEL: spConv2ub_x:
994 ; CHECK: # %bb.0: # %entry
995 ; CHECK-NEXT: lfs 0, 0(3)
996 ; CHECK-NEXT: xscvdpuxws 0, 0
997 ; CHECK-NEXT: stxsibx 0, 4, 5
1000 ; CHECK-PWR8-LABEL: spConv2ub_x:
1001 ; CHECK-PWR8: # %bb.0: # %entry
1002 ; CHECK-PWR8-NEXT: lfs 0, 0(3)
1003 ; CHECK-PWR8-NEXT: xscvdpsxws 0, 0
1004 ; CHECK-PWR8-NEXT: mffprwz 3, 0
1005 ; CHECK-PWR8-NEXT: stbx 3, 4, 5
1006 ; CHECK-PWR8-NEXT: blr
1009 %0 = load float, float* %a, align 4
1010 %conv = fptoui float %0 to i8
1011 %idxprom = zext i32 %idx to i64
1012 %arrayidx = getelementptr inbounds i8, i8* %b, i64 %idxprom
1013 store i8 %conv, i8* %arrayidx, align 1