]> granicus.if.org Git - llvm/commitdiff
[AArch64][RegisterBankInfo] Switch to fully static opds mapping for G_BITCAST.
authorQuentin Colombet <qcolombet@apple.com>
Thu, 13 Oct 2016 18:46:38 +0000 (18:46 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Thu, 13 Oct 2016 18:46:38 +0000 (18:46 +0000)
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284146 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64RegisterBankInfo.cpp

index 04a2083e1b7fdea6af1b1839c0d918b6e4944e86..962c4c79ae2c02d3ce9f24d4988d56e9cf1c26f9 100644 (file)
@@ -477,10 +477,16 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
   case TargetOpcode::G_BITCAST: {
     LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
     LLT SrcTy = MRI.getType(MI.getOperand(1).getReg());
-    // If we are on the same bank, we can use the "same kind" mapping.
-    if (DstTy.isVector() == SrcTy.isVector())
-      return getSameKindOfOperandsMapping(MI);
-    break;
+    unsigned Size = DstTy.getSizeInBits();
+    bool DstIsGPR = !DstTy.isVector();
+    bool SrcIsGPR = !SrcTy.isVector();
+    const RegisterBank &DstRB =
+        DstIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
+    const RegisterBank &SrcRB =
+        SrcIsGPR ? AArch64::GPRRegBank : AArch64::FPRRegBank;
+    return InstructionMapping{DefaultMappingID, copyCost(DstRB, SrcRB, Size),
+                              AArch64::getCopyMapping(DstIsGPR, SrcIsGPR, Size),
+                              /*NumOperands*/ 2};
   }
   default:
     break;