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