Skip to content

Commit 102c9ed

Browse files
committed
[AArch64][GlobalISel] Unmerge into scalars from a vector should use FPR bank.
This currently shows up as a selection fallback since the dest regs were given GPR banks but the source was a vector FPR reg. Differential Revision: https://reviews.llvm.org/D57408 llvm-svn: 352545
1 parent a4c33ec commit 102c9ed

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,11 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
669669
&AArch64::FPRRegBank;
670670
};
671671

672-
if (any_of(MRI.use_instructions(MI.getOperand(0).getReg()),
672+
LLT SrcTy = MRI.getType(MI.getOperand(MI.getNumOperands()-1).getReg());
673+
// UNMERGE into scalars from a vector should always use FPR.
674+
// Likewise if any of the uses are FP instructions.
675+
if (SrcTy.isVector() ||
676+
any_of(MRI.use_instructions(MI.getOperand(0).getReg()),
673677
[&](MachineInstr &MI) { return HasFPConstraints(MI); })) {
674678
// Set the register bank of every operand to FPR.
675679
for (unsigned Idx = 0, NumOperands = MI.getNumOperands();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2+
# RUN: llc -O0 -mtriple arm64-- -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s
3+
---
4+
name: unmerge
5+
alignment: 2
6+
legalized: true
7+
tracksRegLiveness: true
8+
frameInfo:
9+
maxCallFrameSize: 0
10+
body: |
11+
bb.0:
12+
liveins: $q0
13+
14+
; Ensure that the dest regs have FPR since we're unmerging from a vector
15+
; CHECK-LABEL: name: unmerge
16+
; CHECK: liveins: $q0
17+
; CHECK: [[COPY:%[0-9]+]]:fpr(<2 x s64>) = COPY $q0
18+
; CHECK: [[UV:%[0-9]+]]:fpr(s64), [[UV1:%[0-9]+]]:fpr(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
19+
; CHECK: $x0 = COPY [[UV]](s64)
20+
; CHECK: RET_ReallyLR implicit $x0
21+
%0:_(<2 x s64>) = COPY $q0
22+
%1:_(s64), %2:_(s64) = G_UNMERGE_VALUES %0(<2 x s64>)
23+
$x0 = COPY %1(s64)
24+
RET_ReallyLR implicit $x0
25+
26+
...

0 commit comments

Comments
 (0)