1 # RUN: llc -O0 -debugify-and-strip-all-safe -run-pass=regbankselect %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=CHECK --check-prefix=FAST
2 # RUN: llc -O0 -debugify-and-strip-all-safe -run-pass=regbankselect %s -regbankselect-greedy -o - -verify-machineinstrs | FileCheck %s --check-prefix=CHECK --check-prefix=GREEDY
5 ; ModuleID = 'generic-virtual-registers-type-error.mir'
6 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
7 target triple = "aarch64--"
8 define void @defaultMapping() {
12 define void @defaultMappingVector() {
16 define void @defaultMapping1Repair() {
20 define void @defaultMapping2Repairs() {
24 define void @defaultMappingDefRepair() {
28 define void @phiPropagation(ptr %src, ptr %dst, i1 %cond) {
30 %srcVal = load i32, ptr %src
31 br i1 %cond, label %end, label %then
33 %res = add i32 %srcVal, 36
36 %toStore = phi i32 [ %srcVal, %entry ], [ %res, %then ]
37 store i32 %toStore, ptr %dst
40 define void @defaultMappingUseRepairPhysReg() {
44 define void @defaultMappingDefRepairPhysReg() {
48 define void @greedyMappingOr() {
52 define void @greedyMappingOrWithConstraints() {
57 define void @ignoreTargetSpecificInst() { ret void }
59 define void @regBankSelected_property() { ret void }
61 define void @bitcast_s32_gpr() { ret void }
62 define void @bitcast_s32_fpr() { ret void }
63 define void @bitcast_s32_gpr_fpr() { ret void }
64 define void @bitcast_s32_fpr_gpr() { ret void }
65 define void @bitcast_s64_gpr() { ret void }
66 define void @bitcast_s64_fpr() { ret void }
67 define void @bitcast_s64_gpr_fpr() { ret void }
68 define void @bitcast_s64_fpr_gpr() { ret void }
69 define void @bitcast_s128() { ret void }
70 define void @copy_s128() { ret void }
71 define void @copy_s128_from_load() { ret void }
72 define void @copy_fp16() { ret void }
74 define i64 @greedyWithChainOfComputation(i64 %arg1, ptr %addr) {
75 %varg1 = bitcast i64 %arg1 to <2 x i32>
76 %varg2 = load <2 x i32>, ptr %addr
77 %vres = or <2 x i32> %varg1, %varg2
78 %res = bitcast <2 x i32> %vres to i64
82 define i64 @floatingPointLoad(i64 %arg1, ptr %addr) {
83 %varg1 = bitcast i64 %arg1 to double
84 %varg2 = load double, ptr %addr
85 %vres = fadd double %varg1, %varg2
86 %res = bitcast double %vres to i64
90 define void @floatingPointStore(i64 %arg1, ptr %addr) {
91 %varg1 = bitcast i64 %arg1 to double
92 %vres = fadd double %varg1, %varg1
93 store double %vres, ptr %addr
97 define void @fp16Ext32() { ret void }
98 define void @fp16Ext64() { ret void }
99 define void @fp32Ext64() { ret void }
101 define half @passFp16(half %p) {
106 define half @passFp16ViaAllocas(half %p) {
108 %p.addr = alloca half, align 2
109 store half %p, ptr %p.addr, align 2
110 %0 = load half, ptr %p.addr, align 2
116 # Check that we assign a relevant register bank for %0.
117 # Based on the type i32, this should be gpr.
121 - { id: 0, class: _ }
122 - { id: 1, class: _ }
126 ; CHECK-LABEL: name: defaultMapping
127 ; CHECK: %1:gpr(s32) = G_ADD %0
129 %1(s32) = G_ADD %0, %0
133 # Check that we assign a relevant register bank for %0.
134 # Based on the type <2 x i32>, this should be fpr.
135 # FPR is used for both floating point and vector registers.
136 name: defaultMappingVector
139 - { id: 0, class: _ }
140 - { id: 1, class: _ }
144 ; CHECK-LABEL: name: defaultMappingVector
145 ; CHECK: %0:fpr(<2 x s32>) = COPY $d0
146 ; CHECK: %1:fpr(<2 x s32>) = G_ADD %0
147 %0(<2 x s32>) = COPY $d0
148 %1(<2 x s32>) = G_ADD %0, %0
152 # Check that we repair the assignment for %0.
153 # Indeed based on the source of the copy it should live
154 # in FPR, but at the use, it should be GPR.
155 name: defaultMapping1Repair
158 - { id: 0, class: _ }
159 - { id: 1, class: _ }
160 - { id: 2, class: _ }
164 ; CHECK-LABEL: name: defaultMapping1Repair
165 ; CHECK: %0:fpr(s32) = COPY $s0
166 ; CHECK-NEXT: %1:gpr(s32) = COPY $w0
167 ; CHECK-NEXT: %3:gpr(s32) = COPY %0
168 ; CHECK-NEXT: %2:gpr(s32) = G_ADD %3, %1
171 %2(s32) = G_ADD %0, %1
174 # Check that we repair the assignment for %0 differently for both uses.
175 name: defaultMapping2Repairs
178 - { id: 0, class: _ }
179 - { id: 1, class: _ }
183 ; CHECK-LABEL: name: defaultMapping2Repairs
184 ; CHECK: %0:fpr(s32) = COPY $s0
185 ; CHECK-NEXT: %2:gpr(s32) = COPY %0
186 ; CHECK-NEXT: %3:gpr(s32) = COPY %0
187 ; CHECK-NEXT: %1:gpr(s32) = G_ADD %2, %3
189 %1(s32) = G_ADD %0, %0
193 # Check that we repair the definition of %1.
194 # %1 is forced to be into FPR, but its definition actually
195 # requires that it lives in GPR. Make sure regbankselect
197 name: defaultMappingDefRepair
200 - { id: 0, class: _ }
201 - { id: 1, class: fpr }
205 ; CHECK-LABEL: name: defaultMappingDefRepair
206 ; CHECK: %0:gpr(s32) = COPY $w0
207 ; CHECK-NEXT: %2:gpr(s32) = G_ADD %0, %0
208 ; CHECK-NEXT: %1:fpr(s32) = COPY %2
210 %1(s32) = G_ADD %0, %0
214 # Check that we are able to propagate register banks from phis.
217 tracksRegLiveness: true
219 # CHECK-NEXT: - { id: 0, class: gpr32, preferred-register: '' }
220 # CHECK-NEXT: - { id: 1, class: gpr64sp, preferred-register: '' }
221 # CHECK-NEXT: - { id: 2, class: gpr32, preferred-register: '' }
222 # CHECK-NEXT: - { id: 3, class: gpr, preferred-register: '' }
223 # CHECK-NEXT: - { id: 4, class: gpr, preferred-register: '' }
225 - { id: 0, class: gpr32 }
226 - { id: 1, class: gpr64sp }
227 - { id: 2, class: gpr32 }
228 - { id: 3, class: _ }
229 - { id: 4, class: _ }
230 - { id: 5, class: _ }
233 successors: %bb.2.end, %bb.1.then
234 liveins: $x0, $x1, $w2
236 %0 = LDRWui killed $x0, 0 :: (load (s32) from %ir.src)
240 TBNZW killed %2, 0, %bb.2.end
243 successors: %bb.2.end
244 %3(s32) = G_ADD %5, %5
247 %4(s32) = PHI %0, %bb.0.entry, %3, %bb.1.then
248 G_STORE killed %4, killed %1 :: (store (s32) into %ir.dst)
253 # Make sure we can repair physical register uses as well.
254 name: defaultMappingUseRepairPhysReg
257 - { id: 0, class: _ }
258 - { id: 1, class: _ }
259 - { id: 2, class: _ }
263 ; CHECK-LABEL: name: defaultMappingUseRepairPhysReg
264 ; CHECK: %0:gpr(s32) = COPY $w0
265 ; CHECK-NEXT: %1:fpr(s32) = COPY $s0
266 ; CHECK-NEXT: %3:gpr(s32) = COPY %1
267 ; CHECK-NEXT: %2:gpr(s32) = G_ADD %0, %3
270 %2(s32) = G_ADD %0, %1
274 # Make sure we can repair physical register defs.
275 name: defaultMappingDefRepairPhysReg
278 - { id: 0, class: _ }
279 - { id: 1, class: _ }
283 ; CHECK-LABEL: name: defaultMappingDefRepairPhysReg
284 ; CHECK: %0:gpr(s32) = COPY $w0
285 ; CHECK-NEXT: %1:gpr(s32) = G_ADD %0, %0
286 ; CHECK-NEXT: $s0 = COPY %1
288 %1(s32) = G_ADD %0, %0
293 # Check that the greedy mode is able to switch the
294 # G_OR instruction from fpr to gpr.
295 name: greedyMappingOr
298 - { id: 0, class: _ }
299 - { id: 1, class: _ }
300 - { id: 2, class: _ }
304 ; CHECK: %0:gpr(<2 x s32>) = COPY $x0
305 ; CHECK-NEXT: %1:gpr(<2 x s32>) = COPY $x1
307 ; Fast mode tries to reuse the source of the copy for the destination.
308 ; Now, the default mapping says that %0 and %1 need to be in FPR.
309 ; The repairing code insert two copies to materialize that.
310 ; FAST-NEXT: %3:fpr(<2 x s32>) = COPY %0
311 ; FAST-NEXT: %4:fpr(<2 x s32>) = COPY %1
312 ; The mapping of G_OR is on FPR.
313 ; FAST-NEXT: %2:fpr(<2 x s32>) = G_OR %3, %4
315 ; Greedy mode remapped the instruction on the GPR bank.
316 ; GREEDY-NEXT: %2:gpr(<2 x s32>) = G_OR %0, %1
317 %0(<2 x s32>) = COPY $x0
318 %1(<2 x s32>) = COPY $x1
319 %2(<2 x s32>) = G_OR %0, %1
323 # Check that the greedy mode is able to switch the
324 # G_OR instruction from fpr to gpr, while still honoring
326 name: greedyMappingOrWithConstraints
329 - { id: 0, class: _ }
330 - { id: 1, class: _ }
331 - { id: 2, class: fpr }
335 ; CHECK-LABEL: name: greedyMappingOrWithConstraints
337 ; CHECK: %0:gpr(<2 x s32>) = COPY $x0
338 ; CHECK-NEXT: %1:gpr(<2 x s32>) = COPY $x1
340 ; Fast mode tries to reuse the source of the copy for the destination.
341 ; Now, the default mapping says that %0 and %1 need to be in FPR.
342 ; The repairing code insert two copies to materialize that.
343 ; FAST-NEXT: %3:fpr(<2 x s32>) = COPY %0
344 ; FAST-NEXT: %4:fpr(<2 x s32>) = COPY %1
345 ; The mapping of G_OR is on FPR.
346 ; FAST-NEXT: %2:fpr(<2 x s32>) = G_OR %3, %4
348 ; Greedy mode remapped the instruction on the GPR bank.
349 ; GREEDY-NEXT: %3:gpr(<2 x s32>) = G_OR %0, %1
350 ; We need to keep %2 into FPR because we do not know anything about it.
351 ; GREEDY-NEXT: %2:fpr(<2 x s32>) = COPY %3
352 %0(<2 x s32>) = COPY $x0
353 %1(<2 x s32>) = COPY $x1
354 %2(<2 x s32>) = G_OR %0, %1
358 # CHECK-LABEL: name: ignoreTargetSpecificInst
359 name: ignoreTargetSpecificInst
362 # CHECK-NEXT: - { id: 0, class: gpr64, preferred-register: '' }
363 # CHECK-NEXT: - { id: 1, class: gpr64, preferred-register: '' }
365 - { id: 0, class: gpr64 }
366 - { id: 1, class: gpr64 }
371 ; CHECK: %0:gpr64 = COPY $x0
372 ; CHECK-NEXT: %1:gpr64 = ADDXrr %0, %0
373 ; CHECK-NEXT: $x0 = COPY %1
374 ; CHECK-NEXT: RET_ReallyLR implicit $x0
379 RET_ReallyLR implicit $x0
383 # Check that we set the "regBankSelected" property.
384 # CHECK-LABEL: name: regBankSelected_property
385 # CHECK: legalized: true
386 # CHECK: regBankSelected: true
387 name: regBankSelected_property
389 regBankSelected: false
395 # CHECK-LABEL: name: bitcast_s32_gpr
396 name: bitcast_s32_gpr
400 # CHECK-NEXT: - { id: 0, class: gpr, preferred-register: '' }
401 # FAST-NEXT: - { id: 1, class: fpr, preferred-register: '' }
402 # GREEDY-NEXT: - { id: 1, class: gpr, preferred-register: '' }
404 - { id: 0, class: _ }
405 - { id: 1, class: _ }
408 # CHECK: %0:gpr(s32) = COPY $w0
409 # FAST-NEXT: %1:fpr(<4 x s8>) = G_BITCAST %0
410 # GREEDY-NEXT: %1:gpr(<4 x s8>) = G_BITCAST %0
411 # The greedy check is incorrect and should produce fpr.
417 %1(<4 x s8>) = G_BITCAST %0
421 # CHECK-LABEL: name: bitcast_s32_fpr
422 name: bitcast_s32_fpr
426 # CHECK-NEXT: - { id: 0, class: fpr, preferred-register: '' }
427 # FAST-NEXT: - { id: 1, class: gpr, preferred-register: '' }
428 # GREEDY-NEXT: - { id: 1, class: fpr, preferred-register: '' }
430 - { id: 0, class: _ }
431 - { id: 1, class: _ }
434 # CHECK: %0:fpr(<2 x s16>) = COPY $s0
435 # FAST: %1:gpr(s32) = G_BITCAST %0
436 # GREEDY: %1:fpr(s32) = G_BITCAST %0
441 %0(<2 x s16>) = COPY $s0
442 %1(s32) = G_BITCAST %0
446 # CHECK-LABEL: name: bitcast_s32_gpr_fpr
447 name: bitcast_s32_gpr_fpr
451 # CHECK-NEXT: - { id: 0, class: gpr, preferred-register: '' }
452 # FAST-NEXT: - { id: 1, class: fpr, preferred-register: '' }
453 # GREEDY-NEXT: - { id: 1, class: gpr, preferred-register: '' }
455 - { id: 0, class: _ }
456 - { id: 1, class: _ }
459 # CHECK: %0:gpr(s32) = COPY $w0
460 # FAST: %1:fpr(<2 x s16>) = G_BITCAST %0
461 # GREEDY: %1:gpr(<2 x s16>) = G_BITCAST %0
467 %1(<2 x s16>) = G_BITCAST %0
471 # CHECK-LABEL: name: bitcast_s32_fpr_gpr
472 name: bitcast_s32_fpr_gpr
475 - { id: 0, class: _ }
476 - { id: 1, class: _ }
478 # CHECK: %0:fpr(<2 x s16>) = COPY $s0
479 # FAST: %1:gpr(s32) = G_BITCAST %0
480 # GREEDY: %1:fpr(s32) = G_BITCAST %0
485 %0(<2 x s16>) = COPY $s0
486 %1(s32) = G_BITCAST %0
490 # CHECK-LABEL: name: bitcast_s64_gpr
491 name: bitcast_s64_gpr
494 - { id: 0, class: _ }
495 - { id: 1, class: _ }
497 # CHECK: %0:gpr(s64) = COPY $x0
498 # FAST: %1:fpr(<2 x s32>) = G_BITCAST %0
499 # GREEDY: %1:gpr(<2 x s32>) = G_BITCAST %0
505 %1(<2 x s32>) = G_BITCAST %0
509 # CHECK-LABEL: name: bitcast_s64_fpr
510 name: bitcast_s64_fpr
513 - { id: 0, class: _ }
514 - { id: 1, class: _ }
516 # CHECK: %0:fpr(<2 x s32>) = COPY $d0
517 # FAST: %1:gpr(s64) = G_BITCAST %0
518 # GREEDY: %1:fpr(s64) = G_BITCAST %0
523 %0(<2 x s32>) = COPY $d0
524 %1(s64) = G_BITCAST %0
528 # CHECK-LABEL: name: bitcast_s64_gpr_fpr
529 name: bitcast_s64_gpr_fpr
532 - { id: 0, class: _ }
533 - { id: 1, class: _ }
535 # CHECK: %0:gpr(s64) = COPY $x0
536 # FAST: %1:fpr(<2 x s32>) = G_BITCAST %0
537 # GREEDY: %1:gpr(<2 x s32>) = G_BITCAST %0
543 %1(<2 x s32>) = G_BITCAST %0
547 # CHECK-LABEL: name: bitcast_s64_fpr_gpr
548 name: bitcast_s64_fpr_gpr
551 - { id: 0, class: _ }
552 - { id: 1, class: _ }
554 # CHECK: %0:fpr(<2 x s32>) = COPY $d0
555 # FAST: %1:gpr(s64) = G_BITCAST %0
556 # GREEDY: %1:fpr(s64) = G_BITCAST %0
561 %0(<2 x s32>) = COPY $d0
562 %1(s64) = G_BITCAST %0
566 # CHECK-LABEL: name: bitcast_s128
569 tracksRegLiveness: true
575 # CHECK: %3:fpr(s128) = G_MERGE_VALUES
576 # CHECK: %2:fpr(<2 x s64>) = G_BITCAST %3(s128)
582 %3(s128) = G_MERGE_VALUES %0(s64), %1(s64)
583 %2(<2 x s64>) = G_BITCAST %3(s128)
584 $q0 = COPY %2(<2 x s64>)
585 RET_ReallyLR implicit $q0
590 # CHECK-LABEL: name: copy_s128
591 # This test checks that we issue the proper mapping
592 # for copy of size > 64.
593 # The mapping should be the same as G_BITCAST.
596 tracksRegLiveness: true
603 # CHECK: %3:fpr(s128) = G_MERGE_VALUES
604 # CHECK: %4:fpr(s128) = COPY %3(s128)
605 # CHECK-NEXT: %2:fpr(<2 x s64>) = G_BITCAST %4(s128)
611 %3(s128) = G_MERGE_VALUES %0(s64), %1(s64)
612 %4(s128) = COPY %3(s128)
613 %2(<2 x s64>) = G_BITCAST %4(s128)
614 $q0 = COPY %2(<2 x s64>)
615 RET_ReallyLR implicit $q0
620 # CHECK-LABEL: name: copy_s128_from_load
621 # This test checks that we issue the proper mapping
622 # for copy of size > 64 when the input is neither
623 # a physcal register nor a generic register.
624 # This used to crash when we moved to the statically
625 # computed mapping, because we were assuming non-physregs
626 # were generic registers and thus have a type, whereas
627 # it is not necessarily the case.
628 name: copy_s128_from_load
630 tracksRegLiveness: true
632 - { id: 0, class: fpr128}
635 # CHECK: - { id: 0, class: fpr128, preferred-register: '' }
636 # CHECK: - { id: 1, class: fpr, preferred-register: '' }
637 # CHECK: %1:fpr(s128) = COPY %0
641 %0 = LDRQui killed $x0, 0
644 RET_ReallyLR implicit $q0
649 # CHECK-LABEL: name: copy_fp16
650 # This test checks that we issue the proper mapping
651 # for copy of size == 16 when the destination is a fpr
652 # physical register and the source a gpr.
653 # We used to crash because we thought that mapping couldn't
657 tracksRegLiveness: true
662 # CHECK: - { id: 0, class: gpr, preferred-register: '' }
663 # CHECK: - { id: 1, class: gpr, preferred-register: '' }
664 # CHECK: %0:gpr(s32) = COPY $w0
665 # CHECK-NEXT: %1:gpr(s16) = G_TRUNC %0(s32)
670 %1(s16) = G_TRUNC %0(s32)
672 RET_ReallyLR implicit $h0
678 # Make sure the greedy mode is able to take advantage of the
679 # alternative mappings of G_LOAD to coalesce the whole chain
680 # of computation on GPR.
681 # CHECK-LABEL: name: greedyWithChainOfComputation
682 name: greedyWithChainOfComputation
685 - { id: 0, class: _ }
686 - { id: 1, class: _ }
687 - { id: 2, class: _ }
688 - { id: 3, class: _ }
689 - { id: 4, class: _ }
690 - { id: 5, class: _ }
691 # No repairing should be necessary for both modes.
692 # CHECK: %0:gpr(s64) = COPY $x0
693 # CHECK-NEXT: %1:gpr(p0) = COPY $x1
694 # FAST-NEXT: %2:fpr(<2 x s32>) = G_BITCAST %0(s64)
695 # FAST-NEXT: %3:fpr(<2 x s32>) = G_LOAD %1(p0) :: (load (<2 x s32>) from %ir.addr)
696 # FAST-NEXT: %4:fpr(<2 x s32>) = G_OR %2, %3
697 # GREEDY-NEXT: %2:gpr(<2 x s32>) = G_BITCAST %0(s64)
698 # GREEDY-NEXT: %3:gpr(<2 x s32>) = G_LOAD %1(p0) :: (load (<2 x s32>) from %ir.addr)
699 # GREEDY-NEXT: %4:gpr(<2 x s32>) = G_OR %2, %3
700 # CHECK-NEXT: %5:gpr(s64) = G_BITCAST %4(<2 x s32>)
701 # CHECK-NEXT: $x0 = COPY %5(s64)
702 # CHECK-NEXT: RET_ReallyLR implicit $x0
709 %2(<2 x s32>) = G_BITCAST %0(s64)
710 %3(<2 x s32>) = G_LOAD %1(p0) :: (load (<2 x s32>) from %ir.addr)
711 %4(<2 x s32>) = G_OR %2, %3
712 %5(s64) = G_BITCAST %4(<2 x s32>)
714 RET_ReallyLR implicit $x0
719 # Make sure we map what looks like floating point
720 # loads to floating point register bank.
721 # CHECK-LABEL: name: floatingPointLoad
722 name: floatingPointLoad
726 # CHECK-NEXT: - { id: 0, class: gpr, preferred-register: '' }
727 # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' }
728 # CHECK-NEXT: - { id: 2, class: fpr, preferred-register: '' }
729 # CHECK-NEXT: - { id: 3, class: fpr, preferred-register: '' }
730 # CHECK-NEXT: - { id: 4, class: fpr, preferred-register: '' }
732 - { id: 0, class: _ }
733 - { id: 1, class: _ }
734 - { id: 2, class: _ }
735 - { id: 3, class: _ }
737 # No repairing should be necessary for both modes.
738 # CHECK: %0:gpr(s64) = COPY $x0
739 # CHECK-NEXT: %1:gpr(p0) = COPY $x1
740 # CHECK-NEXT: %2:fpr(s64) = G_LOAD %1(p0) :: (load (s64) from %ir.addr)
741 # %0 has been mapped to GPR, we need to repair to match FPR.
742 # CHECK-NEXT: %4:fpr(s64) = COPY %0
743 # CHECK-NEXT: %3:fpr(s64) = G_FADD %4, %2
744 # CHECK-NEXT: $x0 = COPY %3(s64)
745 # CHECK-NEXT: RET_ReallyLR implicit $x0
753 %2(s64) = G_LOAD %1(p0) :: (load (s64) from %ir.addr)
754 %3(s64) = G_FADD %0, %2
756 RET_ReallyLR implicit $x0
761 # Make sure we map what looks like floating point
762 # stores to floating point register bank.
763 # CHECK-LABEL: name: floatingPointStore
764 name: floatingPointStore
768 # CHECK-NEXT: - { id: 0, class: gpr, preferred-register: '' }
769 # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' }
770 # CHECK-NEXT: - { id: 2, class: fpr, preferred-register: '' }
771 # CHECK-NEXT: - { id: 3, class: fpr, preferred-register: '' }
772 # CHECK-NEXT: - { id: 4, class: fpr, preferred-register: '' }
774 - { id: 0, class: _ }
775 - { id: 1, class: _ }
776 - { id: 2, class: _ }
778 # CHECK: %0:gpr(s64) = COPY $x0
779 # CHECK-NEXT: %1:gpr(p0) = COPY $x1
780 # %0 has been mapped to GPR, we need to repair to match FPR.
781 # CHECK-NEXT: %3:fpr(s64) = COPY %0
782 # CHECK-NEXT: %4:fpr(s64) = COPY %0
783 # CHECK-NEXT: %2:fpr(s64) = G_FADD %3, %4
784 # CHECK-NEXT: G_STORE %2(s64), %1(p0) :: (store (s64) into %ir.addr)
785 # CHECK-NEXT: RET_ReallyLR
793 %2(s64) = G_FADD %0, %0
794 G_STORE %2(s64), %1(p0) :: (store (s64) into %ir.addr)
800 # Make sure we map FPEXT on FPR register bank.
801 # CHECK-LABEL: name: fp16Ext32
806 # CHECK-NEXT: - { id: 0, class: gpr, preferred-register: '' }
807 # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' }
808 # CHECK-NEXT: - { id: 2, class: fpr, preferred-register: '' }
809 # CHECK-NEXT: - { id: 3, class: fpr, preferred-register: '' }
811 - { id: 0, class: _ }
812 - { id: 1, class: _ }
813 - { id: 2, class: _ }
814 # CHECK: %1:gpr(s32) = COPY $w0
815 # CHECK-NEXT: %0:gpr(s16) = G_TRUNC %1
816 # %0 has been mapped to GPR, we need to repair to match FPR.
817 # CHECK-NEXT: %3:fpr(s16) = COPY %0
818 # CHECK-NEXT: %2:fpr(s32) = G_FPEXT %3
819 # CHECK-NEXT: $s0 = COPY %2
820 # CHECK-NEXT: RET_ReallyLR
827 %0(s16) = G_TRUNC %1(s32)
828 %2(s32) = G_FPEXT %0(s16)
830 RET_ReallyLR implicit $s0
835 # Make sure we map FPEXT on FPR register bank.
836 # CHECK-LABEL: name: fp16Ext64
841 # CHECK-NEXT: - { id: 0, class: gpr, preferred-register: '' }
842 # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' }
843 # CHECK-NEXT: - { id: 2, class: fpr, preferred-register: '' }
844 # CHECK-NEXT: - { id: 3, class: fpr, preferred-register: '' }
846 - { id: 0, class: _ }
847 - { id: 1, class: _ }
848 - { id: 2, class: _ }
849 # CHECK: %1:gpr(s32) = COPY $w0
850 # CHECK-NEXT: %0:gpr(s16) = G_TRUNC %1
851 # %0 has been mapped to GPR, we need to repair to match FPR.
852 # CHECK-NEXT: %3:fpr(s16) = COPY %0
853 # CHECK-NEXT: %2:fpr(s64) = G_FPEXT %3
854 # CHECK-NEXT: $d0 = COPY %2
855 # CHECK-NEXT: RET_ReallyLR
862 %0(s16) = G_TRUNC %1(s32)
863 %2(s64) = G_FPEXT %0(s16)
865 RET_ReallyLR implicit $d0
870 # Make sure we map FPEXT on FPR register bank.
871 # CHECK-LABEL: name: fp32Ext64
876 # CHECK-NEXT: - { id: 0, class: gpr, preferred-register: '' }
877 # CHECK-NEXT: - { id: 1, class: fpr, preferred-register: '' }
878 # CHECK-NEXT: - { id: 2, class: fpr, preferred-register: '' }
880 - { id: 0, class: _ }
881 - { id: 1, class: _ }
882 # CHECK: %0:gpr(s32) = COPY $w0
883 # %0 has been mapped to GPR, we need to repair to match FPR.
884 # CHECK-NEXT: %2:fpr(s32) = COPY %0
885 # CHECK-NEXT: %1:fpr(s64) = G_FPEXT %2
886 # CHECK-NEXT: $d0 = COPY %1
887 # CHECK-NEXT: RET_ReallyLR
893 %1(s64) = G_FPEXT %0(s32)
895 RET_ReallyLR implicit $d0
900 # Make sure we map FP16 ABI on FPR register bank.
901 # CHECK-LABEL: name: passFp16
903 # CHECK: - { id: 0, class: fpr, preferred-register: '' }
904 # CHECK: %0:fpr(s16) = COPY $h0
905 # CHECK-NEXT: $h0 = COPY %0(s16)
910 - { id: 0, class: _ }
917 RET_ReallyLR implicit $h0
921 # Make sure we properly detect fp types through copies.
922 # In that example, the copy comes from an ABI lowering of a fp type.
923 # CHECK-LABEL: name: passFp16ViaAllocas
925 # CHECK: - { id: 0, class: fpr, preferred-register: '' }
926 # CHECK: - { id: 1, class: gpr, preferred-register: '' }
927 # CHECK: - { id: 2, class: fpr, preferred-register: '' }
929 # CHECK: %0:fpr(s16) = COPY $h0
930 # CHECK-NEXT: %1:gpr(p0) = G_FRAME_INDEX %stack.0.p.addr
931 # If we didn't look through the copy for %0, the default mapping
932 # would have been on GPR and we would have to insert a copy to move
933 # the value away from FPR (h0).
934 # CHECK-NEXT: G_STORE %0(s16), %1(p0) :: (store (s16) into %ir.p.addr)
935 # If we didn't look through the copy for %2, the default mapping
936 # would have been on GPR and we would have to insert a copy to move
937 # the value to FPR (h0).
938 # CHECK-NEXT: %2:fpr(s16) = G_LOAD %1(p0) :: (load (s16) from %ir.p.addr)
939 # CHECK-NEXT: $h0 = COPY %2(s16)
940 name: passFp16ViaAllocas
943 tracksRegLiveness: true
945 - { id: 0, class: _ }
946 - { id: 1, class: _ }
947 - { id: 2, class: _ }
951 - { id: 0, name: p.addr, size: 2, alignment: 2, stack-id: default }
957 %1(p0) = G_FRAME_INDEX %stack.0.p.addr
958 G_STORE %0(s16), %1(p0) :: (store (s16) into %ir.p.addr)
959 %2(s16) = G_LOAD %1(p0) :: (load (s16) from %ir.p.addr)
961 RET_ReallyLR implicit $h0