Debian Codegraph @

llvm/test/CodeGen/PowerPC/p10-splatImm.ll

raw
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
3 ; RUN: -ppc-asm-full-reg-names -mcpu=pwr10 < %s | FileCheck %s
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
5 ; RUN: -ppc-asm-full-reg-names -mcpu=pwr10 < %s | FileCheck %s
6
7 define dso_local <4 x i32> @testZero() local_unnamed_addr {
8 ; CHECK-LABEL: testZero:
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: xxlxor vs34, vs34, vs34
11 ; CHECK-NEXT: blr
12
13 entry:
14 ret <4 x i32> zeroinitializer
15 }
16
17 define dso_local <4 x float> @testZeroF() local_unnamed_addr {
18 ; CHECK-LABEL: testZeroF:
19 ; CHECK: # %bb.0: # %entry
20 ; CHECK-NEXT: xxlxor vs34, vs34, vs34
21 ; CHECK-NEXT: blr
22
23 entry:
24 ret <4 x float> zeroinitializer
25 }
26
27 define dso_local <4 x i32> @testAllOneS() local_unnamed_addr {
28 ; CHECK-LABEL: testAllOneS:
29 ; CHECK: # %bb.0: # %entry
30 ; CHECK-NEXT: xxleqv vs34, vs34, vs34
31 ; CHECK-NEXT: blr
32
33 entry:
34 ret <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
35 }
36
37 define dso_local <4 x i32> @test5Bit() local_unnamed_addr {
38 ; CHECK-LABEL: test5Bit:
39 ; CHECK: # %bb.0: # %entry
40 ; CHECK-NEXT: vspltisw v2, 7
41 ; CHECK-NEXT: blr
42
43 entry:
44 ret <4 x i32> <i32 7, i32 7, i32 7, i32 7>
45 }
46
47 define dso_local <16 x i8> @test1ByteChar() local_unnamed_addr {
48 ; CHECK-LABEL: test1ByteChar:
49 ; CHECK: # %bb.0: # %entry
50 ; CHECK-NEXT: xxspltib vs34, 7
51 ; CHECK-NEXT: blr
52
53 entry:
54 ret <16 x i8> <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
55 }
56
57 define dso_local <4 x i32> @test1ByteSplatInt() local_unnamed_addr {
58 ; Here the splat of 171 or 0xABABABAB can be done using a byte splat
59 ; of 0xAB using xxspltib while avoiding the use of xxspltiw.
60 ; CHECK-LABEL: test1ByteSplatInt:
61 ; CHECK: # %bb.0: # %entry
62 ; CHECK-NEXT: xxspltib vs34, 171
63 ; CHECK-NEXT: blr
64
65 entry:
66 ret <4 x i32> <i32 -1414812757, i32 -1414812757, i32 -1414812757, i32 -1414812757>
67 }
68
69 define dso_local <4 x i32> @test5Bit2Ins() local_unnamed_addr {
70 ; Splats within the range [-32,31] can be done using two vsplti[bhw]
71 ; instructions, but we prefer the xxspltiw instruction to them.
72 ; CHECK-LABEL: test5Bit2Ins:
73 ; CHECK: # %bb.0: # %entry
74 ; CHECK-NEXT: xxspltiw vs34, 16
75 ; CHECK-NEXT: blr
76
77 entry:
78 ret <4 x i32> <i32 16, i32 16, i32 16, i32 16>
79 }
80
81 define dso_local <4 x float> @testFloatNegZero() local_unnamed_addr {
82 ; 0.0f is not the same as -0.0f. We try to splat -0.0f
83 ; CHECK-LABEL: testFloatNegZero:
84 ; CHECK: # %bb.0: # %entry
85 ; CHECK-NEXT: xxspltiw vs34, -2147483648
86 ; CHECK-NEXT: blr
87
88 entry:
89 ret <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>
90 }
91
92 define dso_local <4 x float> @testFloat() local_unnamed_addr {
93 ; CHECK-LABEL: testFloat:
94 ; CHECK: # %bb.0: # %entry
95 ; CHECK-NEXT: xxspltiw vs34, 1135323709
96 ; CHECK-NEXT: blr
97
98 entry:
99 ret <4 x float> <float 0x40757547A0000000, float 0x40757547A0000000, float 0x40757547A0000000, float 0x40757547A0000000>
100 }
101
102 define dso_local <4 x float> @testIntToFloat() local_unnamed_addr {
103 ; CHECK-LABEL: testIntToFloat:
104 ; CHECK: # %bb.0: # %entry
105 ; CHECK-NEXT: xxspltiw vs34, 1135312896
106 ; CHECK-NEXT: blr
107
108 entry:
109 ret <4 x float> <float 3.430000e+02, float 3.430000e+02, float 3.430000e+02, float 3.430000e+02>
110 }
111
112 define dso_local <4 x i32> @testUndefInt() local_unnamed_addr {
113 ; CHECK-LABEL: testUndefInt:
114 ; CHECK: # %bb.0: # %entry
115 ; CHECK-NEXT: xxspltiw vs34, 18
116 ; CHECK-NEXT: blr
117
118 entry:
119 ret <4 x i32> <i32 18, i32 undef, i32 undef, i32 18>
120 }
121
122 define dso_local <4 x float> @testUndefIntToFloat() local_unnamed_addr {
123 ; CHECK-LABEL: testUndefIntToFloat:
124 ; CHECK: # %bb.0: # %entry
125 ; CHECK-NEXT: xxspltiw vs34, 1135312896
126 ; CHECK-NEXT: blr
127
128 entry:
129 ret <4 x float> <float 3.430000e+02, float undef, float undef, float 3.430000e+02>
130 }
131
132 define dso_local <2 x i64> @testPseudo8Byte() local_unnamed_addr {
133 ; CHECK-LABEL: testPseudo8Byte:
134 ; CHECK: # %bb.0: # %entry
135 ; CHECK-NEXT: xxspltiw vs34, -1430532899
136 ; CHECK-NEXT: blr
137
138 entry:
139 ret <2 x i64> <i64 -6144092014192636707, i64 -6144092014192636707>
140 }
141
142 define dso_local <8 x i16> @test2Byte() local_unnamed_addr {
143 ; CHECK-LABEL: test2Byte:
144 ; CHECK: # %bb.0: # %entry
145 ; CHECK-NEXT: xxspltiw vs34, 1179666
146 ; CHECK-NEXT: blr
147
148 entry:
149 ret <8 x i16> <i16 18, i16 18, i16 18, i16 18, i16 18, i16 18, i16 18, i16 18>
150 }
151
152 define dso_local <8 x i16> @test2ByteUndef() local_unnamed_addr {
153 ; CHECK-LABEL: test2ByteUndef:
154 ; CHECK: # %bb.0: # %entry
155 ; CHECK-NEXT: xxspltiw vs34, 1179666
156 ; CHECK-NEXT: blr
157
158 entry:
159 ret <8 x i16> <i16 18, i16 undef, i16 18, i16 18, i16 18, i16 undef, i16 18, i16 18>
160 }
161
162 define dso_local <2 x double> @testFloatToDouble() local_unnamed_addr {
163 ; CHECK-LABEL: testFloatToDouble:
164 ; CHECK: # %bb.0: # %entry
165 ; CHECK-NEXT: xxspltidp vs34, 1135290941
166 ; CHECK-NEXT: blr
167
168 entry:
169 ret <2 x double> <double 0x40756547A0000000, double 0x40756547A0000000>
170 }
171
172 define dso_local <2 x double> @testDoubleLower4ByteZero() local_unnamed_addr {
173 ; The expanded double will have 0 in the last 32 bits. Imprecise handling of
174 ; return value of data structures like APInt, returned when calling getZextValue
175 ; , like saving the return value into an unsigned instead of uint64_t may cause
176 ; this test to fail.
177 ; CHECK-LABEL: testDoubleLower4ByteZero:
178 ; CHECK: # %bb.0: # %entry
179 ; CHECK-NEXT: xxspltidp vs34, 1093664768
180 ; CHECK-NEXT: blr
181
182 entry:
183 ret <2 x double> <double 1.100000e+01, double 1.100000e+01>
184 }
185
186 define dso_local <2 x double> @testDoubleToDoubleZero() local_unnamed_addr {
187 ; Should be using canonicalized form to splat zero and use shorter instructions
188 ; than xxspltidp.
189 ; CHECK-LABEL: testDoubleToDoubleZero:
190 ; CHECK: # %bb.0: # %entry
191 ; CHECK-NEXT: xxlxor vs34, vs34, vs34
192 ; CHECK-NEXT: blr
193
194 entry:
195 ret <2 x double> zeroinitializer
196 }
197
198 define dso_local <2 x double> @testDoubleToDoubleNegZero() local_unnamed_addr {
199 ; CHECK-LABEL: testDoubleToDoubleNegZero:
200 ; CHECK: # %bb.0: # %entry
201 ; CHECK-NEXT: xxspltidp vs34, -2147483648
202 ; CHECK-NEXT: blr
203
204 entry:
205 ret <2 x double> <double -0.000000e+00, double -0.000000e+00>
206 }
207
208 define dso_local <2 x double> @testDoubleToDoubleNaN() local_unnamed_addr {
209 ; CHECK-LABEL: testDoubleToDoubleNaN:
210 ; CHECK: # %bb.0: # %entry
211 ; CHECK-NEXT: xxspltidp vs34, -16
212 ; CHECK-NEXT: blr
213
214 entry:
215 ret <2 x double> <double 0xFFFFFFFE00000000, double 0xFFFFFFFE00000000>
216 }
217
218 define dso_local <2 x double> @testDoubleToDoubleInfinity() local_unnamed_addr {
219 ; CHECK-LABEL: testDoubleToDoubleInfinity:
220 ; CHECK: # %bb.0: # %entry
221 ; CHECK-NEXT: xxspltidp vs34, 2139095040
222 ; CHECK-NEXT: blr
223
224 entry:
225 ret <2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>
226 }
227
228 define dso_local <2 x double> @testFloatToDoubleNaN() local_unnamed_addr {
229 ; CHECK-LABEL: testFloatToDoubleNaN:
230 ; CHECK: # %bb.0: # %entry
231 ; CHECK-NEXT: xxspltidp vs34, -1
232 ; CHECK-NEXT: blr
233
234 entry:
235 ret <2 x double> <double 0xFFFFFFFFE0000000, double 0xFFFFFFFFE0000000>
236 }
237
238 define dso_local <2 x double> @testFloatToDoubleInfinity() local_unnamed_addr {
239 ; CHECK-LABEL: testFloatToDoubleInfinity:
240 ; CHECK: # %bb.0: # %entry
241 ; CHECK-NEXT: xxspltidp vs34, 2139095040
242 ; CHECK-NEXT: blr
243
244 entry:
245 ret <2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>
246 }
247
248 define dso_local float @testFloatScalar() local_unnamed_addr {
249 ; CHECK-LABEL: testFloatScalar:
250 ; CHECK: # %bb.0: # %entry
251 ; CHECK-NEXT: xxspltidp vs1, 1135290941
252 ; CHECK-NEXT: blr
253
254 entry:
255 ret float 0x40756547A0000000
256 }
257
258 define dso_local float @testFloatZeroScalar() local_unnamed_addr {
259 ; CHECK-LABEL: testFloatZeroScalar:
260 ; CHECK: # %bb.0: # %entry
261 ; CHECK-NEXT: xxlxor f1, f1, f1
262 ; CHECK-NEXT: blr
263
264 entry:
265 ret float 0.000000e+00
266 }
267
268 define dso_local double @testDoubleRepresentableScalar() local_unnamed_addr {
269 ; CHECK-LABEL: testDoubleRepresentableScalar:
270 ; CHECK: # %bb.0: # %entry
271 ; CHECK-NEXT: xxspltidp vs1, 1135290941
272 ; CHECK-NEXT: blr
273
274 entry:
275 ret double 0x40756547A0000000
276 }
277
278 define dso_local double @testDoubleZeroScalar() local_unnamed_addr {
279 ; CHECK-LABEL: testDoubleZeroScalar:
280 ; CHECK: # %bb.0: # %entry
281 ; CHECK-NEXT: xxlxor f1, f1, f1
282 ; CHECK-NEXT: blr
283
284 entry:
285 ret double 0.000000e+00
286 }
287
288 define dso_local <4 x i32> @vec_splati() local_unnamed_addr {
289 ; CHECK-LABEL: vec_splati:
290 ; CHECK: # %bb.0: # %entry
291 ; CHECK-NEXT: xxspltiw vs34, -17
292 ; CHECK-NEXT: blr
293 entry:
294 ret <4 x i32> <i32 -17, i32 -17, i32 -17, i32 -17>
295 }
296
297 define dso_local <2 x double> @vec_splatid() local_unnamed_addr {
298 ; CHECK-LABEL: vec_splatid:
299 ; CHECK: # %bb.0: # %entry
300 ; CHECK-NEXT: xxspltidp vs34, 1065353216
301 ; CHECK-NEXT: blr
302 entry:
303 ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
304 }