[PATCH] D151181: [Mips] Remove isMoveReg=1 from wrdsp and rddsp instructions

Yashwant Singh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 08:50:12 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0f58cfeb9fff: [Mips] Remove isMoveReg=1 from wrdsp and rddsp instructions (authored by yassingh).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151181/new/

https://reviews.llvm.org/D151181

Files:
  llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td
  llvm/lib/Target/Mips/MipsDSPInstrInfo.td
  llvm/lib/Target/Mips/MipsSEInstrInfo.cpp


Index: llvm/lib/Target/Mips/MipsSEInstrInfo.cpp
===================================================================
--- llvm/lib/Target/Mips/MipsSEInstrInfo.cpp
+++ llvm/lib/Target/Mips/MipsSEInstrInfo.cpp
@@ -200,44 +200,14 @@
   return false;
 }
 
-/// If @MI is WRDSP/RRDSP instruction return true with @isWrite set to true
-/// if it is WRDSP instruction.
-static bool isReadOrWriteToDSPReg(const MachineInstr &MI, bool &isWrite) {
-  switch (MI.getOpcode()) {
-  default:
-   return false;
-  case Mips::WRDSP:
-  case Mips::WRDSP_MM:
-    isWrite = true;
-    break;
-  case Mips::RDDSP:
-  case Mips::RDDSP_MM:
-    isWrite = false;
-    break;
-  }
-  return true;
-}
-
 /// We check for the common case of 'or', as it's MIPS' preferred instruction
 /// for GPRs but we have to check the operands to ensure that is the case.
 /// Other move instructions for MIPS are directly identifiable.
 std::optional<DestSourcePair>
 MipsSEInstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
-  bool isDSPControlWrite = false;
-  // Condition is made to match the creation of WRDSP/RDDSP copy instruction
-  // from copyPhysReg function.
-  if (isReadOrWriteToDSPReg(MI, isDSPControlWrite)) {
-    if (!MI.getOperand(1).isImm() || MI.getOperand(1).getImm() != (1 << 4))
-      return std::nullopt;
-    else if (isDSPControlWrite) {
-      return DestSourcePair{MI.getOperand(2), MI.getOperand(0)};
-
-    } else {
-      return DestSourcePair{MI.getOperand(0), MI.getOperand(2)};
-    }
-  } else if (MI.isMoveReg() || isORCopyInst(MI)) {
+  if (MI.isMoveReg() || isORCopyInst(MI))
     return DestSourcePair{MI.getOperand(0), MI.getOperand(1)};
-  }
+
   return std::nullopt;
 }
 
Index: llvm/lib/Target/Mips/MipsDSPInstrInfo.td
===================================================================
--- llvm/lib/Target/Mips/MipsDSPInstrInfo.td
+++ llvm/lib/Target/Mips/MipsDSPInstrInfo.td
@@ -452,7 +452,6 @@
   list<dag> Pattern = [(set GPR32Opnd:$rd, (OpNode timmZExt10:$mask))];
   InstrItinClass Itinerary = itin;
   string BaseOpcode = instr_asm;
-  bit isMoveReg = 1;
 }
 
 class WRDSP_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
@@ -463,7 +462,6 @@
   list<dag> Pattern = [(OpNode GPR32Opnd:$rs, timmZExt10:$mask)];
   InstrItinClass Itinerary = itin;
   string BaseOpcode = instr_asm;
-  bit isMoveReg = 1;
 }
 
 class DPA_W_PH_DESC_BASE<string instr_asm, SDPatternOperator OpNode> {
Index: llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td
===================================================================
--- llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td
+++ llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td
@@ -374,7 +374,6 @@
   string AsmString = !strconcat("wrdsp", "\t$rt, $mask");
   list<dag> Pattern = [(int_mips_wrdsp GPR32Opnd:$rt, timmZExt7:$mask)];
   InstrItinClass Itinerary = NoItinerary;
-  bit isMoveReg = 1;
 }
 
 class BPOSGE32C_MMR3_DESC {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151181.536785.patch
Type: text/x-patch
Size: 2878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230703/3ac446fc/attachment.bin>


More information about the llvm-commits mailing list