1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu -ppc-vsr-nums-as-vr \
3 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s
4 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64-unknown-linux-gnu -ppc-vsr-nums-as-vr \
5 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s --check-prefix=CHECK-BE
7 @Globi = external global i32, align 4
8 @Globf = external global float, align 4
10 define <2 x i64> @test1(i64 %a, i64 %b) {
12 ; CHECK: # %bb.0: # %entry
13 ; CHECK-NEXT: mtvsrdd v2, r4, r3
16 ; CHECK-BE-LABEL: test1:
17 ; CHECK-BE: # %bb.0: # %entry
18 ; CHECK-BE-NEXT: mtvsrdd v2, r3, r4
22 ; The FIXME below is due to the lowering for BUILD_VECTOR needing a re-vamp
23 ; which will happen in a subsequent patch.
24 %vecins = insertelement <2 x i64> undef, i64 %a, i32 0
25 %vecins1 = insertelement <2 x i64> %vecins, i64 %b, i32 1
26 ret <2 x i64> %vecins1
29 define i64 @test2(<2 x i64> %a) {
31 ; CHECK: # %bb.0: # %entry
32 ; CHECK-NEXT: mfvsrld r3, v2
35 ; CHECK-BE-LABEL: test2:
36 ; CHECK-BE: # %bb.0: # %entry
37 ; CHECK-BE-NEXT: mfvsrd r3, v2
41 %0 = extractelement <2 x i64> %a, i32 0
45 define i64 @test3(<2 x i64> %a) {
47 ; CHECK: # %bb.0: # %entry
48 ; CHECK-NEXT: mfvsrd r3, v2
51 ; CHECK-BE-LABEL: test3:
52 ; CHECK-BE: # %bb.0: # %entry
53 ; CHECK-BE-NEXT: mfvsrld r3, v2
57 %0 = extractelement <2 x i64> %a, i32 1
61 define <4 x i32> @test4(i32* nocapture readonly %in) {
63 ; CHECK: # %bb.0: # %entry
64 ; CHECK-NEXT: lfiwzx f0, 0, r3
65 ; CHECK-NEXT: xxpermdi vs0, f0, f0, 2
66 ; CHECK-NEXT: xxspltw v2, vs0, 3
69 ; CHECK-BE-LABEL: test4:
70 ; CHECK-BE: # %bb.0: # %entry
71 ; CHECK-BE-NEXT: lfiwzx f0, 0, r3
72 ; CHECK-BE-NEXT: xxsldwi vs0, f0, f0, 1
73 ; CHECK-BE-NEXT: xxspltw v2, vs0, 0
77 %0 = load i32, i32* %in, align 4
78 %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0
79 %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
80 ret <4 x i32> %splat.splat
83 define <4 x float> @test5(float* nocapture readonly %in) {
85 ; CHECK: # %bb.0: # %entry
86 ; CHECK-NEXT: lfiwzx f0, 0, r3
87 ; CHECK-NEXT: xxpermdi vs0, f0, f0, 2
88 ; CHECK-NEXT: xxspltw v2, vs0, 3
91 ; CHECK-BE-LABEL: test5:
92 ; CHECK-BE: # %bb.0: # %entry
93 ; CHECK-BE-NEXT: lfiwzx f0, 0, r3
94 ; CHECK-BE-NEXT: xxsldwi vs0, f0, f0, 1
95 ; CHECK-BE-NEXT: xxspltw v2, vs0, 0
99 %0 = load float, float* %in, align 4
100 %splat.splatinsert = insertelement <4 x float> undef, float %0, i32 0
101 %splat.splat = shufflevector <4 x float> %splat.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
102 ret <4 x float> %splat.splat
105 define <4 x i32> @test6() {
106 ; CHECK-LABEL: test6:
107 ; CHECK: # %bb.0: # %entry
108 ; CHECK-NEXT: addis r3, r2, .LC0@toc@ha
109 ; CHECK-NEXT: ld r3, .LC0@toc@l(r3)
110 ; CHECK-NEXT: lfiwzx f0, 0, r3
111 ; CHECK-NEXT: xxpermdi vs0, f0, f0, 2
112 ; CHECK-NEXT: xxspltw v2, vs0, 3
115 ; CHECK-BE-LABEL: test6:
116 ; CHECK-BE: # %bb.0: # %entry
117 ; CHECK-BE-NEXT: addis r3, r2, .LC0@toc@ha
118 ; CHECK-BE-NEXT: ld r3, .LC0@toc@l(r3)
119 ; CHECK-BE-NEXT: lfiwzx f0, 0, r3
120 ; CHECK-BE-NEXT: xxsldwi vs0, f0, f0, 1
121 ; CHECK-BE-NEXT: xxspltw v2, vs0, 0
125 %0 = load i32, i32* @Globi, align 4
126 %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0
127 %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
128 ret <4 x i32> %splat.splat
131 define <4 x float> @test7() {
132 ; CHECK-LABEL: test7:
133 ; CHECK: # %bb.0: # %entry
134 ; CHECK-NEXT: addis r3, r2, .LC1@toc@ha
135 ; CHECK-NEXT: ld r3, .LC1@toc@l(r3)
136 ; CHECK-NEXT: lfiwzx f0, 0, r3
137 ; CHECK-NEXT: xxpermdi vs0, f0, f0, 2
138 ; CHECK-NEXT: xxspltw v2, vs0, 3
141 ; CHECK-BE-LABEL: test7:
142 ; CHECK-BE: # %bb.0: # %entry
143 ; CHECK-BE-NEXT: addis r3, r2, .LC1@toc@ha
144 ; CHECK-BE-NEXT: ld r3, .LC1@toc@l(r3)
145 ; CHECK-BE-NEXT: lfiwzx f0, 0, r3
146 ; CHECK-BE-NEXT: xxsldwi vs0, f0, f0, 1
147 ; CHECK-BE-NEXT: xxspltw v2, vs0, 0
151 %0 = load float, float* @Globf, align 4
152 %splat.splatinsert = insertelement <4 x float> undef, float %0, i32 0
153 %splat.splat = shufflevector <4 x float> %splat.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
154 ret <4 x float> %splat.splat
157 define <16 x i8> @test8() {
158 ; CHECK-LABEL: test8:
159 ; CHECK: # %bb.0: # %entry
160 ; CHECK-NEXT: xxlxor v2, v2, v2
163 ; CHECK-BE-LABEL: test8:
164 ; CHECK-BE: # %bb.0: # %entry
165 ; CHECK-BE-NEXT: xxlxor v2, v2, v2
169 ret <16 x i8> zeroinitializer
172 define <16 x i8> @test9() {
173 ; CHECK-LABEL: test9:
174 ; CHECK: # %bb.0: # %entry
175 ; CHECK-NEXT: xxspltib v2, 1
178 ; CHECK-BE-LABEL: test9:
179 ; CHECK-BE: # %bb.0: # %entry
180 ; CHECK-BE-NEXT: xxspltib v2, 1
184 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>
187 define <16 x i8> @test10() {
188 ; CHECK-LABEL: test10:
189 ; CHECK: # %bb.0: # %entry
190 ; CHECK-NEXT: xxspltib v2, 127
193 ; CHECK-BE-LABEL: test10:
194 ; CHECK-BE: # %bb.0: # %entry
195 ; CHECK-BE-NEXT: xxspltib v2, 127
199 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>
202 define <16 x i8> @test11() {
203 ; CHECK-LABEL: test11:
204 ; CHECK: # %bb.0: # %entry
205 ; CHECK-NEXT: xxspltib v2, 128
208 ; CHECK-BE-LABEL: test11:
209 ; CHECK-BE: # %bb.0: # %entry
210 ; CHECK-BE-NEXT: xxspltib v2, 128
214 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>
217 define <16 x i8> @test12() {
218 ; CHECK-LABEL: test12:
219 ; CHECK: # %bb.0: # %entry
220 ; CHECK-NEXT: xxleqv v2, v2, v2
223 ; CHECK-BE-LABEL: test12:
224 ; CHECK-BE: # %bb.0: # %entry
225 ; CHECK-BE-NEXT: xxleqv v2, v2, v2
229 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>
232 define <16 x i8> @test13() {
233 ; CHECK-LABEL: test13:
234 ; CHECK: # %bb.0: # %entry
235 ; CHECK-NEXT: xxspltib v2, 129
238 ; CHECK-BE-LABEL: test13:
239 ; CHECK-BE: # %bb.0: # %entry
240 ; CHECK-BE-NEXT: xxspltib v2, 129
244 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>
247 define <16 x i8> @test13E127() {
248 ; CHECK-LABEL: test13E127:
249 ; CHECK: # %bb.0: # %entry
250 ; CHECK-NEXT: xxspltib v2, 200
253 ; CHECK-BE-LABEL: test13E127:
254 ; CHECK-BE: # %bb.0: # %entry
255 ; CHECK-BE-NEXT: xxspltib v2, 200
259 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>
262 define <4 x i32> @test14(<4 x i32> %a, i32* nocapture readonly %b) {
263 ; CHECK-LABEL: test14:
264 ; CHECK: # %bb.0: # %entry
265 ; CHECK-NEXT: lwz r3, 0(r5)
266 ; CHECK-NEXT: mtvsrws v2, r3
267 ; CHECK-NEXT: addi r3, r3, 5
268 ; CHECK-NEXT: stw r3, 0(r5)
271 ; CHECK-BE-LABEL: test14:
272 ; CHECK-BE: # %bb.0: # %entry
273 ; CHECK-BE-NEXT: lwz r3, 0(r5)
274 ; CHECK-BE-NEXT: mtvsrws v2, r3
275 ; CHECK-BE-NEXT: addi r3, r3, 5
276 ; CHECK-BE-NEXT: stw r3, 0(r5)
280 %0 = load i32, i32* %b, align 4
281 %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0
282 %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
284 store i32 %1, i32* %b, align 4
285 ret <4 x i32> %splat.splat