[llvm] r352545 - [AArch64][GlobalISel] Unmerge into scalars from a vector should use FPR bank.
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 29 13:19:33 PST 2019
Author: aemerson
Date: Tue Jan 29 13:19:33 2019
New Revision: 352545
URL: http://llvm.org/viewvc/llvm-project?rev=352545&view=rev
Log:
[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
Added:
llvm/trunk/test/CodeGen/AArch64/GlobalISel/regbankselect-unmerge-vec.mir
Modified:
llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp?rev=352545&r1=352544&r2=352545&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp Tue Jan 29 13:19:33 2019
@@ -669,7 +669,11 @@ AArch64RegisterBankInfo::getInstrMapping
&AArch64::FPRRegBank;
};
- if (any_of(MRI.use_instructions(MI.getOperand(0).getReg()),
+ LLT SrcTy = MRI.getType(MI.getOperand(MI.getNumOperands()-1).getReg());
+ // UNMERGE into scalars from a vector should always use FPR.
+ // Likewise if any of the uses are FP instructions.
+ if (SrcTy.isVector() ||
+ any_of(MRI.use_instructions(MI.getOperand(0).getReg()),
[&](MachineInstr &MI) { return HasFPConstraints(MI); })) {
// Set the register bank of every operand to FPR.
for (unsigned Idx = 0, NumOperands = MI.getNumOperands();
Added: llvm/trunk/test/CodeGen/AArch64/GlobalISel/regbankselect-unmerge-vec.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/regbankselect-unmerge-vec.mir?rev=352545&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/regbankselect-unmerge-vec.mir (added)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/regbankselect-unmerge-vec.mir Tue Jan 29 13:19:33 2019
@@ -0,0 +1,26 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -O0 -mtriple arm64-- -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s
+---
+name: unmerge
+alignment: 2
+legalized: true
+tracksRegLiveness: true
+frameInfo:
+ maxCallFrameSize: 0
+body: |
+ bb.0:
+ liveins: $q0
+
+ ; Ensure that the dest regs have FPR since we're unmerging from a vector
+ ; CHECK-LABEL: name: unmerge
+ ; CHECK: liveins: $q0
+ ; CHECK: [[COPY:%[0-9]+]]:fpr(<2 x s64>) = COPY $q0
+ ; CHECK: [[UV:%[0-9]+]]:fpr(s64), [[UV1:%[0-9]+]]:fpr(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
+ ; CHECK: $x0 = COPY [[UV]](s64)
+ ; CHECK: RET_ReallyLR implicit $x0
+ %0:_(<2 x s64>) = COPY $q0
+ %1:_(s64), %2:_(s64) = G_UNMERGE_VALUES %0(<2 x s64>)
+ $x0 = COPY %1(s64)
+ RET_ReallyLR implicit $x0
+
+...
More information about the llvm-commits
mailing list