1; RUN: llc -mcpu=pwr9 -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names \
2; RUN:    -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s --check-prefix=P9LE
3; RUN: llc -mcpu=pwr9 -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names \
4; RUN:    -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=P9BE
5; RUN: llc -mcpu=pwr8 -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names \
6; RUN:    -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s --check-prefix=P8LE
7; RUN: llc -mcpu=pwr8 -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names \
8; RUN:    -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=P8BE
9
10; Function Attrs: norecurse nounwind readonly
11define <2 x i64> @s2v_test1(i32* nocapture readonly %int32, <2 x i64> %vec)  {
12; P9LE-LABEL: s2v_test1:
13; P9LE:       # %bb.0: # %entry
14; P9LE-NEXT:    lfiwax f0, 0, r3
15; P9LE-NEXT:    xxmrghd v2, v2, vs0
16; P9LE-NEXT:    blr
17
18; P9BE-LABEL: s2v_test1:
19; P9BE:       # %bb.0: # %entry
20; P9BE-NEXT:    lfiwax f0, 0, r3
21; P9BE-NEXT:    xxpermdi v2, vs0, v2, 1
22; P9BE-NEXT:    blr
23
24; P8LE-LABEL: s2v_test1:
25; P8LE:       # %bb.0: # %entry
26; P8LE-NEXT:    lfiwax f0, 0, r3
27; P8LE-NEXT:    xxmrghd v2, v2, vs0
28; P8LE-NEXT:    blr
29
30; P8BE-LABEL: s2v_test1:
31; P8BE:       # %bb.0: # %entry
32; P8BE-NEXT:    lfiwax f0, 0, r3
33; P8BE-NEXT:    xxpermdi v2, vs0, v2, 1
34; P8BE-NEXT:    blr
35entry:
36  %0 = load i32, i32* %int32, align 4
37  %conv = sext i32 %0 to i64
38  %vecins = insertelement <2 x i64> %vec, i64 %conv, i32 0
39  ret <2 x i64> %vecins
40}
41
42; Function Attrs: norecurse nounwind readonly
43define <2 x i64> @s2v_test2(i32* nocapture readonly %int32, <2 x i64> %vec)  {
44; P9LE-LABEL: s2v_test2:
45; P9LE:       # %bb.0: # %entry
46; P9LE-NEXT:    addi r3, r3, 4
47; P9LE-NEXT:    lfiwax f0, 0, r3
48; P9LE-NEXT:    xxmrghd v2, v2, vs0
49; P9LE-NEXT:    blr
50
51; P9BE-LABEL: s2v_test2:
52; P9BE:       # %bb.0: # %entry
53; P9BE-NEXT:    addi r3, r3, 4
54; P9BE-NEXT:    lfiwax f0, 0, r3
55; P9BE-NEXT:    xxpermdi v2, vs0, v2, 1
56; P9BE-NEXT:    blr
57
58; P8LE-LABEL: s2v_test2:
59; P8LE:       # %bb.0: # %entry
60; P8LE-NEXT:    addi r3, r3, 4
61; P8LE-NEXT:    lfiwax f0, 0, r3
62; P8LE-NEXT:    xxmrghd v2, v2, vs0
63; P8LE-NEXT:    blr
64
65; P8BE-LABEL: s2v_test2:
66; P8BE:       # %bb.0: # %entry
67; P8BE-NEXT:    addi r3, r3, 4
68; P8BE-NEXT:    lfiwax f0, 0, r3
69; P8BE-NEXT:    xxpermdi v2, vs0, v2, 1
70; P8BE-NEXT:    blr
71entry:
72  %arrayidx = getelementptr inbounds i32, i32* %int32, i64 1
73  %0 = load i32, i32* %arrayidx, align 4
74  %conv = sext i32 %0 to i64
75  %vecins = insertelement <2 x i64> %vec, i64 %conv, i32 0
76  ret <2 x i64> %vecins
77}
78
79; Function Attrs: norecurse nounwind readonly
80define <2 x i64> @s2v_test3(i32* nocapture readonly %int32, <2 x i64> %vec, i32 signext %Idx)  {
81; P9LE-LABEL: s2v_test3:
82; P9LE:       # %bb.0: # %entry
83; P9LE-NEXT:    sldi r4, r7, 2
84; P9LE-NEXT:    lfiwax f0, r3, r4
85; P9LE-NEXT:    xxmrghd v2, v2, vs0
86; P9LE-NEXT:    blr
87
88; P9BE-LABEL: s2v_test3:
89; P9BE:       # %bb.0: # %entry
90; P9BE-NEXT:    sldi r4, r7, 2
91; P9BE-NEXT:    lfiwax f0, r3, r4
92; P9BE-NEXT:    xxpermdi v2, vs0, v2, 1
93; P9BE-NEXT:    blr
94
95; P8LE-LABEL: s2v_test3:
96; P8LE:       # %bb.0: # %entry
97; P8LE-NEXT:    sldi r4, r7, 2
98; P8LE-NEXT:    lfiwax f0, r3, r4
99; P8LE-NEXT:    xxmrghd v2, v2, vs0
100; P8LE-NEXT:    blr
101
102; P8BE-LABEL: s2v_test3:
103; P8BE:       # %bb.0: # %entry
104; P8BE-NEXT:    sldi r4, r7, 2
105; P8BE-NEXT:    lfiwax f0, r3, r4
106; P8BE-NEXT:    xxpermdi v2, vs0, v2, 1
107; P8BE-NEXT:    blr
108entry:
109  %idxprom = sext i32 %Idx to i64
110  %arrayidx = getelementptr inbounds i32, i32* %int32, i64 %idxprom
111  %0 = load i32, i32* %arrayidx, align 4
112  %conv = sext i32 %0 to i64
113  %vecins = insertelement <2 x i64> %vec, i64 %conv, i32 0
114  ret <2 x i64> %vecins
115}
116
117; Function Attrs: norecurse nounwind readonly
118define <2 x i64> @s2v_test4(i32* nocapture readonly %int32, <2 x i64> %vec)  {
119; P9LE-LABEL: s2v_test4:
120; P9LE:       # %bb.0: # %entry
121; P9LE-NEXT:    addi r3, r3, 4
122; P9LE-NEXT:    lfiwax f0, 0, r3
123; P9LE-NEXT:    xxmrghd v2, v2, vs0
124; P9LE-NEXT:    blr
125
126; P9BE-LABEL: s2v_test4:
127; P9BE:       # %bb.0: # %entry
128; P9BE-NEXT:    addi r3, r3, 4
129; P9BE-NEXT:    lfiwax f0, 0, r3
130; P9BE-NEXT:    xxpermdi v2, vs0, v2, 1
131; P9BE-NEXT:    blr
132
133; P8LE-LABEL: s2v_test4:
134; P8LE:       # %bb.0: # %entry
135; P8LE-NEXT:    addi r3, r3, 4
136; P8LE-NEXT:    lfiwax f0, 0, r3
137; P8LE-NEXT:    xxmrghd v2, v2, vs0
138; P8LE-NEXT:    blr
139
140; P8BE-LABEL: s2v_test4:
141; P8BE:       # %bb.0: # %entry
142; P8BE-NEXT:    addi r3, r3, 4
143; P8BE-NEXT:    lfiwax f0, 0, r3
144; P8BE-NEXT:    xxpermdi v2, vs0, v2, 1
145; P8BE-NEXT:    blr
146entry:
147  %arrayidx = getelementptr inbounds i32, i32* %int32, i64 1
148  %0 = load i32, i32* %arrayidx, align 4
149  %conv = sext i32 %0 to i64
150  %vecins = insertelement <2 x i64> %vec, i64 %conv, i32 0
151  ret <2 x i64> %vecins
152}
153
154; Function Attrs: norecurse nounwind readonly
155define <2 x i64> @s2v_test5(<2 x i64> %vec, i32* nocapture readonly %ptr1)  {
156; P9LE-LABEL: s2v_test5:
157; P9LE:       # %bb.0: # %entry
158; P9LE-NEXT:    lfiwax f0, 0, r5
159; P9LE-NEXT:    xxmrghd v2, v2, vs0
160; P9LE-NEXT:    blr
161
162; P9BE-LABEL: s2v_test5:
163; P9BE:       # %bb.0: # %entry
164; P9BE-NEXT:    lfiwax f0, 0, r5
165; P9BE-NEXT:    xxpermdi v2, vs0, v2, 1
166; P9BE-NEXT:    blr
167
168; P8LE-LABEL: s2v_test5:
169; P8LE:       # %bb.0: # %entry
170; P8LE-NEXT:    lfiwax f0, 0, r5
171; P8LE-NEXT:    xxmrghd v2, v2, vs0
172; P8LE-NEXT:    blr
173
174; P8BE-LABEL: s2v_test5:
175; P8BE:       # %bb.0: # %entry
176; P8BE-NEXT:    lfiwax f0, 0, r5
177; P8BE-NEXT:    xxpermdi v2, vs0, v2, 1
178; P8BE-NEXT:    blr
179entry:
180  %0 = load i32, i32* %ptr1, align 4
181  %conv = sext i32 %0 to i64
182  %vecins = insertelement <2 x i64> %vec, i64 %conv, i32 0
183  ret <2 x i64> %vecins
184}
185
186; Function Attrs: norecurse nounwind readonly
187define <2 x i64> @s2v_test6(i32* nocapture readonly %ptr)  {
188; P9LE-LABEL: s2v_test6:
189; P9LE:       # %bb.0: # %entry
190; P9LE-NEXT:    lfiwax f0, 0, r3
191; P9LE-NEXT:    xxspltd v2, vs0, 0
192; P9LE-NEXT:    blr
193
194; P9BE-LABEL: s2v_test6:
195; P9BE:       # %bb.0: # %entry
196; P9BE-NEXT:    lfiwax f0, 0, r3
197; P9BE-NEXT:    xxspltd v2, vs0, 0
198; P9BE-NEXT:    blr
199
200; P8LE-LABEL: s2v_test6:
201; P8LE:       # %bb.0: # %entry
202; P8LE-NEXT:    lfiwax f0, 0, r3
203; P8LE-NEXT:    xxspltd v2, vs0, 0
204; P8LE-NEXT:    blr
205
206; P8BE-LABEL: s2v_test6:
207; P8BE:       # %bb.0: # %entry
208; P8BE-NEXT:    lfiwax f0, 0, r3
209; P8BE-NEXT:    xxspltd v2, vs0, 0
210; P8BE-NEXT:    blr
211entry:
212  %0 = load i32, i32* %ptr, align 4
213  %conv = sext i32 %0 to i64
214  %splat.splatinsert = insertelement <2 x i64> undef, i64 %conv, i32 0
215  %splat.splat = shufflevector <2 x i64> %splat.splatinsert, <2 x i64> undef, <2 x i32> zeroinitializer
216  ret <2 x i64> %splat.splat
217}
218
219; Function Attrs: norecurse nounwind readonly
220define <2 x i64> @s2v_test7(i32* nocapture readonly %ptr)  {
221; P9LE-LABEL: s2v_test7:
222; P9LE:       # %bb.0: # %entry
223; P9LE-NEXT:    lfiwax f0, 0, r3
224; P9LE-NEXT:    xxspltd v2, vs0, 0
225; P9LE-NEXT:    blr
226
227; P9BE-LABEL: s2v_test7:
228; P9BE:       # %bb.0: # %entry
229; P9BE-NEXT:    lfiwax f0, 0, r3
230; P9BE-NEXT:    xxspltd v2, vs0, 0
231; P9BE-NEXT:    blr
232
233; P8LE-LABEL: s2v_test7:
234; P8LE:       # %bb.0: # %entry
235; P8LE-NEXT:    lfiwax f0, 0, r3
236; P8LE-NEXT:    xxspltd v2, vs0, 0
237; P8LE-NEXT:    blr
238
239; P8BE-LABEL: s2v_test7:
240; P8BE:       # %bb.0: # %entry
241; P8BE-NEXT:    lfiwax f0, 0, r3
242; P8BE-NEXT:    xxspltd v2, vs0, 0
243; P8BE-NEXT:    blr
244entry:
245  %0 = load i32, i32* %ptr, align 4
246  %conv = sext i32 %0 to i64
247  %splat.splatinsert = insertelement <2 x i64> undef, i64 %conv, i32 0
248  %splat.splat = shufflevector <2 x i64> %splat.splatinsert, <2 x i64> undef, <2 x i32> zeroinitializer
249  ret <2 x i64> %splat.splat
250}
251
252