forked from OSchip/llvm-project
[AArch64][RegisterBankInfo] Teach instruction mapping about gpr32 -> fpr16 cross copies
Turns out this copies can actually occur because of the way we lower the ABI for half. llvm-svn: 318586
This commit is contained in:
parent
8dc0e1095f
commit
91801f68aa
|
@ -72,10 +72,11 @@ RegisterBankInfo::ValueMapping AArch64GenRegisterBankInfo::ValMappings[]{
|
||||||
{&AArch64GenRegisterBankInfo::PartMappings[PMI_GPR64 - PMI_Min], 1},
|
{&AArch64GenRegisterBankInfo::PartMappings[PMI_GPR64 - PMI_Min], 1},
|
||||||
{&AArch64GenRegisterBankInfo::PartMappings[PMI_GPR64 - PMI_Min], 1},
|
{&AArch64GenRegisterBankInfo::PartMappings[PMI_GPR64 - PMI_Min], 1},
|
||||||
// Cross register bank copies.
|
// Cross register bank copies.
|
||||||
// 25: FPR 16-bit value to GPR 16-bit (invalid). <-- This must match
|
// 25: FPR 16-bit value to GPR 16-bit. <-- This must match
|
||||||
// FirstCrossRegCpyIdx.
|
// FirstCrossRegCpyIdx.
|
||||||
{nullptr, 1},
|
// Note: This is the kind of copy we see with physical registers.
|
||||||
{nullptr, 1},
|
{&AArch64GenRegisterBankInfo::PartMappings[PMI_FPR16 - PMI_Min], 1},
|
||||||
|
{&AArch64GenRegisterBankInfo::PartMappings[PMI_GPR32 - PMI_Min], 1},
|
||||||
// 27: FPR 32-bit value to GPR 32-bit value.
|
// 27: FPR 32-bit value to GPR 32-bit value.
|
||||||
{&AArch64GenRegisterBankInfo::PartMappings[PMI_FPR32 - PMI_Min], 1},
|
{&AArch64GenRegisterBankInfo::PartMappings[PMI_FPR32 - PMI_Min], 1},
|
||||||
{&AArch64GenRegisterBankInfo::PartMappings[PMI_GPR32 - PMI_Min], 1},
|
{&AArch64GenRegisterBankInfo::PartMappings[PMI_GPR32 - PMI_Min], 1},
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
define void @bitcast_s128() { ret void }
|
define void @bitcast_s128() { ret void }
|
||||||
define void @copy_s128() { ret void }
|
define void @copy_s128() { ret void }
|
||||||
define void @copy_s128_from_load() { ret void }
|
define void @copy_s128_from_load() { ret void }
|
||||||
|
define void @copy_fp16() { ret void }
|
||||||
|
|
||||||
define i64 @greedyWithChainOfComputation(i64 %arg1, <2 x i32>* %addr) {
|
define i64 @greedyWithChainOfComputation(i64 %arg1, <2 x i32>* %addr) {
|
||||||
%varg1 = bitcast i64 %arg1 to <2 x i32>
|
%varg1 = bitcast i64 %arg1 to <2 x i32>
|
||||||
|
@ -624,6 +625,34 @@ body: |
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
---
|
||||||
|
# CHECK-LABEL: name: copy_fp16
|
||||||
|
# This test checks that we issue the proper mapping
|
||||||
|
# for copy of size == 16 when the destination is a fpr
|
||||||
|
# physical register and the source a gpr.
|
||||||
|
# We used to crash because we thought that mapping couldn't
|
||||||
|
# exist in a copy.
|
||||||
|
name: copy_fp16
|
||||||
|
legalized: true
|
||||||
|
tracksRegLiveness: true
|
||||||
|
registers:
|
||||||
|
- { id: 0, class: _}
|
||||||
|
- { id: 1, class: _}
|
||||||
|
# CHECK: registers:
|
||||||
|
# CHECK: - { id: 0, class: gpr, preferred-register: '' }
|
||||||
|
# CHECK: - { id: 1, class: gpr, preferred-register: '' }
|
||||||
|
# CHECK: %0:gpr(s32) = COPY %w0
|
||||||
|
# CHECK-NEXT: %1:gpr(s16) = G_TRUNC %0(s32)
|
||||||
|
body: |
|
||||||
|
bb.1:
|
||||||
|
liveins: %w0
|
||||||
|
%0(s32) = COPY %w0
|
||||||
|
%1(s16) = G_TRUNC %0(s32)
|
||||||
|
%h0 = COPY %1(s16)
|
||||||
|
RET_ReallyLR implicit %h0
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
# Make sure the greedy mode is able to take advantage of the
|
# Make sure the greedy mode is able to take advantage of the
|
||||||
|
|
Loading…
Reference in New Issue