Debian Codegraph @

llvm/test/CodeGen/PowerPC/lxvkq-vec-constant.ll

raw
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2
3 ; RUN: llc -verify-machineinstrs -mcpu=pwr10 -mtriple=powerpc64le-unknown-unknown \
4 ; RUN: -ppc-asm-full-reg-names --ppc-vsr-nums-as-vr < %s | FileCheck %s --check-prefix=POWERPC64-LE-10
5
6 ; RUN: llc -verify-machineinstrs -mcpu=pwr10 -mtriple=powerpc64-unknown-unknown \
7 ; RUN: -ppc-asm-full-reg-names --ppc-vsr-nums-as-vr < %s | FileCheck %s --check-prefix=POWERPC64-BE-10
8
9 ; Test LXVKQ instruction generation for special vector constants matching 128 bit patterns:
10 ; 0x8000_0000_0000_0000_0000_0000_0000_0000 (MSB set pattern)
11 ; 0x0000_0000_0000_0000_0000_0000_0000_0001 (LSB set pattern)
12
13 ; =============================================================================
14 ; v2i64 tests - MSB set pattern (0x8000_0000_0000_0000_0000_0000_0000_0000)
15 ; =============================================================================
16
17 ; Big-Endian: 0x8000_0000_0000_0000_0000_0000_0000_0000 represents <-9223372036854775808, 0>
18 define dso_local noundef <2 x i64> @test_v2i64_msb_set_bigendian() local_unnamed_addr {
19 ; POWERPC64-LE-10-LABEL: test_v2i64_msb_set_bigendian:
20 ; POWERPC64-LE-10: # %bb.0: # %entry
21 ; POWERPC64-LE-10-NEXT: plxv v2, .LCPI0_0@PCREL(0), 1
22 ; POWERPC64-LE-10-NEXT: blr
23 ;
24 ; POWERPC64-BE-10-LABEL: test_v2i64_msb_set_bigendian:
25 ; POWERPC64-BE-10: # %bb.0: # %entry
26 ; POWERPC64-BE-10-NEXT: lxvkq v2, 16
27 ; POWERPC64-BE-10-NEXT: blr
28 entry:
29 ret <2 x i64> <i64 -9223372036854775808, i64 0>
30 }
31
32 ; Little-Endian: 0x8000_0000_0000_0000_0000_0000_0000_0000 represents <0, -9223372036854775808>
33 define dso_local noundef <2 x i64> @test_v2i64_msb_set_littleendian() local_unnamed_addr {
34 ; POWERPC64-LE-10-LABEL: test_v2i64_msb_set_littleendian:
35 ; POWERPC64-LE-10: # %bb.0: # %entry
36 ; POWERPC64-LE-10-NEXT: lxvkq v2, 16
37 ; POWERPC64-LE-10-NEXT: blr
38 ;
39 ; POWERPC64-BE-10-LABEL: test_v2i64_msb_set_littleendian:
40 ; POWERPC64-BE-10: # %bb.0: # %entry
41 ; POWERPC64-BE-10-NEXT: addis r3, r2, .LCPI1_0@toc@ha
42 ; POWERPC64-BE-10-NEXT: addi r3, r3, .LCPI1_0@toc@l
43 ; POWERPC64-BE-10-NEXT: lxv v2, 0(r3)
44 ; POWERPC64-BE-10-NEXT: blr
45 entry:
46 ret <2 x i64> <i64 0, i64 -9223372036854775808>
47 }
48
49 ; =============================================================================
50 ; v4i32 tests - MSB set pattern (0x8000_0000_0000_0000_0000_0000_0000_0000)
51 ; =============================================================================
52
53 ; Big-Endian: 0x8000_0000_0000_0000_0000_0000_0000_0000 represents <-2147483648, 0, 0, 0>
54 define dso_local noundef <4 x i32> @test_v4i32_msb_set_bigendian() local_unnamed_addr {
55 ; POWERPC64-LE-10-LABEL: test_v4i32_msb_set_bigendian:
56 ; POWERPC64-LE-10: # %bb.0: # %entry
57 ; POWERPC64-LE-10-NEXT: plxv v2, .LCPI2_0@PCREL(0), 1
58 ; POWERPC64-LE-10-NEXT: blr
59 ;
60 ; POWERPC64-BE-10-LABEL: test_v4i32_msb_set_bigendian:
61 ; POWERPC64-BE-10: # %bb.0: # %entry
62 ; POWERPC64-BE-10-NEXT: lxvkq v2, 16
63 ; POWERPC64-BE-10-NEXT: blr
64 entry:
65 ret <4 x i32> <i32 -2147483648, i32 0, i32 0, i32 0>
66 }
67
68 ; Little-Endian: 0x8000_0000_0000_0000_0000_0000_0000_0000 represents <0, 0, 0, -2147483648>
69 define dso_local noundef <4 x i32> @test_v4i32_msb_set_littleendian() local_unnamed_addr {
70 ; POWERPC64-LE-10-LABEL: test_v4i32_msb_set_littleendian:
71 ; POWERPC64-LE-10: # %bb.0: # %entry
72 ; POWERPC64-LE-10-NEXT: lxvkq v2, 16
73 ; POWERPC64-LE-10-NEXT: blr
74 ;
75 ; POWERPC64-BE-10-LABEL: test_v4i32_msb_set_littleendian:
76 ; POWERPC64-BE-10: # %bb.0: # %entry
77 ; POWERPC64-BE-10-NEXT: addis r3, r2, .LCPI3_0@toc@ha
78 ; POWERPC64-BE-10-NEXT: addi r3, r3, .LCPI3_0@toc@l
79 ; POWERPC64-BE-10-NEXT: lxv v2, 0(r3)
80 ; POWERPC64-BE-10-NEXT: blr
81 entry:
82 ret <4 x i32> <i32 0, i32 0, i32 0, i32 -2147483648>
83 }
84
85 ; =============================================================================
86 ; v8i16 tests - MSB set pattern (0x8000_0000_0000_0000_0000_0000_0000_0000)
87 ; =============================================================================
88
89 ; Big-Endian: 0x8000_0000_0000_0000_0000_0000_0000_0000 represents <-32768, 0, 0, 0, 0, 0, 0, 0>
90 define dso_local noundef <8 x i16> @test_v8i16_msb_set_bigendian() local_unnamed_addr {
91 ; POWERPC64-LE-10-LABEL: test_v8i16_msb_set_bigendian:
92 ; POWERPC64-LE-10: # %bb.0: # %entry
93 ; POWERPC64-LE-10-NEXT: plxv v2, .LCPI4_0@PCREL(0), 1
94 ; POWERPC64-LE-10-NEXT: blr
95 ;
96 ; POWERPC64-BE-10-LABEL: test_v8i16_msb_set_bigendian:
97 ; POWERPC64-BE-10: # %bb.0: # %entry
98 ; POWERPC64-BE-10-NEXT: lxvkq v2, 16
99 ; POWERPC64-BE-10-NEXT: blr
100 entry:
101 ret <8 x i16> <i16 -32768, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
102 }
103
104 ; Little-Endian: 0x8000_0000_0000_0000_0000_0000_0000_0000 represents <0, 0, 0, 0, 0, 0, 0, -32768>
105 define dso_local noundef <8 x i16> @test_v8i16_msb_set_littleendian() local_unnamed_addr {
106 ; POWERPC64-LE-10-LABEL: test_v8i16_msb_set_littleendian:
107 ; POWERPC64-LE-10: # %bb.0: # %entry
108 ; POWERPC64-LE-10-NEXT: lxvkq v2, 16
109 ; POWERPC64-LE-10-NEXT: blr
110 ;
111 ; POWERPC64-BE-10-LABEL: test_v8i16_msb_set_littleendian:
112 ; POWERPC64-BE-10: # %bb.0: # %entry
113 ; POWERPC64-BE-10-NEXT: addis r3, r2, .LCPI5_0@toc@ha
114 ; POWERPC64-BE-10-NEXT: addi r3, r3, .LCPI5_0@toc@l
115 ; POWERPC64-BE-10-NEXT: lxv v2, 0(r3)
116 ; POWERPC64-BE-10-NEXT: blr
117 entry:
118 ret <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 -32768>
119 }
120
121 ; =============================================================================
122 ; v16i8 tests - MSB set pattern (0x8000_0000_0000_0000_0000_0000_0000_0000)
123 ; =============================================================================
124
125 ; Big-Endian: 0x8000_0000_0000_0000_0000_0000_0000_0000 represents <-128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
126 define dso_local noundef <16 x i8> @test_v16i8_msb_set_bigendian() local_unnamed_addr {
127 ; POWERPC64-LE-10-LABEL: test_v16i8_msb_set_bigendian:
128 ; POWERPC64-LE-10: # %bb.0: # %entry
129 ; POWERPC64-LE-10-NEXT: plxv v2, .LCPI6_0@PCREL(0), 1
130 ; POWERPC64-LE-10-NEXT: blr
131 ;
132 ; POWERPC64-BE-10-LABEL: test_v16i8_msb_set_bigendian:
133 ; POWERPC64-BE-10: # %bb.0: # %entry
134 ; POWERPC64-BE-10-NEXT: lxvkq v2, 16
135 ; POWERPC64-BE-10-NEXT: blr
136 entry:
137 ret <16 x i8> <i8 -128, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>
138 }
139
140 ; Little-Endian: 0x8000_0000_0000_0000_0000_0000_0000_0000 represents <0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -128>
141 define dso_local noundef <16 x i8> @test_v16i8_msb_set_littleendian() local_unnamed_addr {
142 ; POWERPC64-LE-10-LABEL: test_v16i8_msb_set_littleendian:
143 ; POWERPC64-LE-10: # %bb.0: # %entry
144 ; POWERPC64-LE-10-NEXT: lxvkq v2, 16
145 ; POWERPC64-LE-10-NEXT: blr
146 ;
147 ; POWERPC64-BE-10-LABEL: test_v16i8_msb_set_littleendian:
148 ; POWERPC64-BE-10: # %bb.0: # %entry
149 ; POWERPC64-BE-10-NEXT: addis r3, r2, .LCPI7_0@toc@ha
150 ; POWERPC64-BE-10-NEXT: addi r3, r3, .LCPI7_0@toc@l
151 ; POWERPC64-BE-10-NEXT: lxv v2, 0(r3)
152 ; POWERPC64-BE-10-NEXT: blr
153 entry:
154 ret <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 -128>
155 }
156
157 ; =============================================================================
158 ; v2i64 tests - LSB set pattern (0x0000_0000_0000_0000_0000_0000_0000_0001)
159 ; =============================================================================
160
161 ; Big-Endian: 0x0000_0000_0000_0000_0000_0000_0000_0001 represents <0, 1>
162 define dso_local noundef <2 x i64> @test_v2i64_lsb_set_bigendian() local_unnamed_addr {
163 ; POWERPC64-LE-10-LABEL: test_v2i64_lsb_set_bigendian:
164 ; POWERPC64-LE-10: # %bb.0: # %entry
165 ; POWERPC64-LE-10-NEXT: plxv v2, .LCPI8_0@PCREL(0), 1
166 ; POWERPC64-LE-10-NEXT: blr
167 ;
168 ; POWERPC64-BE-10-LABEL: test_v2i64_lsb_set_bigendian:
169 ; POWERPC64-BE-10: # %bb.0: # %entry
170 ; POWERPC64-BE-10-NEXT: xxspltib v2, 255
171 ; POWERPC64-BE-10-NEXT: vsrq v2, v2, v2
172 ; POWERPC64-BE-10-NEXT: blr
173 entry:
174 ret <2 x i64> <i64 0, i64 1>
175 }
176
177 ; Little-Endian: 0x0000_0000_0000_0000_0000_0000_0000_0001 represents <1, 0>
178 define dso_local noundef <2 x i64> @test_v2i64_lsb_set_littleendian() local_unnamed_addr {
179 ; POWERPC64-LE-10-LABEL: test_v2i64_lsb_set_littleendian:
180 ; POWERPC64-LE-10: # %bb.0: # %entry
181 ; POWERPC64-LE-10-NEXT: xxspltib v2, 255
182 ; POWERPC64-LE-10-NEXT: vsrq v2, v2, v2
183 ; POWERPC64-LE-10-NEXT: blr
184 ;
185 ; POWERPC64-BE-10-LABEL: test_v2i64_lsb_set_littleendian:
186 ; POWERPC64-BE-10: # %bb.0: # %entry
187 ; POWERPC64-BE-10-NEXT: addis r3, r2, .LCPI9_0@toc@ha
188 ; POWERPC64-BE-10-NEXT: addi r3, r3, .LCPI9_0@toc@l
189 ; POWERPC64-BE-10-NEXT: lxv v2, 0(r3)
190 ; POWERPC64-BE-10-NEXT: blr
191 entry:
192 ret <2 x i64> <i64 1, i64 0>
193 }
194
195 ; =============================================================================
196 ; v4i32 tests - LSB set pattern (0x0000_0000_0000_0000_0000_0000_0000_0001)
197 ; =============================================================================
198
199 ; Big-Endian: 0x0000_0000_0000_0000_0000_0000_0000_0001 represents <0, 0, 0, 1>
200 define dso_local noundef <4 x i32> @test_v4i32_lsb_set_bigendian() local_unnamed_addr {
201 ; POWERPC64-LE-10-LABEL: test_v4i32_lsb_set_bigendian:
202 ; POWERPC64-LE-10: # %bb.0: # %entry
203 ; POWERPC64-LE-10-NEXT: plxv v2, .LCPI10_0@PCREL(0), 1
204 ; POWERPC64-LE-10-NEXT: blr
205 ;
206 ; POWERPC64-BE-10-LABEL: test_v4i32_lsb_set_bigendian:
207 ; POWERPC64-BE-10: # %bb.0: # %entry
208 ; POWERPC64-BE-10-NEXT: xxspltib v2, 255
209 ; POWERPC64-BE-10-NEXT: vsrq v2, v2, v2
210 ; POWERPC64-BE-10-NEXT: blr
211 entry:
212 ret <4 x i32> <i32 0, i32 0, i32 0, i32 1>
213 }
214
215 ; Little-Endian: 0x0000_0000_0000_0000_0000_0000_0000_0001 represents <1, 0, 0, 0>
216 define dso_local noundef <4 x i32> @test_v4i32_lsb_set_littleendian() local_unnamed_addr {
217 ; POWERPC64-LE-10-LABEL: test_v4i32_lsb_set_littleendian:
218 ; POWERPC64-LE-10: # %bb.0: # %entry
219 ; POWERPC64-LE-10-NEXT: xxspltib v2, 255
220 ; POWERPC64-LE-10-NEXT: vsrq v2, v2, v2
221 ; POWERPC64-LE-10-NEXT: blr
222 ;
223 ; POWERPC64-BE-10-LABEL: test_v4i32_lsb_set_littleendian:
224 ; POWERPC64-BE-10: # %bb.0: # %entry
225 ; POWERPC64-BE-10-NEXT: addis r3, r2, .LCPI11_0@toc@ha
226 ; POWERPC64-BE-10-NEXT: addi r3, r3, .LCPI11_0@toc@l
227 ; POWERPC64-BE-10-NEXT: lxv v2, 0(r3)
228 ; POWERPC64-BE-10-NEXT: blr
229 entry:
230 ret <4 x i32> <i32 1, i32 0, i32 0, i32 0>
231 }
232
233 ; =============================================================================
234 ; v8i16 tests - LSB set pattern (0x0000_0000_0000_0000_0000_0000_0000_0001)
235 ; =============================================================================
236
237 ; Big-Endian: 0x0000_0000_0000_0000_0000_0000_0000_0001 represents <0, 0, 0, 0, 0, 0, 0, 1>
238 define dso_local noundef <8 x i16> @test_v8i16_lsb_set_bigendian() local_unnamed_addr {
239 ; POWERPC64-LE-10-LABEL: test_v8i16_lsb_set_bigendian:
240 ; POWERPC64-LE-10: # %bb.0: # %entry
241 ; POWERPC64-LE-10-NEXT: plxv v2, .LCPI12_0@PCREL(0), 1
242 ; POWERPC64-LE-10-NEXT: blr
243 ;
244 ; POWERPC64-BE-10-LABEL: test_v8i16_lsb_set_bigendian:
245 ; POWERPC64-BE-10: # %bb.0: # %entry
246 ; POWERPC64-BE-10-NEXT: xxspltib v2, 255
247 ; POWERPC64-BE-10-NEXT: vsrq v2, v2, v2
248 ; POWERPC64-BE-10-NEXT: blr
249 entry:
250 ret <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 1>
251 }
252
253 ; Little-Endian: 0x0000_0000_0000_0000_0000_0000_0000_0001 represents <1, 0, 0, 0, 0, 0, 0, 0>
254 define dso_local noundef <8 x i16> @test_v8i16_lsb_set_littleendian() local_unnamed_addr {
255 ; POWERPC64-LE-10-LABEL: test_v8i16_lsb_set_littleendian:
256 ; POWERPC64-LE-10: # %bb.0: # %entry
257 ; POWERPC64-LE-10-NEXT: xxspltib v2, 255
258 ; POWERPC64-LE-10-NEXT: vsrq v2, v2, v2
259 ; POWERPC64-LE-10-NEXT: blr
260 ;
261 ; POWERPC64-BE-10-LABEL: test_v8i16_lsb_set_littleendian:
262 ; POWERPC64-BE-10: # %bb.0: # %entry
263 ; POWERPC64-BE-10-NEXT: addis r3, r2, .LCPI13_0@toc@ha
264 ; POWERPC64-BE-10-NEXT: addi r3, r3, .LCPI13_0@toc@l
265 ; POWERPC64-BE-10-NEXT: lxv v2, 0(r3)
266 ; POWERPC64-BE-10-NEXT: blr
267 entry:
268 ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
269 }
270
271 ; =============================================================================
272 ; v16i8 tests - LSB set pattern (0x0000_0000_0000_0000_0000_0000_0000_0001)
273 ; =============================================================================
274
275 ; Big-Endian: 0x0000_0000_0000_0000_0000_0000_0000_0001 represents <0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1>
276 define dso_local noundef <16 x i8> @test_v16i8_lsb_set_bigendian() local_unnamed_addr {
277 ; POWERPC64-LE-10-LABEL: test_v16i8_lsb_set_bigendian:
278 ; POWERPC64-LE-10: # %bb.0: # %entry
279 ; POWERPC64-LE-10-NEXT: plxv v2, .LCPI14_0@PCREL(0), 1
280 ; POWERPC64-LE-10-NEXT: blr
281 ;
282 ; POWERPC64-BE-10-LABEL: test_v16i8_lsb_set_bigendian:
283 ; POWERPC64-BE-10: # %bb.0: # %entry
284 ; POWERPC64-BE-10-NEXT: xxspltib v2, 255
285 ; POWERPC64-BE-10-NEXT: vsrq v2, v2, v2
286 ; POWERPC64-BE-10-NEXT: blr
287 entry:
288 ret <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 1>
289 }
290
291 ; Little-Endian: 0x0000_0000_0000_0000_0000_0000_0000_0001 represents <1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
292 define dso_local noundef <16 x i8> @test_v16i8_lsb_set_littleendian() local_unnamed_addr {
293 ; POWERPC64-LE-10-LABEL: test_v16i8_lsb_set_littleendian:
294 ; POWERPC64-LE-10: # %bb.0: # %entry
295 ; POWERPC64-LE-10-NEXT: xxspltib v2, 255
296 ; POWERPC64-LE-10-NEXT: vsrq v2, v2, v2
297 ; POWERPC64-LE-10-NEXT: blr
298 ;
299 ; POWERPC64-BE-10-LABEL: test_v16i8_lsb_set_littleendian:
300 ; POWERPC64-BE-10: # %bb.0: # %entry
301 ; POWERPC64-BE-10-NEXT: addis r3, r2, .LCPI15_0@toc@ha
302 ; POWERPC64-BE-10-NEXT: addi r3, r3, .LCPI15_0@toc@l
303 ; POWERPC64-BE-10-NEXT: lxv v2, 0(r3)
304 ; POWERPC64-BE-10-NEXT: blr
305 entry:
306 ret <16 x i8> <i8 1, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>
307 }