1 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu -ppc-vsr-nums-as-vr \
2 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s
3 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64-unknown-linux-gnu -ppc-vsr-nums-as-vr \
4 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s --check-prefix=CHECK-BE
6 @Globi = external global i32, align 4
7 @Globf = external global float, align 4
9 define <2 x i64> @test1(i64 %a, i64 %b) {
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: mtvsrdd v2, r4, r3
15 ; CHECK-BE-LABEL: test1:
16 ; CHECK-BE: # %bb.0: # %entry
17 ; CHECK-BE-NEXT: mtvsrdd v2, r3, r4
20 ; The FIXME below is due to the lowering for BUILD_VECTOR needing a re-vamp
21 ; which will happen in a subsequent patch.
22 %vecins = insertelement <2 x i64> undef, i64 %a, i32 0
23 %vecins1 = insertelement <2 x i64> %vecins, i64 %b, i32 1
24 ret <2 x i64> %vecins1
27 define i64 @test2(<2 x i64> %a) {
29 ; CHECK: # %bb.0: # %entry
30 ; CHECK-NEXT: mfvsrld r3, v2
33 ; CHECK-BE-LABEL: test2:
34 ; CHECK-BE: # %bb.0: # %entry
35 ; CHECK-BE-NEXT: mfvsrd r3, v2
38 %0 = extractelement <2 x i64> %a, i32 0
42 define i64 @test3(<2 x i64> %a) {
44 ; CHECK: # %bb.0: # %entry
45 ; CHECK-NEXT: mfvsrd r3, v2
48 ; CHECK-BE-LABEL: test3:
49 ; CHECK-BE: # %bb.0: # %entry
50 ; CHECK-BE-NEXT: mfvsrld r3, v2
53 %0 = extractelement <2 x i64> %a, i32 1
57 define <4 x i32> @test4(i32* nocapture readonly %in) {
59 ; CHECK: # %bb.0: # %entry
60 ; CHECK-NEXT: lfiwzx f0, 0, r3
61 ; CHECK-NEXT: xxpermdi vs0, f0, f0, 2
62 ; CHECK-NEXT: xxspltw v2, vs0, 3
65 ; CHECK-BE-LABEL: test4:
66 ; CHECK-BE: # %bb.0: # %entry
67 ; CHECK-BE-NEXT: lfiwzx f0, 0, r3
68 ; CHECK-BE-NEXT: xxsldwi vs0, f0, f0, 1
69 ; CHECK-BE-NEXT: xxspltw v2, vs0, 0
72 %0 = load i32, i32* %in, align 4
73 %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0
74 %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
75 ret <4 x i32> %splat.splat
78 define <4 x float> @test5(float* nocapture readonly %in) {
80 ; CHECK: # %bb.0: # %entry
81 ; CHECK-NEXT: lfiwzx f0, 0, r3
82 ; CHECK-NEXT: xxpermdi vs0, f0, f0, 2
83 ; CHECK-NEXT: xxspltw v2, vs0, 3
86 ; CHECK-BE-LABEL: test5:
87 ; CHECK-BE: # %bb.0: # %entry
88 ; CHECK-BE-NEXT: lfiwzx f0, 0, r3
89 ; CHECK-BE-NEXT: xxsldwi vs0, f0, f0, 1
90 ; CHECK-BE-NEXT: xxspltw v2, vs0, 0
93 %0 = load float, float* %in, align 4
94 %splat.splatinsert = insertelement <4 x float> undef, float %0, i32 0
95 %splat.splat = shufflevector <4 x float> %splat.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
96 ret <4 x float> %splat.splat
99 define <4 x i32> @test6() {
100 ; CHECK-LABEL: test6:
101 ; CHECK: # %bb.0: # %entry
102 ; CHECK-NEXT: addis r3, r2, .LC0@toc@ha
103 ; CHECK-NEXT: ld r3, .LC0@toc@l(r3)
104 ; CHECK-NEXT: lfiwzx f0, 0, r3
105 ; CHECK-NEXT: xxpermdi vs0, f0, f0, 2
106 ; CHECK-NEXT: xxspltw v2, vs0, 3
109 ; CHECK-BE-LABEL: test6:
110 ; CHECK-BE: # %bb.0: # %entry
111 ; CHECK-BE-NEXT: addis r3, r2, .LC0@toc@ha
112 ; CHECK-BE-NEXT: ld r3, .LC0@toc@l(r3)
113 ; CHECK-BE-NEXT: lfiwzx f0, 0, r3
114 ; CHECK-BE-NEXT: xxsldwi vs0, f0, f0, 1
115 ; CHECK-BE-NEXT: xxspltw v2, vs0, 0
118 %0 = load i32, i32* @Globi, align 4
119 %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0
120 %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
121 ret <4 x i32> %splat.splat
124 define <4 x float> @test7() {
125 ; CHECK-LABEL: test7:
126 ; CHECK: # %bb.0: # %entry
127 ; CHECK-NEXT: addis r3, r2, .LC1@toc@ha
128 ; CHECK-NEXT: ld r3, .LC1@toc@l(r3)
129 ; CHECK-NEXT: lfiwzx f0, 0, r3
130 ; CHECK-NEXT: xxpermdi vs0, f0, f0, 2
131 ; CHECK-NEXT: xxspltw v2, vs0, 3
134 ; CHECK-BE-LABEL: test7:
135 ; CHECK-BE: # %bb.0: # %entry
136 ; CHECK-BE-NEXT: addis r3, r2, .LC1@toc@ha
137 ; CHECK-BE-NEXT: ld r3, .LC1@toc@l(r3)
138 ; CHECK-BE-NEXT: lfiwzx f0, 0, r3
139 ; CHECK-BE-NEXT: xxsldwi vs0, f0, f0, 1
140 ; CHECK-BE-NEXT: xxspltw v2, vs0, 0
143 %0 = load float, float* @Globf, align 4
144 %splat.splatinsert = insertelement <4 x float> undef, float %0, i32 0
145 %splat.splat = shufflevector <4 x float> %splat.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
146 ret <4 x float> %splat.splat
149 define <16 x i8> @test8() {
150 ; CHECK-LABEL: test8:
151 ; CHECK: # %bb.0: # %entry
152 ; CHECK-NEXT: xxlxor v2, v2, v2
155 ; CHECK-BE-LABEL: test8:
156 ; CHECK-BE: # %bb.0: # %entry
157 ; CHECK-BE-NEXT: xxlxor v2, v2, v2
160 ret <16 x i8> zeroinitializer
163 define <16 x i8> @test9() {
164 ; CHECK-LABEL: test9:
165 ; CHECK: # %bb.0: # %entry
166 ; CHECK-NEXT: xxspltib v2, 1
169 ; CHECK-BE-LABEL: test9:
170 ; CHECK-BE: # %bb.0: # %entry
171 ; CHECK-BE-NEXT: xxspltib v2, 1
174 ret <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
177 define <16 x i8> @test10() {
178 ; CHECK-LABEL: test10:
179 ; CHECK: # %bb.0: # %entry
180 ; CHECK-NEXT: xxspltib v2, 127
183 ; CHECK-BE-LABEL: test10:
184 ; CHECK-BE: # %bb.0: # %entry
185 ; CHECK-BE-NEXT: xxspltib v2, 127
188 ret <16 x i8> <i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127>
191 define <16 x i8> @test11() {
192 ; CHECK-LABEL: test11:
193 ; CHECK: # %bb.0: # %entry
194 ; CHECK-NEXT: xxspltib v2, 128
197 ; CHECK-BE-LABEL: test11:
198 ; CHECK-BE: # %bb.0: # %entry
199 ; CHECK-BE-NEXT: xxspltib v2, 128
202 ret <16 x i8> <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
205 define <16 x i8> @test12() {
206 ; CHECK-LABEL: test12:
207 ; CHECK: # %bb.0: # %entry
208 ; CHECK-NEXT: xxspltib v2, 255
211 ; CHECK-BE-LABEL: test12:
212 ; CHECK-BE: # %bb.0: # %entry
213 ; CHECK-BE-NEXT: xxspltib v2, 255
216 ret <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
219 define <16 x i8> @test13() {
220 ; CHECK-LABEL: test13:
221 ; CHECK: # %bb.0: # %entry
222 ; CHECK-NEXT: xxspltib v2, 129
225 ; CHECK-BE-LABEL: test13:
226 ; CHECK-BE: # %bb.0: # %entry
227 ; CHECK-BE-NEXT: xxspltib v2, 129
230 ret <16 x i8> <i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127>
233 define <16 x i8> @test13E127() {
234 ; CHECK-LABEL: test13E127:
235 ; CHECK: # %bb.0: # %entry
236 ; CHECK-NEXT: xxspltib v2, 200
239 ; CHECK-BE-LABEL: test13E127:
240 ; CHECK-BE: # %bb.0: # %entry
241 ; CHECK-BE-NEXT: xxspltib v2, 200
244 ret <16 x i8> <i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200>
247 define <4 x i32> @test14(<4 x i32> %a, i32* nocapture readonly %b) {
248 ; CHECK-LABEL: test14:
249 ; CHECK: # %bb.0: # %entry
250 ; CHECK-NEXT: lwz r3, 0(r5)
251 ; CHECK-NEXT: mtvsrws v2, r3
252 ; CHECK-NEXT: addi r3, r3, 5
253 ; CHECK-NEXT: stw r3, 0(r5)
256 ; CHECK-BE-LABEL: test14:
257 ; CHECK-BE: # %bb.0: # %entry
258 ; CHECK-BE-NEXT: lwz r3, 0(r5)
259 ; CHECK-BE-NEXT: mtvsrws v2, r3
260 ; CHECK-BE-NEXT: addi r3, r3, 5
261 ; CHECK-BE-NEXT: stw r3, 0(r5)
264 %0 = load i32, i32* %b, align 4
265 %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0
266 %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
268 store i32 %1, i32* %b, align 4
269 ret <4 x i32> %splat.splat