• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6
7; ==========================================
8; Tests for store of fp_to_sint converstions
9; ==========================================
10
11; Function Attrs: norecurse nounwind
12define 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)
18; CHECK-NEXT:    blr
19;
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:    ld 5, 0(3)
30; CHECK-PWR8-NEXT:    ld 6, 8(3)
31; CHECK-PWR8-NEXT:    mr 30, 4
32; CHECK-PWR8-NEXT:    mr 3, 5
33; CHECK-PWR8-NEXT:    mr 4, 6
34; CHECK-PWR8-NEXT:    bl __fixkfdi
35; CHECK-PWR8-NEXT:    nop
36; CHECK-PWR8-NEXT:    std 3, 0(30)
37; CHECK-PWR8-NEXT:    addi 1, 1, 48
38; CHECK-PWR8-NEXT:    ld 0, 16(1)
39; CHECK-PWR8-NEXT:    ld 30, -16(1) # 8-byte Folded Reload
40; CHECK-PWR8-NEXT:    mtlr 0
41; CHECK-PWR8-NEXT:    blr
42entry:
43  %0 = load fp128, fp128* %a, align 16
44  %conv = fptosi fp128 %0 to i64
45  store i64 %conv, i64* %b, align 8
46  ret void
47
48
49}
50
51; Function Attrs: norecurse nounwind
52define void @qpConv2sw(fp128* nocapture readonly %a, i32* nocapture %b) {
53; CHECK-LABEL: qpConv2sw:
54; CHECK:       # %bb.0: # %entry
55; CHECK-NEXT:    lxv 2, 0(3)
56; CHECK-NEXT:    xscvqpswz 2, 2
57; CHECK-NEXT:    stxsiwx 2, 0, 4
58; CHECK-NEXT:    blr
59;
60; CHECK-PWR8-LABEL: qpConv2sw:
61; CHECK-PWR8:       # %bb.0: # %entry
62; CHECK-PWR8-NEXT:    mflr 0
63; CHECK-PWR8-NEXT:    .cfi_def_cfa_offset 48
64; CHECK-PWR8-NEXT:    .cfi_offset lr, 16
65; CHECK-PWR8-NEXT:    .cfi_offset r30, -16
66; CHECK-PWR8-NEXT:    std 30, -16(1) # 8-byte Folded Spill
67; CHECK-PWR8-NEXT:    std 0, 16(1)
68; CHECK-PWR8-NEXT:    stdu 1, -48(1)
69; CHECK-PWR8-NEXT:    ld 5, 0(3)
70; CHECK-PWR8-NEXT:    ld 6, 8(3)
71; CHECK-PWR8-NEXT:    mr 30, 4
72; CHECK-PWR8-NEXT:    mr 3, 5
73; CHECK-PWR8-NEXT:    mr 4, 6
74; CHECK-PWR8-NEXT:    bl __fixkfsi
75; CHECK-PWR8-NEXT:    nop
76; CHECK-PWR8-NEXT:    stw 3, 0(30)
77; CHECK-PWR8-NEXT:    addi 1, 1, 48
78; CHECK-PWR8-NEXT:    ld 0, 16(1)
79; CHECK-PWR8-NEXT:    ld 30, -16(1) # 8-byte Folded Reload
80; CHECK-PWR8-NEXT:    mtlr 0
81; CHECK-PWR8-NEXT:    blr
82entry:
83  %0 = load fp128, fp128* %a, align 16
84  %conv = fptosi fp128 %0 to i32
85  store i32 %conv, i32* %b, align 4
86  ret void
87
88
89}
90
91; Function Attrs: norecurse nounwind
92define void @qpConv2udw(fp128* nocapture readonly %a, i64* nocapture %b) {
93; CHECK-LABEL: qpConv2udw:
94; CHECK:       # %bb.0: # %entry
95; CHECK-NEXT:    lxv 2, 0(3)
96; CHECK-NEXT:    xscvqpudz 2, 2
97; CHECK-NEXT:    stxsd 2, 0(4)
98; CHECK-NEXT:    blr
99;
100; CHECK-PWR8-LABEL: qpConv2udw:
101; CHECK-PWR8:       # %bb.0: # %entry
102; CHECK-PWR8-NEXT:    mflr 0
103; CHECK-PWR8-NEXT:    .cfi_def_cfa_offset 48
104; CHECK-PWR8-NEXT:    .cfi_offset lr, 16
105; CHECK-PWR8-NEXT:    .cfi_offset r30, -16
106; CHECK-PWR8-NEXT:    std 30, -16(1) # 8-byte Folded Spill
107; CHECK-PWR8-NEXT:    std 0, 16(1)
108; CHECK-PWR8-NEXT:    stdu 1, -48(1)
109; CHECK-PWR8-NEXT:    ld 5, 0(3)
110; CHECK-PWR8-NEXT:    ld 6, 8(3)
111; CHECK-PWR8-NEXT:    mr 30, 4
112; CHECK-PWR8-NEXT:    mr 3, 5
113; CHECK-PWR8-NEXT:    mr 4, 6
114; CHECK-PWR8-NEXT:    bl __fixunskfdi
115; CHECK-PWR8-NEXT:    nop
116; CHECK-PWR8-NEXT:    std 3, 0(30)
117; CHECK-PWR8-NEXT:    addi 1, 1, 48
118; CHECK-PWR8-NEXT:    ld 0, 16(1)
119; CHECK-PWR8-NEXT:    ld 30, -16(1) # 8-byte Folded Reload
120; CHECK-PWR8-NEXT:    mtlr 0
121; CHECK-PWR8-NEXT:    blr
122entry:
123  %0 = load fp128, fp128* %a, align 16
124  %conv = fptoui fp128 %0 to i64
125  store i64 %conv, i64* %b, align 8
126  ret void
127
128
129}
130
131; Function Attrs: norecurse nounwind
132define void @qpConv2uw(fp128* nocapture readonly %a, i32* nocapture %b) {
133; CHECK-LABEL: qpConv2uw:
134; CHECK:       # %bb.0: # %entry
135; CHECK-NEXT:    lxv 2, 0(3)
136; CHECK-NEXT:    xscvqpuwz 2, 2
137; CHECK-NEXT:    stxsiwx 2, 0, 4
138; CHECK-NEXT:    blr
139;
140; CHECK-PWR8-LABEL: qpConv2uw:
141; CHECK-PWR8:       # %bb.0: # %entry
142; CHECK-PWR8-NEXT:    mflr 0
143; CHECK-PWR8-NEXT:    .cfi_def_cfa_offset 48
144; CHECK-PWR8-NEXT:    .cfi_offset lr, 16
145; CHECK-PWR8-NEXT:    .cfi_offset r30, -16
146; CHECK-PWR8-NEXT:    std 30, -16(1) # 8-byte Folded Spill
147; CHECK-PWR8-NEXT:    std 0, 16(1)
148; CHECK-PWR8-NEXT:    stdu 1, -48(1)
149; CHECK-PWR8-NEXT:    ld 5, 0(3)
150; CHECK-PWR8-NEXT:    ld 6, 8(3)
151; CHECK-PWR8-NEXT:    mr 30, 4
152; CHECK-PWR8-NEXT:    mr 3, 5
153; CHECK-PWR8-NEXT:    mr 4, 6
154; CHECK-PWR8-NEXT:    bl __fixunskfsi
155; CHECK-PWR8-NEXT:    nop
156; CHECK-PWR8-NEXT:    stw 3, 0(30)
157; CHECK-PWR8-NEXT:    addi 1, 1, 48
158; CHECK-PWR8-NEXT:    ld 0, 16(1)
159; CHECK-PWR8-NEXT:    ld 30, -16(1) # 8-byte Folded Reload
160; CHECK-PWR8-NEXT:    mtlr 0
161; CHECK-PWR8-NEXT:    blr
162entry:
163  %0 = load fp128, fp128* %a, align 16
164  %conv = fptoui fp128 %0 to i32
165  store i32 %conv, i32* %b, align 4
166  ret void
167
168
169}
170
171; Function Attrs: norecurse nounwind
172define void @dpConv2sdw(double* nocapture readonly %a, i64* nocapture %b) {
173; CHECK-LABEL: dpConv2sdw:
174; CHECK:       # %bb.0: # %entry
175; CHECK-NEXT:    lfd 0, 0(3)
176; CHECK-NEXT:    xscvdpsxds 2, 0
177; CHECK-NEXT:    stxsd 2, 0(4)
178; CHECK-NEXT:    blr
179;
180; CHECK-PWR8-LABEL: dpConv2sdw:
181; CHECK-PWR8:       # %bb.0: # %entry
182; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
183; CHECK-PWR8-NEXT:    xscvdpsxds 0, 0
184; CHECK-PWR8-NEXT:    stxsdx 0, 0, 4
185; CHECK-PWR8-NEXT:    blr
186entry:
187  %0 = load double, double* %a, align 8
188  %conv = fptosi double %0 to i64
189  store i64 %conv, i64* %b, align 8
190  ret void
191
192
193}
194
195; Function Attrs: norecurse nounwind
196define void @dpConv2sw(double* nocapture readonly %a, i32* nocapture %b) {
197; CHECK-LABEL: dpConv2sw:
198; CHECK:       # %bb.0: # %entry
199; CHECK-NEXT:    lfd 0, 0(3)
200; CHECK-NEXT:    xscvdpsxws 0, 0
201; CHECK-NEXT:    stfiwx 0, 0, 4
202; CHECK-NEXT:    blr
203;
204; CHECK-PWR8-LABEL: dpConv2sw:
205; CHECK-PWR8:       # %bb.0: # %entry
206; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
207; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
208; CHECK-PWR8-NEXT:    stfiwx 0, 0, 4
209; CHECK-PWR8-NEXT:    blr
210entry:
211  %0 = load double, double* %a, align 8
212  %conv = fptosi double %0 to i32
213  store i32 %conv, i32* %b, align 4
214  ret void
215
216
217}
218
219; Function Attrs: norecurse nounwind
220define void @dpConv2shw(double* nocapture readonly %a, i16* nocapture %b) {
221; CHECK-LABEL: dpConv2shw:
222; CHECK:       # %bb.0: # %entry
223; CHECK-NEXT:    lfd 0, 0(3)
224; CHECK-NEXT:    xscvdpsxws 0, 0
225; CHECK-NEXT:    stxsihx 0, 0, 4
226; CHECK-NEXT:    blr
227;
228; CHECK-PWR8-LABEL: dpConv2shw:
229; CHECK-PWR8:       # %bb.0: # %entry
230; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
231; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
232; CHECK-PWR8-NEXT:    mffprwz 3, 0
233; CHECK-PWR8-NEXT:    sth 3, 0(4)
234; CHECK-PWR8-NEXT:    blr
235entry:
236  %0 = load double, double* %a, align 8
237  %conv = fptosi double %0 to i16
238  store i16 %conv, i16* %b, align 2
239  ret void
240
241
242}
243
244; Function Attrs: norecurse nounwind
245define void @dpConv2sb(double* nocapture readonly %a, i8* nocapture %b) {
246; CHECK-LABEL: dpConv2sb:
247; CHECK:       # %bb.0: # %entry
248; CHECK-NEXT:    lfd 0, 0(3)
249; CHECK-NEXT:    xscvdpsxws 0, 0
250; CHECK-NEXT:    stxsibx 0, 0, 4
251; CHECK-NEXT:    blr
252;
253; CHECK-PWR8-LABEL: dpConv2sb:
254; CHECK-PWR8:       # %bb.0: # %entry
255; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
256; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
257; CHECK-PWR8-NEXT:    mffprwz 3, 0
258; CHECK-PWR8-NEXT:    stb 3, 0(4)
259; CHECK-PWR8-NEXT:    blr
260entry:
261  %0 = load double, double* %a, align 8
262  %conv = fptosi double %0 to i8
263  store i8 %conv, i8* %b, align 1
264  ret void
265
266
267}
268
269; Function Attrs: norecurse nounwind
270define void @spConv2sdw(float* nocapture readonly %a, i64* nocapture %b) {
271; CHECK-LABEL: spConv2sdw:
272; CHECK:       # %bb.0: # %entry
273; CHECK-NEXT:    lfs 0, 0(3)
274; CHECK-NEXT:    xscvdpsxds 2, 0
275; CHECK-NEXT:    stxsd 2, 0(4)
276; CHECK-NEXT:    blr
277;
278; CHECK-PWR8-LABEL: spConv2sdw:
279; CHECK-PWR8:       # %bb.0: # %entry
280; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
281; CHECK-PWR8-NEXT:    xscvdpsxds 0, 0
282; CHECK-PWR8-NEXT:    stxsdx 0, 0, 4
283; CHECK-PWR8-NEXT:    blr
284entry:
285  %0 = load float, float* %a, align 4
286  %conv = fptosi float %0 to i64
287  store i64 %conv, i64* %b, align 8
288  ret void
289
290
291}
292
293; Function Attrs: norecurse nounwind
294define void @spConv2sw(float* nocapture readonly %a, i32* nocapture %b) {
295; CHECK-LABEL: spConv2sw:
296; CHECK:       # %bb.0: # %entry
297; CHECK-NEXT:    lfs 0, 0(3)
298; CHECK-NEXT:    xscvdpsxws 0, 0
299; CHECK-NEXT:    stfiwx 0, 0, 4
300; CHECK-NEXT:    blr
301;
302; CHECK-PWR8-LABEL: spConv2sw:
303; CHECK-PWR8:       # %bb.0: # %entry
304; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
305; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
306; CHECK-PWR8-NEXT:    stfiwx 0, 0, 4
307; CHECK-PWR8-NEXT:    blr
308entry:
309  %0 = load float, float* %a, align 4
310  %conv = fptosi float %0 to i32
311  store i32 %conv, i32* %b, align 4
312  ret void
313
314
315}
316
317; Function Attrs: norecurse nounwind
318define void @spConv2shw(float* nocapture readonly %a, i16* nocapture %b) {
319; CHECK-LABEL: spConv2shw:
320; CHECK:       # %bb.0: # %entry
321; CHECK-NEXT:    lfs 0, 0(3)
322; CHECK-NEXT:    xscvdpsxws 0, 0
323; CHECK-NEXT:    stxsihx 0, 0, 4
324; CHECK-NEXT:    blr
325;
326; CHECK-PWR8-LABEL: spConv2shw:
327; CHECK-PWR8:       # %bb.0: # %entry
328; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
329; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
330; CHECK-PWR8-NEXT:    mffprwz 3, 0
331; CHECK-PWR8-NEXT:    sth 3, 0(4)
332; CHECK-PWR8-NEXT:    blr
333entry:
334  %0 = load float, float* %a, align 4
335  %conv = fptosi float %0 to i16
336  store i16 %conv, i16* %b, align 2
337  ret void
338
339
340}
341
342; Function Attrs: norecurse nounwind
343define void @spConv2sb(float* nocapture readonly %a, i8* nocapture %b) {
344; CHECK-LABEL: spConv2sb:
345; CHECK:       # %bb.0: # %entry
346; CHECK-NEXT:    lfs 0, 0(3)
347; CHECK-NEXT:    xscvdpsxws 0, 0
348; CHECK-NEXT:    stxsibx 0, 0, 4
349; CHECK-NEXT:    blr
350;
351; CHECK-PWR8-LABEL: spConv2sb:
352; CHECK-PWR8:       # %bb.0: # %entry
353; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
354; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
355; CHECK-PWR8-NEXT:    mffprwz 3, 0
356; CHECK-PWR8-NEXT:    stb 3, 0(4)
357; CHECK-PWR8-NEXT:    blr
358entry:
359  %0 = load float, float* %a, align 4
360  %conv = fptosi float %0 to i8
361  store i8 %conv, i8* %b, align 1
362  ret void
363
364
365}
366
367; Function Attrs: norecurse nounwind
368define void @dpConv2sdw_x(double* nocapture readonly %a, i64* nocapture %b,
369; CHECK-LABEL: dpConv2sdw_x:
370; CHECK:       # %bb.0: # %entry
371; CHECK-NEXT:    lfd 0, 0(3)
372; CHECK-NEXT:    sldi 3, 5, 3
373; CHECK-NEXT:    xscvdpsxds 0, 0
374; CHECK-NEXT:    stxsdx 0, 4, 3
375; CHECK-NEXT:    blr
376;
377; CHECK-PWR8-LABEL: dpConv2sdw_x:
378; CHECK-PWR8:       # %bb.0: # %entry
379; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
380; CHECK-PWR8-NEXT:    sldi 3, 5, 3
381; CHECK-PWR8-NEXT:    xscvdpsxds 0, 0
382; CHECK-PWR8-NEXT:    stxsdx 0, 4, 3
383; CHECK-PWR8-NEXT:    blr
384                          i32 signext %idx) {
385entry:
386  %0 = load double, double* %a, align 8
387  %conv = fptosi double %0 to i64
388  %idxprom = sext i32 %idx to i64
389  %arrayidx = getelementptr inbounds i64, i64* %b, i64 %idxprom
390  store i64 %conv, i64* %arrayidx, align 8
391  ret void
392
393
394}
395
396; Function Attrs: norecurse nounwind
397define void @dpConv2sw_x(double* nocapture readonly %a, i32* nocapture %b,
398; CHECK-LABEL: dpConv2sw_x:
399; CHECK:       # %bb.0: # %entry
400; CHECK-NEXT:    lfd 0, 0(3)
401; CHECK-NEXT:    sldi 3, 5, 2
402; CHECK-NEXT:    xscvdpsxws 0, 0
403; CHECK-NEXT:    stfiwx 0, 4, 3
404; CHECK-NEXT:    blr
405;
406; CHECK-PWR8-LABEL: dpConv2sw_x:
407; CHECK-PWR8:       # %bb.0: # %entry
408; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
409; CHECK-PWR8-NEXT:    sldi 3, 5, 2
410; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
411; CHECK-PWR8-NEXT:    stfiwx 0, 4, 3
412; CHECK-PWR8-NEXT:    blr
413                          i32 signext %idx) {
414entry:
415  %0 = load double, double* %a, align 8
416  %conv = fptosi double %0 to i32
417  %idxprom = sext i32 %idx to i64
418  %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
419  store i32 %conv, i32* %arrayidx, align 4
420  ret void
421
422
423}
424
425; Function Attrs: norecurse nounwind
426define void @dpConv2shw_x(double* nocapture readonly %a, i16* nocapture %b,
427; CHECK-LABEL: dpConv2shw_x:
428; CHECK:       # %bb.0: # %entry
429; CHECK-NEXT:    lfd 0, 0(3)
430; CHECK-NEXT:    sldi 3, 5, 1
431; CHECK-NEXT:    xscvdpsxws 0, 0
432; CHECK-NEXT:    stxsihx 0, 4, 3
433; CHECK-NEXT:    blr
434;
435; CHECK-PWR8-LABEL: dpConv2shw_x:
436; CHECK-PWR8:       # %bb.0: # %entry
437; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
438; CHECK-PWR8-NEXT:    sldi 5, 5, 1
439; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
440; CHECK-PWR8-NEXT:    mffprwz 3, 0
441; CHECK-PWR8-NEXT:    sthx 3, 4, 5
442; CHECK-PWR8-NEXT:    blr
443                          i32 signext %idx) {
444entry:
445  %0 = load double, double* %a, align 8
446  %conv = fptosi double %0 to i16
447  %idxprom = sext i32 %idx to i64
448  %arrayidx = getelementptr inbounds i16, i16* %b, i64 %idxprom
449  store i16 %conv, i16* %arrayidx, align 2
450  ret void
451
452
453}
454
455; Function Attrs: norecurse nounwind
456define void @dpConv2sb_x(double* nocapture readonly %a, i8* nocapture %b,
457; CHECK-LABEL: dpConv2sb_x:
458; CHECK:       # %bb.0: # %entry
459; CHECK-NEXT:    lfd 0, 0(3)
460; CHECK-NEXT:    xscvdpsxws 0, 0
461; CHECK-NEXT:    stxsibx 0, 4, 5
462; CHECK-NEXT:    blr
463;
464; CHECK-PWR8-LABEL: dpConv2sb_x:
465; CHECK-PWR8:       # %bb.0: # %entry
466; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
467; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
468; CHECK-PWR8-NEXT:    mffprwz 3, 0
469; CHECK-PWR8-NEXT:    stbx 3, 4, 5
470; CHECK-PWR8-NEXT:    blr
471                          i32 signext %idx) {
472entry:
473  %0 = load double, double* %a, align 8
474  %conv = fptosi double %0 to i8
475  %idxprom = sext i32 %idx to i64
476  %arrayidx = getelementptr inbounds i8, i8* %b, i64 %idxprom
477  store i8 %conv, i8* %arrayidx, align 1
478  ret void
479
480
481}
482
483; Function Attrs: norecurse nounwind
484define void @spConv2sdw_x(float* nocapture readonly %a, i64* nocapture %b,
485; CHECK-LABEL: spConv2sdw_x:
486; CHECK:       # %bb.0: # %entry
487; CHECK-NEXT:    lfs 0, 0(3)
488; CHECK-NEXT:    xscvdpsxds 0, 0
489; CHECK-NEXT:    sldi 5, 5, 3
490; CHECK-NEXT:    stxsdx 0, 4, 5
491; CHECK-NEXT:    blr
492;
493; CHECK-PWR8-LABEL: spConv2sdw_x:
494; CHECK-PWR8:       # %bb.0: # %entry
495; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
496; CHECK-PWR8-NEXT:    sldi 3, 5, 3
497; CHECK-PWR8-NEXT:    xscvdpsxds 0, 0
498; CHECK-PWR8-NEXT:    stxsdx 0, 4, 3
499; CHECK-PWR8-NEXT:    blr
500                          i32 signext %idx) {
501entry:
502  %0 = load float, float* %a, align 4
503  %conv = fptosi float %0 to i64
504  %idxprom = sext i32 %idx to i64
505  %arrayidx = getelementptr inbounds i64, i64* %b, i64 %idxprom
506  store i64 %conv, i64* %arrayidx, align 8
507  ret void
508
509
510}
511
512; Function Attrs: norecurse nounwind
513define void @spConv2sw_x(float* nocapture readonly %a, i32* nocapture %b,
514; CHECK-LABEL: spConv2sw_x:
515; CHECK:       # %bb.0: # %entry
516; CHECK-NEXT:    lfs 0, 0(3)
517; CHECK-NEXT:    xscvdpsxws 0, 0
518; CHECK-NEXT:    sldi 5, 5, 2
519; CHECK-NEXT:    stfiwx 0, 4, 5
520; CHECK-NEXT:    blr
521;
522; CHECK-PWR8-LABEL: spConv2sw_x:
523; CHECK-PWR8:       # %bb.0: # %entry
524; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
525; CHECK-PWR8-NEXT:    sldi 3, 5, 2
526; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
527; CHECK-PWR8-NEXT:    stfiwx 0, 4, 3
528; CHECK-PWR8-NEXT:    blr
529                          i32 signext %idx) {
530entry:
531  %0 = load float, float* %a, align 4
532  %conv = fptosi float %0 to i32
533  %idxprom = sext i32 %idx to i64
534  %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
535  store i32 %conv, i32* %arrayidx, align 4
536  ret void
537
538
539}
540
541; Function Attrs: norecurse nounwind
542define void @spConv2shw_x(float* nocapture readonly %a, i16* nocapture %b,
543; CHECK-LABEL: spConv2shw_x:
544; CHECK:       # %bb.0: # %entry
545; CHECK-NEXT:    lfs 0, 0(3)
546; CHECK-NEXT:    xscvdpsxws 0, 0
547; CHECK-NEXT:    sldi 5, 5, 1
548; CHECK-NEXT:    stxsihx 0, 4, 5
549; CHECK-NEXT:    blr
550;
551; CHECK-PWR8-LABEL: spConv2shw_x:
552; CHECK-PWR8:       # %bb.0: # %entry
553; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
554; CHECK-PWR8-NEXT:    sldi 5, 5, 1
555; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
556; CHECK-PWR8-NEXT:    mffprwz 3, 0
557; CHECK-PWR8-NEXT:    sthx 3, 4, 5
558; CHECK-PWR8-NEXT:    blr
559                          i32 signext %idx) {
560entry:
561  %0 = load float, float* %a, align 4
562  %conv = fptosi float %0 to i16
563  %idxprom = sext i32 %idx to i64
564  %arrayidx = getelementptr inbounds i16, i16* %b, i64 %idxprom
565  store i16 %conv, i16* %arrayidx, align 2
566  ret void
567
568
569}
570
571; Function Attrs: norecurse nounwind
572define void @spConv2sb_x(float* nocapture readonly %a, i8* nocapture %b,
573; CHECK-LABEL: spConv2sb_x:
574; CHECK:       # %bb.0: # %entry
575; CHECK-NEXT:    lfs 0, 0(3)
576; CHECK-NEXT:    xscvdpsxws 0, 0
577; CHECK-NEXT:    stxsibx 0, 4, 5
578; CHECK-NEXT:    blr
579;
580; CHECK-PWR8-LABEL: spConv2sb_x:
581; CHECK-PWR8:       # %bb.0: # %entry
582; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
583; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
584; CHECK-PWR8-NEXT:    mffprwz 3, 0
585; CHECK-PWR8-NEXT:    stbx 3, 4, 5
586; CHECK-PWR8-NEXT:    blr
587                          i32 signext %idx) {
588entry:
589  %0 = load float, float* %a, align 4
590  %conv = fptosi float %0 to i8
591  %idxprom = sext i32 %idx to i64
592  %arrayidx = getelementptr inbounds i8, i8* %b, i64 %idxprom
593  store i8 %conv, i8* %arrayidx, align 1
594  ret void
595
596
597}
598
599; ==========================================
600; Tests for store of fp_to_uint converstions
601; ==========================================
602
603; Function Attrs: norecurse nounwind
604define void @dpConv2udw(double* nocapture readonly %a, i64* nocapture %b) {
605; CHECK-LABEL: dpConv2udw:
606; CHECK:       # %bb.0: # %entry
607; CHECK-NEXT:    lfd 0, 0(3)
608; CHECK-NEXT:    xscvdpuxds 2, 0
609; CHECK-NEXT:    stxsd 2, 0(4)
610; CHECK-NEXT:    blr
611;
612; CHECK-PWR8-LABEL: dpConv2udw:
613; CHECK-PWR8:       # %bb.0: # %entry
614; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
615; CHECK-PWR8-NEXT:    xscvdpuxds 0, 0
616; CHECK-PWR8-NEXT:    stxsdx 0, 0, 4
617; CHECK-PWR8-NEXT:    blr
618entry:
619  %0 = load double, double* %a, align 8
620  %conv = fptoui double %0 to i64
621  store i64 %conv, i64* %b, align 8
622  ret void
623
624
625}
626
627; Function Attrs: norecurse nounwind
628define void @dpConv2uw(double* nocapture readonly %a, i32* nocapture %b) {
629; CHECK-LABEL: dpConv2uw:
630; CHECK:       # %bb.0: # %entry
631; CHECK-NEXT:    lfd 0, 0(3)
632; CHECK-NEXT:    xscvdpuxws 0, 0
633; CHECK-NEXT:    stfiwx 0, 0, 4
634; CHECK-NEXT:    blr
635;
636; CHECK-PWR8-LABEL: dpConv2uw:
637; CHECK-PWR8:       # %bb.0: # %entry
638; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
639; CHECK-PWR8-NEXT:    xscvdpuxws 0, 0
640; CHECK-PWR8-NEXT:    stfiwx 0, 0, 4
641; CHECK-PWR8-NEXT:    blr
642entry:
643  %0 = load double, double* %a, align 8
644  %conv = fptoui double %0 to i32
645  store i32 %conv, i32* %b, align 4
646  ret void
647
648
649}
650
651; Function Attrs: norecurse nounwind
652define void @dpConv2uhw(double* nocapture readonly %a, i16* nocapture %b) {
653; CHECK-LABEL: dpConv2uhw:
654; CHECK:       # %bb.0: # %entry
655; CHECK-NEXT:    lfd 0, 0(3)
656; CHECK-NEXT:    xscvdpuxws 0, 0
657; CHECK-NEXT:    stxsihx 0, 0, 4
658; CHECK-NEXT:    blr
659;
660; CHECK-PWR8-LABEL: dpConv2uhw:
661; CHECK-PWR8:       # %bb.0: # %entry
662; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
663; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
664; CHECK-PWR8-NEXT:    mffprwz 3, 0
665; CHECK-PWR8-NEXT:    sth 3, 0(4)
666; CHECK-PWR8-NEXT:    blr
667entry:
668  %0 = load double, double* %a, align 8
669  %conv = fptoui double %0 to i16
670  store i16 %conv, i16* %b, align 2
671  ret void
672
673
674}
675
676; Function Attrs: norecurse nounwind
677define void @dpConv2ub(double* nocapture readonly %a, i8* nocapture %b) {
678; CHECK-LABEL: dpConv2ub:
679; CHECK:       # %bb.0: # %entry
680; CHECK-NEXT:    lfd 0, 0(3)
681; CHECK-NEXT:    xscvdpuxws 0, 0
682; CHECK-NEXT:    stxsibx 0, 0, 4
683; CHECK-NEXT:    blr
684;
685; CHECK-PWR8-LABEL: dpConv2ub:
686; CHECK-PWR8:       # %bb.0: # %entry
687; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
688; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
689; CHECK-PWR8-NEXT:    mffprwz 3, 0
690; CHECK-PWR8-NEXT:    stb 3, 0(4)
691; CHECK-PWR8-NEXT:    blr
692entry:
693  %0 = load double, double* %a, align 8
694  %conv = fptoui double %0 to i8
695  store i8 %conv, i8* %b, align 1
696  ret void
697
698
699}
700
701; Function Attrs: norecurse nounwind
702define void @spConv2udw(float* nocapture readonly %a, i64* nocapture %b) {
703; CHECK-LABEL: spConv2udw:
704; CHECK:       # %bb.0: # %entry
705; CHECK-NEXT:    lfs 0, 0(3)
706; CHECK-NEXT:    xscvdpuxds 2, 0
707; CHECK-NEXT:    stxsd 2, 0(4)
708; CHECK-NEXT:    blr
709;
710; CHECK-PWR8-LABEL: spConv2udw:
711; CHECK-PWR8:       # %bb.0: # %entry
712; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
713; CHECK-PWR8-NEXT:    xscvdpuxds 0, 0
714; CHECK-PWR8-NEXT:    stxsdx 0, 0, 4
715; CHECK-PWR8-NEXT:    blr
716entry:
717  %0 = load float, float* %a, align 4
718  %conv = fptoui float %0 to i64
719  store i64 %conv, i64* %b, align 8
720  ret void
721
722
723}
724
725; Function Attrs: norecurse nounwind
726define void @spConv2uw(float* nocapture readonly %a, i32* nocapture %b) {
727; CHECK-LABEL: spConv2uw:
728; CHECK:       # %bb.0: # %entry
729; CHECK-NEXT:    lfs 0, 0(3)
730; CHECK-NEXT:    xscvdpuxws 0, 0
731; CHECK-NEXT:    stfiwx 0, 0, 4
732; CHECK-NEXT:    blr
733;
734; CHECK-PWR8-LABEL: spConv2uw:
735; CHECK-PWR8:       # %bb.0: # %entry
736; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
737; CHECK-PWR8-NEXT:    xscvdpuxws 0, 0
738; CHECK-PWR8-NEXT:    stfiwx 0, 0, 4
739; CHECK-PWR8-NEXT:    blr
740entry:
741  %0 = load float, float* %a, align 4
742  %conv = fptoui float %0 to i32
743  store i32 %conv, i32* %b, align 4
744  ret void
745
746
747}
748
749; Function Attrs: norecurse nounwind
750define void @spConv2uhw(float* nocapture readonly %a, i16* nocapture %b) {
751; CHECK-LABEL: spConv2uhw:
752; CHECK:       # %bb.0: # %entry
753; CHECK-NEXT:    lfs 0, 0(3)
754; CHECK-NEXT:    xscvdpuxws 0, 0
755; CHECK-NEXT:    stxsihx 0, 0, 4
756; CHECK-NEXT:    blr
757;
758; CHECK-PWR8-LABEL: spConv2uhw:
759; CHECK-PWR8:       # %bb.0: # %entry
760; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
761; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
762; CHECK-PWR8-NEXT:    mffprwz 3, 0
763; CHECK-PWR8-NEXT:    sth 3, 0(4)
764; CHECK-PWR8-NEXT:    blr
765entry:
766  %0 = load float, float* %a, align 4
767  %conv = fptoui float %0 to i16
768  store i16 %conv, i16* %b, align 2
769  ret void
770
771
772}
773
774; Function Attrs: norecurse nounwind
775define void @spConv2ub(float* nocapture readonly %a, i8* nocapture %b) {
776; CHECK-LABEL: spConv2ub:
777; CHECK:       # %bb.0: # %entry
778; CHECK-NEXT:    lfs 0, 0(3)
779; CHECK-NEXT:    xscvdpuxws 0, 0
780; CHECK-NEXT:    stxsibx 0, 0, 4
781; CHECK-NEXT:    blr
782;
783; CHECK-PWR8-LABEL: spConv2ub:
784; CHECK-PWR8:       # %bb.0: # %entry
785; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
786; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
787; CHECK-PWR8-NEXT:    mffprwz 3, 0
788; CHECK-PWR8-NEXT:    stb 3, 0(4)
789; CHECK-PWR8-NEXT:    blr
790entry:
791  %0 = load float, float* %a, align 4
792  %conv = fptoui float %0 to i8
793  store i8 %conv, i8* %b, align 1
794  ret void
795
796
797}
798
799; Function Attrs: norecurse nounwind
800define void @dpConv2udw_x(double* nocapture readonly %a, i64* nocapture %b,
801; CHECK-LABEL: dpConv2udw_x:
802; CHECK:       # %bb.0: # %entry
803; CHECK-NEXT:    lfd 0, 0(3)
804; CHECK-NEXT:    sldi 3, 5, 3
805; CHECK-NEXT:    xscvdpuxds 0, 0
806; CHECK-NEXT:    stxsdx 0, 4, 3
807; CHECK-NEXT:    blr
808;
809; CHECK-PWR8-LABEL: dpConv2udw_x:
810; CHECK-PWR8:       # %bb.0: # %entry
811; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
812; CHECK-PWR8-NEXT:    sldi 3, 5, 3
813; CHECK-PWR8-NEXT:    xscvdpuxds 0, 0
814; CHECK-PWR8-NEXT:    stxsdx 0, 4, 3
815; CHECK-PWR8-NEXT:    blr
816                          i32 zeroext %idx) {
817entry:
818  %0 = load double, double* %a, align 8
819  %conv = fptoui double %0 to i64
820  %idxprom = zext i32 %idx to i64
821  %arrayidx = getelementptr inbounds i64, i64* %b, i64 %idxprom
822  store i64 %conv, i64* %arrayidx, align 8
823  ret void
824
825
826}
827
828; Function Attrs: norecurse nounwind
829define void @dpConv2uw_x(double* nocapture readonly %a, i32* nocapture %b,
830; CHECK-LABEL: dpConv2uw_x:
831; CHECK:       # %bb.0: # %entry
832; CHECK-NEXT:    lfd 0, 0(3)
833; CHECK-NEXT:    sldi 3, 5, 2
834; CHECK-NEXT:    xscvdpuxws 0, 0
835; CHECK-NEXT:    stfiwx 0, 4, 3
836; CHECK-NEXT:    blr
837;
838; CHECK-PWR8-LABEL: dpConv2uw_x:
839; CHECK-PWR8:       # %bb.0: # %entry
840; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
841; CHECK-PWR8-NEXT:    sldi 3, 5, 2
842; CHECK-PWR8-NEXT:    xscvdpuxws 0, 0
843; CHECK-PWR8-NEXT:    stfiwx 0, 4, 3
844; CHECK-PWR8-NEXT:    blr
845                          i32 zeroext %idx) {
846entry:
847  %0 = load double, double* %a, align 8
848  %conv = fptoui double %0 to i32
849  %idxprom = zext i32 %idx to i64
850  %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
851  store i32 %conv, i32* %arrayidx, align 4
852  ret void
853
854
855}
856
857; Function Attrs: norecurse nounwind
858define void @dpConv2uhw_x(double* nocapture readonly %a, i16* nocapture %b,
859; CHECK-LABEL: dpConv2uhw_x:
860; CHECK:       # %bb.0: # %entry
861; CHECK-NEXT:    lfd 0, 0(3)
862; CHECK-NEXT:    sldi 3, 5, 1
863; CHECK-NEXT:    xscvdpuxws 0, 0
864; CHECK-NEXT:    stxsihx 0, 4, 3
865; CHECK-NEXT:    blr
866;
867; CHECK-PWR8-LABEL: dpConv2uhw_x:
868; CHECK-PWR8:       # %bb.0: # %entry
869; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
870; CHECK-PWR8-NEXT:    sldi 5, 5, 1
871; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
872; CHECK-PWR8-NEXT:    mffprwz 3, 0
873; CHECK-PWR8-NEXT:    sthx 3, 4, 5
874; CHECK-PWR8-NEXT:    blr
875                          i32 zeroext %idx) {
876entry:
877  %0 = load double, double* %a, align 8
878  %conv = fptoui double %0 to i16
879  %idxprom = zext i32 %idx to i64
880  %arrayidx = getelementptr inbounds i16, i16* %b, i64 %idxprom
881  store i16 %conv, i16* %arrayidx, align 2
882  ret void
883
884
885}
886
887; Function Attrs: norecurse nounwind
888define void @dpConv2ub_x(double* nocapture readonly %a, i8* nocapture %b,
889; CHECK-LABEL: dpConv2ub_x:
890; CHECK:       # %bb.0: # %entry
891; CHECK-NEXT:    lfd 0, 0(3)
892; CHECK-NEXT:    xscvdpuxws 0, 0
893; CHECK-NEXT:    stxsibx 0, 4, 5
894; CHECK-NEXT:    blr
895;
896; CHECK-PWR8-LABEL: dpConv2ub_x:
897; CHECK-PWR8:       # %bb.0: # %entry
898; CHECK-PWR8-NEXT:    lfdx 0, 0, 3
899; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
900; CHECK-PWR8-NEXT:    mffprwz 3, 0
901; CHECK-PWR8-NEXT:    stbx 3, 4, 5
902; CHECK-PWR8-NEXT:    blr
903                          i32 zeroext %idx) {
904entry:
905  %0 = load double, double* %a, align 8
906  %conv = fptoui double %0 to i8
907  %idxprom = zext i32 %idx to i64
908  %arrayidx = getelementptr inbounds i8, i8* %b, i64 %idxprom
909  store i8 %conv, i8* %arrayidx, align 1
910  ret void
911
912
913}
914
915; Function Attrs: norecurse nounwind
916define void @spConv2udw_x(float* nocapture readonly %a, i64* nocapture %b,
917; CHECK-LABEL: spConv2udw_x:
918; CHECK:       # %bb.0: # %entry
919; CHECK-NEXT:    lfs 0, 0(3)
920; CHECK-NEXT:    xscvdpuxds 0, 0
921; CHECK-NEXT:    sldi 5, 5, 3
922; CHECK-NEXT:    stxsdx 0, 4, 5
923; CHECK-NEXT:    blr
924;
925; CHECK-PWR8-LABEL: spConv2udw_x:
926; CHECK-PWR8:       # %bb.0: # %entry
927; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
928; CHECK-PWR8-NEXT:    sldi 3, 5, 3
929; CHECK-PWR8-NEXT:    xscvdpuxds 0, 0
930; CHECK-PWR8-NEXT:    stxsdx 0, 4, 3
931; CHECK-PWR8-NEXT:    blr
932                          i32 zeroext %idx) {
933entry:
934  %0 = load float, float* %a, align 4
935  %conv = fptoui float %0 to i64
936  %idxprom = zext i32 %idx to i64
937  %arrayidx = getelementptr inbounds i64, i64* %b, i64 %idxprom
938  store i64 %conv, i64* %arrayidx, align 8
939  ret void
940
941
942}
943
944; Function Attrs: norecurse nounwind
945define void @spConv2uw_x(float* nocapture readonly %a, i32* nocapture %b,
946; CHECK-LABEL: spConv2uw_x:
947; CHECK:       # %bb.0: # %entry
948; CHECK-NEXT:    lfs 0, 0(3)
949; CHECK-NEXT:    xscvdpuxws 0, 0
950; CHECK-NEXT:    sldi 5, 5, 2
951; CHECK-NEXT:    stfiwx 0, 4, 5
952; CHECK-NEXT:    blr
953;
954; CHECK-PWR8-LABEL: spConv2uw_x:
955; CHECK-PWR8:       # %bb.0: # %entry
956; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
957; CHECK-PWR8-NEXT:    sldi 3, 5, 2
958; CHECK-PWR8-NEXT:    xscvdpuxws 0, 0
959; CHECK-PWR8-NEXT:    stfiwx 0, 4, 3
960; CHECK-PWR8-NEXT:    blr
961                          i32 zeroext %idx) {
962entry:
963  %0 = load float, float* %a, align 4
964  %conv = fptoui float %0 to i32
965  %idxprom = zext i32 %idx to i64
966  %arrayidx = getelementptr inbounds i32, i32* %b, i64 %idxprom
967  store i32 %conv, i32* %arrayidx, align 4
968  ret void
969
970
971}
972
973; Function Attrs: norecurse nounwind
974define void @spConv2uhw_x(float* nocapture readonly %a, i16* nocapture %b,
975; CHECK-LABEL: spConv2uhw_x:
976; CHECK:       # %bb.0: # %entry
977; CHECK-NEXT:    lfs 0, 0(3)
978; CHECK-NEXT:    xscvdpuxws 0, 0
979; CHECK-NEXT:    sldi 5, 5, 1
980; CHECK-NEXT:    stxsihx 0, 4, 5
981; CHECK-NEXT:    blr
982;
983; CHECK-PWR8-LABEL: spConv2uhw_x:
984; CHECK-PWR8:       # %bb.0: # %entry
985; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
986; CHECK-PWR8-NEXT:    sldi 5, 5, 1
987; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
988; CHECK-PWR8-NEXT:    mffprwz 3, 0
989; CHECK-PWR8-NEXT:    sthx 3, 4, 5
990; CHECK-PWR8-NEXT:    blr
991                          i32 zeroext %idx) {
992entry:
993  %0 = load float, float* %a, align 4
994  %conv = fptoui float %0 to i16
995  %idxprom = zext i32 %idx to i64
996  %arrayidx = getelementptr inbounds i16, i16* %b, i64 %idxprom
997  store i16 %conv, i16* %arrayidx, align 2
998  ret void
999
1000
1001}
1002
1003; Function Attrs: norecurse nounwind
1004define void @spConv2ub_x(float* nocapture readonly %a, i8* nocapture %b,
1005; CHECK-LABEL: spConv2ub_x:
1006; CHECK:       # %bb.0: # %entry
1007; CHECK-NEXT:    lfs 0, 0(3)
1008; CHECK-NEXT:    xscvdpuxws 0, 0
1009; CHECK-NEXT:    stxsibx 0, 4, 5
1010; CHECK-NEXT:    blr
1011;
1012; CHECK-PWR8-LABEL: spConv2ub_x:
1013; CHECK-PWR8:       # %bb.0: # %entry
1014; CHECK-PWR8-NEXT:    lfsx 0, 0, 3
1015; CHECK-PWR8-NEXT:    xscvdpsxws 0, 0
1016; CHECK-PWR8-NEXT:    mffprwz 3, 0
1017; CHECK-PWR8-NEXT:    stbx 3, 4, 5
1018; CHECK-PWR8-NEXT:    blr
1019                          i32 zeroext %idx) {
1020entry:
1021  %0 = load float, float* %a, align 4
1022  %conv = fptoui float %0 to i8
1023  %idxprom = zext i32 %idx to i64
1024  %arrayidx = getelementptr inbounds i8, i8* %b, i64 %idxprom
1025  store i8 %conv, i8* %arrayidx, align 1
1026  ret void
1027
1028
1029}
1030