1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s \
5 ; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \
6 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s \
9 @_ZL13StaticBoolVar = internal unnamed_addr global i8 0, align 1
10 @_ZL19StaticSignedCharVar = internal unnamed_addr global i8 0, align 1
11 @_ZL21StaticUnsignedCharVar = internal unnamed_addr global i8 0, align 1
12 @_ZL20StaticSignedShortVar = internal unnamed_addr global i16 0, align 2
13 @_ZL22StaticUnsignedShortVar = internal unnamed_addr global i16 0, align 2
14 @_ZL18StaticSignedIntVar = internal unnamed_addr global i32 0, align 4
15 @_ZL20StaticUnsignedIntVar = internal unnamed_addr global i32 0, align 4
16 @_ZL19StaticSignedLongVar = internal unnamed_addr global i64 0, align 8
17 @_ZL14StaticFloatVar = internal unnamed_addr global float 0.000000e+00, align 4
18 @_ZL15StaticDoubleVar = internal unnamed_addr global double 0.000000e+00, align 8
19 @_ZL19StaticLongDoubleVar = internal unnamed_addr global ppc_fp128 0xM00000000000000000000000000000000, align 16
20 @_ZL23StaticSigned__Int128Var = internal unnamed_addr global i128 0, align 16
21 @_ZL19Static__Float128Var = internal unnamed_addr global fp128 0xL00000000000000000000000000000000, align 16
22 @_ZL25StaticVectorSignedCharVar = internal unnamed_addr global <16 x i8> zeroinitializer, align 16
23 @_ZL26StaticVectorSignedShortVar = internal unnamed_addr global <8 x i16> zeroinitializer, align 16
24 @_ZL24StaticVectorSignedIntVar = internal unnamed_addr global <4 x i32> zeroinitializer, align 16
25 @_ZL29StaticVectorSignedLongLongVar = internal unnamed_addr global <2 x i64> zeroinitializer, align 16
26 @_ZL29StaticVectorSigned__Int128Var = internal unnamed_addr global <1 x i128> zeroinitializer, align 16
27 @_ZL20StaticVectorFloatVar = internal unnamed_addr global <4 x float> zeroinitializer, align 16
28 @_ZL21StaticVectorDoubleVar = internal unnamed_addr global <2 x double> zeroinitializer, align 16
30 define zeroext i1 @_Z17ReadStaticBoolVarv() {
31 ; CHECK-LABEL: _Z17ReadStaticBoolVarv:
32 ; CHECK: # %bb.0: # %entry
33 ; CHECK-NEXT: plbz r3, _ZL13StaticBoolVar@PCREL(0), 1
36 %0 = load i8, ptr @_ZL13StaticBoolVar, align 1, !range !0, !noundef !{}
37 %tobool = icmp ne i8 %0, 0
41 define signext i8 @_Z23ReadStaticSignedCharVarv() {
42 ; CHECK-LABEL: _Z23ReadStaticSignedCharVarv:
43 ; CHECK: # %bb.0: # %entry
44 ; CHECK-NEXT: plbz r3, _ZL19StaticSignedCharVar@PCREL(0), 1
45 ; CHECK-NEXT: extsb r3, r3
48 %0 = load i8, ptr @_ZL19StaticSignedCharVar, align 1
52 define zeroext i8 @_Z25ReadStaticUnsignedCharVarv() {
53 ; CHECK-LABEL: _Z25ReadStaticUnsignedCharVarv:
54 ; CHECK: # %bb.0: # %entry
55 ; CHECK-NEXT: plbz r3, _ZL21StaticUnsignedCharVar@PCREL(0), 1
58 %0 = load i8, ptr @_ZL21StaticUnsignedCharVar, align 1
62 define signext i16 @_Z24ReadStaticSignedShortVarv() {
63 ; CHECK-LABEL: _Z24ReadStaticSignedShortVarv:
64 ; CHECK: # %bb.0: # %entry
65 ; CHECK-NEXT: plha r3, _ZL20StaticSignedShortVar@PCREL(0), 1
68 %0 = load i16, ptr @_ZL20StaticSignedShortVar, align 2
72 define zeroext i16 @_Z26ReadStaticUnsignedShortVarv() {
73 ; CHECK-LABEL: _Z26ReadStaticUnsignedShortVarv:
74 ; CHECK: # %bb.0: # %entry
75 ; CHECK-NEXT: plhz r3, _ZL22StaticUnsignedShortVar@PCREL(0), 1
78 %0 = load i16, ptr @_ZL22StaticUnsignedShortVar, align 2
82 define signext i32 @_Z22ReadStaticSignedIntVarv() {
83 ; CHECK-LABEL: _Z22ReadStaticSignedIntVarv:
84 ; CHECK: # %bb.0: # %entry
85 ; CHECK-NEXT: plwa r3, _ZL18StaticSignedIntVar@PCREL(0), 1
88 %0 = load i32, ptr @_ZL18StaticSignedIntVar, align 4
92 define zeroext i32 @_Z24ReadStaticUnsignedIntVarv() {
93 ; CHECK-LABEL: _Z24ReadStaticUnsignedIntVarv:
94 ; CHECK: # %bb.0: # %entry
95 ; CHECK-NEXT: plwz r3, _ZL20StaticUnsignedIntVar@PCREL(0), 1
98 %0 = load i32, ptr @_ZL20StaticUnsignedIntVar, align 4
102 ; It is the same as unsigned long version
103 define i64 @_Z23ReadStaticSignedLongVarv() {
104 ; CHECK-LABEL: _Z23ReadStaticSignedLongVarv:
105 ; CHECK: # %bb.0: # %entry
106 ; CHECK-NEXT: pld r3, _ZL19StaticSignedLongVar@PCREL(0), 1
109 %0 = load i64, ptr @_ZL19StaticSignedLongVar, align 8
113 define float @_Z18ReadStaticFloatVarv() {
114 ; CHECK-LABEL: _Z18ReadStaticFloatVarv:
115 ; CHECK: # %bb.0: # %entry
116 ; CHECK-NEXT: plfs f1, _ZL14StaticFloatVar@PCREL(0), 1
119 %0 = load float, ptr @_ZL14StaticFloatVar, align 4
123 define double @_Z19ReadStaticDoubleVarv() {
124 ; CHECK-LABEL: _Z19ReadStaticDoubleVarv:
125 ; CHECK: # %bb.0: # %entry
126 ; CHECK-NEXT: plfd f1, _ZL15StaticDoubleVar@PCREL(0), 1
129 %0 = load double, ptr @_ZL15StaticDoubleVar, align 8
134 define ppc_fp128 @_Z23ReadStaticLongDoubleVarv() {
135 ; CHECK-LABEL: _Z23ReadStaticLongDoubleVarv:
136 ; CHECK: # %bb.0: # %entry
137 ; CHECK-NEXT: plfd f1, _ZL19StaticLongDoubleVar@PCREL(0), 1
138 ; CHECK-NEXT: plfd f2, _ZL19StaticLongDoubleVar@PCREL+8(0), 1
141 %0 = load ppc_fp128, ptr @_ZL19StaticLongDoubleVar, align 16
146 define i128 @_Z27ReadStaticSigned__Int128Varv() {
147 ; CHECK-LABEL: _Z27ReadStaticSigned__Int128Varv:
148 ; CHECK: # %bb.0: # %entry
149 ; CHECK-NEXT: pld r3, _ZL23StaticSigned__Int128Var@PCREL(0), 1
150 ; CHECK-NEXT: pld r4, _ZL23StaticSigned__Int128Var@PCREL+8(0), 1
153 %0 = load i128, ptr @_ZL23StaticSigned__Int128Var, align 16
157 define fp128 @_Z23ReadStatic__Float128Varv() {
158 ; CHECK-LABEL: _Z23ReadStatic__Float128Varv:
159 ; CHECK: # %bb.0: # %entry
160 ; CHECK-NEXT: plxv v2, _ZL19Static__Float128Var@PCREL(0), 1
163 %0 = load fp128, ptr @_ZL19Static__Float128Var, align 16
167 define <16 x i8> @_Z29ReadStaticVectorSignedCharVarv() {
168 ; CHECK-LABEL: _Z29ReadStaticVectorSignedCharVarv:
169 ; CHECK: # %bb.0: # %entry
170 ; CHECK-NEXT: plxv v2, _ZL25StaticVectorSignedCharVar@PCREL(0), 1
173 %0 = load <16 x i8>, ptr @_ZL25StaticVectorSignedCharVar, align 16
177 define <8 x i16> @_Z30ReadStaticVectorSignedShortVarv() {
178 ; CHECK-LABEL: _Z30ReadStaticVectorSignedShortVarv:
179 ; CHECK: # %bb.0: # %entry
180 ; CHECK-NEXT: plxv v2, _ZL26StaticVectorSignedShortVar@PCREL(0), 1
183 %0 = load <8 x i16>, ptr @_ZL26StaticVectorSignedShortVar, align 16
187 define <4 x i32> @_Z28ReadStaticVectorSignedIntVarv() {
188 ; CHECK-LABEL: _Z28ReadStaticVectorSignedIntVarv:
189 ; CHECK: # %bb.0: # %entry
190 ; CHECK-NEXT: plxv v2, _ZL24StaticVectorSignedIntVar@PCREL(0), 1
193 %0 = load <4 x i32>, ptr @_ZL24StaticVectorSignedIntVar, align 16
197 define <2 x i64> @_Z33ReadStaticVectorSignedLongLongVarv() {
198 ; CHECK-LABEL: _Z33ReadStaticVectorSignedLongLongVarv:
199 ; CHECK: # %bb.0: # %entry
200 ; CHECK-NEXT: plxv v2, _ZL29StaticVectorSignedLongLongVar@PCREL(0), 1
203 %0 = load <2 x i64>, ptr @_ZL29StaticVectorSignedLongLongVar, align 16
207 define <1 x i128> @_Z33ReadStaticVectorSigned__Int128Varv() {
208 ; CHECK-LABEL: _Z33ReadStaticVectorSigned__Int128Varv:
209 ; CHECK: # %bb.0: # %entry
210 ; CHECK-NEXT: plxv v2, _ZL29StaticVectorSigned__Int128Var@PCREL(0), 1
213 %0 = load <1 x i128>, ptr @_ZL29StaticVectorSigned__Int128Var, align 16
217 define <4 x float> @_Z24ReadStaticVectorFloatVarv() {
218 ; CHECK-LABEL: _Z24ReadStaticVectorFloatVarv:
219 ; CHECK: # %bb.0: # %entry
220 ; CHECK-NEXT: plxv v2, _ZL20StaticVectorFloatVar@PCREL(0), 1
223 %0 = load <4 x float>, ptr @_ZL20StaticVectorFloatVar, align 16
227 define <2 x double> @_Z25ReadStaticVectorDoubleVarv() {
228 ; CHECK-LABEL: _Z25ReadStaticVectorDoubleVarv:
229 ; CHECK: # %bb.0: # %entry
230 ; CHECK-NEXT: plxv v2, _ZL21StaticVectorDoubleVar@PCREL(0), 1
233 %0 = load <2 x double>, ptr @_ZL21StaticVectorDoubleVar, align 16
239 define void @_Z18WriteStaticBoolVarb(i1 zeroext %val) {
240 ; CHECK-LABEL: _Z18WriteStaticBoolVarb:
241 ; CHECK: # %bb.0: # %entry
242 ; CHECK-NEXT: pstb r3, _ZL13StaticBoolVar@PCREL(0), 1
245 %frombool = zext i1 %val to i8
246 store i8 %frombool, ptr @_ZL13StaticBoolVar, align 1
250 define void @_Z24WriteStaticSignedCharVara(i8 signext %val) {
251 ; CHECK-LABEL: _Z24WriteStaticSignedCharVara:
252 ; CHECK: # %bb.0: # %entry
253 ; CHECK-NEXT: pstb r3, _ZL19StaticSignedCharVar@PCREL(0), 1
256 store i8 %val, ptr @_ZL19StaticSignedCharVar, align 1
260 define void @_Z26WriteStaticUnsignedCharVarh(i8 zeroext %val){
261 ; CHECK-LABEL: _Z26WriteStaticUnsignedCharVarh:
262 ; CHECK: # %bb.0: # %entry
263 ; CHECK-NEXT: pstb r3, _ZL21StaticUnsignedCharVar@PCREL(0), 1
266 store i8 %val, ptr @_ZL21StaticUnsignedCharVar, align 1
270 define void @_Z25WriteStaticSignedShortVars(i16 signext %val) {
271 ; CHECK-LABEL: _Z25WriteStaticSignedShortVars:
272 ; CHECK: # %bb.0: # %entry
273 ; CHECK-NEXT: psth r3, _ZL20StaticSignedShortVar@PCREL(0), 1
276 store i16 %val, ptr @_ZL20StaticSignedShortVar, align 2
280 define void @_Z27WriteStaticUnsignedShortVart(i16 zeroext %val) {
281 ; CHECK-LABEL: _Z27WriteStaticUnsignedShortVart:
282 ; CHECK: # %bb.0: # %entry
283 ; CHECK-NEXT: psth r3, _ZL22StaticUnsignedShortVar@PCREL(0), 1
286 store i16 %val, ptr @_ZL22StaticUnsignedShortVar, align 2
290 define void @_Z23WriteStaticSignedIntVari(i32 signext %val) {
291 ; CHECK-LABEL: _Z23WriteStaticSignedIntVari:
292 ; CHECK: # %bb.0: # %entry
293 ; CHECK-NEXT: pstw r3, _ZL18StaticSignedIntVar@PCREL(0), 1
296 store i32 %val, ptr @_ZL18StaticSignedIntVar, align 4
300 define void @_Z25WriteStaticUnsignedIntVarj(i32 zeroext %val) {
301 ; CHECK-LABEL: _Z25WriteStaticUnsignedIntVarj:
302 ; CHECK: # %bb.0: # %entry
303 ; CHECK-NEXT: pstw r3, _ZL20StaticUnsignedIntVar@PCREL(0), 1
306 store i32 %val, ptr @_ZL20StaticUnsignedIntVar, align 4
310 define void @_Z24WriteStaticSignedLongVarl(i64 %val) {
311 ; CHECK-LABEL: _Z24WriteStaticSignedLongVarl:
312 ; CHECK: # %bb.0: # %entry
313 ; CHECK-NEXT: pstd r3, _ZL19StaticSignedLongVar@PCREL(0), 1
316 store i64 %val, ptr @_ZL19StaticSignedLongVar, align 8
320 define void @_Z19WriteStaticFloatVarf(float %val) {
321 ; CHECK-LABEL: _Z19WriteStaticFloatVarf:
322 ; CHECK: # %bb.0: # %entry
323 ; CHECK-NEXT: pstfs f1, _ZL14StaticFloatVar@PCREL(0), 1
326 store float %val, ptr @_ZL14StaticFloatVar, align 4
330 define void @_Z20WriteStaticDoubleVard(double %val) {
331 ; CHECK-LABEL: _Z20WriteStaticDoubleVard:
332 ; CHECK: # %bb.0: # %entry
333 ; CHECK-NEXT: pstfd f1, _ZL15StaticDoubleVar@PCREL(0), 1
336 store double %val, ptr @_ZL15StaticDoubleVar, align 8
341 define void @_Z24WriteStaticLongDoubleVarg(ppc_fp128 %val) {
342 ; CHECK-LABEL: _Z24WriteStaticLongDoubleVarg:
343 ; CHECK: # %bb.0: # %entry
344 ; CHECK-NEXT: pstfd f2, _ZL19StaticLongDoubleVar@PCREL+8(0), 1
345 ; CHECK-NEXT: pstfd f1, _ZL19StaticLongDoubleVar@PCREL(0), 1
348 store ppc_fp128 %val, ptr @_ZL19StaticLongDoubleVar, align 16
353 define void @_Z28WriteStaticSigned__Int128Varn(i128 %val) {
354 ; CHECK-LABEL: _Z28WriteStaticSigned__Int128Varn:
355 ; CHECK: # %bb.0: # %entry
356 ; CHECK-NEXT: pstd r4, _ZL23StaticSigned__Int128Var@PCREL+8(0), 1
357 ; CHECK-NEXT: pstd r3, _ZL23StaticSigned__Int128Var@PCREL(0), 1
360 store i128 %val, ptr @_ZL23StaticSigned__Int128Var, align 16
364 define void @_Z24WriteStatic__Float128Varu9__ieee128(fp128 %val) {
365 ; CHECK-LABEL: _Z24WriteStatic__Float128Varu9__ieee128:
366 ; CHECK: # %bb.0: # %entry
367 ; CHECK-NEXT: pstxv v2, _ZL19Static__Float128Var@PCREL(0), 1
370 store fp128 %val, ptr @_ZL19Static__Float128Var, align 16
374 define void @_Z30WriteStaticVectorSignedCharVarDv16_a(<16 x i8> %val) {
375 ; CHECK-LABEL: _Z30WriteStaticVectorSignedCharVarDv16_a:
376 ; CHECK: # %bb.0: # %entry
377 ; CHECK-NEXT: pstxv v2, _ZL25StaticVectorSignedCharVar@PCREL(0), 1
380 store <16 x i8> %val, ptr @_ZL25StaticVectorSignedCharVar, align 16
384 define void @_Z31WriteStaticVectorSignedShortVarDv8_s(<8 x i16> %val) {
385 ; CHECK-LABEL: _Z31WriteStaticVectorSignedShortVarDv8_s:
386 ; CHECK: # %bb.0: # %entry
387 ; CHECK-NEXT: pstxv v2, _ZL26StaticVectorSignedShortVar@PCREL(0), 1
390 store <8 x i16> %val, ptr @_ZL26StaticVectorSignedShortVar, align 16
394 define void @_Z29WriteStaticVectorSignedIntVarDv4_i(<4 x i32> %val) {
395 ; CHECK-LABEL: _Z29WriteStaticVectorSignedIntVarDv4_i:
396 ; CHECK: # %bb.0: # %entry
397 ; CHECK-NEXT: pstxv v2, _ZL24StaticVectorSignedIntVar@PCREL(0), 1
400 store <4 x i32> %val, ptr @_ZL24StaticVectorSignedIntVar, align 16
404 define void @_Z34WriteStaticVectorSignedLongLongVarDv2_x(<2 x i64> %val) {
405 ; CHECK-LABEL: _Z34WriteStaticVectorSignedLongLongVarDv2_x:
406 ; CHECK: # %bb.0: # %entry
407 ; CHECK-NEXT: pstxv v2, _ZL29StaticVectorSignedLongLongVar@PCREL(0), 1
410 store <2 x i64> %val, ptr @_ZL29StaticVectorSignedLongLongVar, align 16
414 define void @_Z34WriteStaticVectorSigned__Int128VarDv1_n(<1 x i128> %val) {
415 ; CHECK-LABEL: _Z34WriteStaticVectorSigned__Int128VarDv1_n:
416 ; CHECK: # %bb.0: # %entry
417 ; CHECK-NEXT: pstxv v2, _ZL29StaticVectorSigned__Int128Var@PCREL(0), 1
420 store <1 x i128> %val, ptr @_ZL29StaticVectorSigned__Int128Var, align 16
424 define void @_Z25WriteStaticVectorFloatVarDv4_f(<4 x float> %val) {
425 ; CHECK-LABEL: _Z25WriteStaticVectorFloatVarDv4_f:
426 ; CHECK: # %bb.0: # %entry
427 ; CHECK-NEXT: pstxv v2, _ZL20StaticVectorFloatVar@PCREL(0), 1
430 store <4 x float> %val, ptr @_ZL20StaticVectorFloatVar, align 16
434 define void @_Z26WriteStaticVectorDoubleVarDv2_d(<2 x double> %val) {
435 ; CHECK-LABEL: _Z26WriteStaticVectorDoubleVarDv2_d:
436 ; CHECK: # %bb.0: # %entry
437 ; CHECK-NEXT: pstxv v2, _ZL21StaticVectorDoubleVar@PCREL(0), 1
440 store <2 x double> %val, ptr @_ZL21StaticVectorDoubleVar, align 16
444 @_ZL3ptr = internal unnamed_addr global ptr null, align 8
445 define void @_Z14WriteStaticPtrv() {
446 ; CHECK-LABEL: _Z14WriteStaticPtrv:
447 ; CHECK: # %bb.0: # %entry
448 ; CHECK-NEXT: pld r3, _ZL3ptr@PCREL(0), 1
449 ; CHECK-NEXT: li r4, 3
450 ; CHECK-NEXT: stw r4, 0(r3)
453 %0 = load ptr, ptr @_ZL3ptr, align 8
454 store i32 3, ptr %0, align 4
458 @.str = private unnamed_addr constant [13 x i8] c"Hello World\0A\00", align 1
459 @str = dso_local local_unnamed_addr global ptr @.str, align 8
461 define zeroext i8 @_Z17Char0InStrLiteralv() {
462 ; CHECK-LABEL: _Z17Char0InStrLiteralv:
463 ; CHECK: # %bb.0: # %entry
464 ; CHECK-NEXT: pld r3, str@PCREL(0), 1
465 ; CHECK-NEXT: lbz r3, 0(r3)
468 %0 = load ptr, ptr @str, align 8
469 %1 = load i8, ptr %0, align 1
473 define zeroext i8 @_Z17Char3InStrLiteralv() {
474 ; CHECK-LABEL: _Z17Char3InStrLiteralv:
475 ; CHECK: # %bb.0: # %entry
476 ; CHECK-NEXT: pld r3, str@PCREL(0), 1
477 ; CHECK-NEXT: lbz r3, 3(r3)
480 %0 = load ptr, ptr @str, align 8
481 %arrayidx = getelementptr inbounds i8, ptr %0, i64 3
482 %1 = load i8, ptr %arrayidx, align 1
486 @_ZL5array = internal global [10 x i32] zeroinitializer, align 4
489 define signext i32 @_Z15ReadStaticArrayv() {
490 ; CHECK-LABEL: _Z15ReadStaticArrayv:
491 ; CHECK: # %bb.0: # %entry
492 ; CHECK-NEXT: plwa r3, _ZL5array@PCREL+12(0), 1
495 %0 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @_ZL5array, i64 0, i64 3), align 4
500 define void @_Z16WriteStaticArrayv() {
501 ; CHECK-LABEL: _Z16WriteStaticArrayv:
502 ; CHECK: # %bb.0: # %entry
503 ; CHECK-NEXT: li r3, 5
504 ; CHECK-NEXT: pstw r3, _ZL5array@PCREL+12(0), 1
507 store i32 5, ptr getelementptr inbounds ([10 x i32], ptr @_ZL5array, i64 0, i64 3), align 4
511 %struct.Struct = type { i8, i16, i32 }
514 @_ZL9structure = internal global %struct.Struct zeroinitializer, align 4
515 define signext i32 @_Z16ReadStaticStructv() {
516 ; CHECK-LABEL: _Z16ReadStaticStructv:
517 ; CHECK: # %bb.0: # %entry
518 ; CHECK-NEXT: plwa r3, _ZL9structure@PCREL+4(0), 1
521 %0 = load i32, ptr getelementptr inbounds (%struct.Struct, ptr @_ZL9structure, i64 0, i32 2), align 4
526 define void @_Z17WriteStaticStructv() {
527 ; CHECK-LABEL: _Z17WriteStaticStructv:
528 ; CHECK: # %bb.0: # %entry
529 ; CHECK-NEXT: li r3, 3
530 ; CHECK-NEXT: pstw r3, _ZL9structure@PCREL+4(0), 1
533 store i32 3, ptr getelementptr inbounds (%struct.Struct, ptr @_ZL9structure, i64 0, i32 2), align 4