[PATCH] D59323: [AArch64][GlobalISel] Gardening: Simplify subregister copy in selectBuildVector
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 13 16:30:04 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL356107: [AArch64][GlobalISel] Gardening: Simplify subregister copy in selectBuildVector (authored by paquette, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D59323?vs=190492&id=190539#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59323/new/
https://reviews.llvm.org/D59323
Files:
llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
Index: llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
+++ llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
@@ -2383,28 +2383,24 @@
// If DstTy's size in bits is less than 128, then emit a subregister copy
// from DstVec to the last register we've defined.
if (DstSize < 128) {
- unsigned SubReg = 0;
-
- // Helper lambda to decide on a register class and subregister for the
- // subregister copy.
- auto GetRegInfoForCopy = [&SubReg,
- &DstSize]() -> const TargetRegisterClass * {
- switch (DstSize) {
- default:
- LLVM_DEBUG(dbgs() << "Unknown destination size (" << DstSize << ")\n");
- return nullptr;
- case 32:
- SubReg = AArch64::ssub;
- return &AArch64::FPR32RegClass;
- case 64:
- SubReg = AArch64::dsub;
- return &AArch64::FPR64RegClass;
- }
- };
-
- const TargetRegisterClass *RC = GetRegInfoForCopy();
+ // Force this to be FPR using the destination vector.
+ const TargetRegisterClass *RC =
+ getMinClassForRegBank(*RBI.getRegBank(DstVec, MRI, TRI), DstSize);
if (!RC)
return false;
+ if (RC != &AArch64::FPR32RegClass && RC != &AArch64::FPR64RegClass) {
+ LLVM_DEBUG(dbgs() << "Unsupported register class!\n");
+ return false;
+ }
+
+ unsigned SubReg = 0;
+ if (!getSubRegForClass(RC, TRI, SubReg))
+ return false;
+ if (SubReg != AArch64::ssub && SubReg != AArch64::dsub) {
+ LLVM_DEBUG(dbgs() << "Unsupported destination size! (" << DstSize
+ << "\n");
+ return false;
+ }
unsigned Reg = MRI.createVirtualRegister(RC);
unsigned DstReg = I.getOperand(0).getReg();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59323.190539.patch
Type: text/x-patch
Size: 1864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190313/191cf2a0/attachment.bin>
More information about the llvm-commits
mailing list