From 0f58cfeb9fff4f0490a798d65038fd43c5178c2c Mon Sep 17 00:00:00 2001 From: Yashwant Singh Date: Mon, 3 Jul 2023 20:53:05 +0530 Subject: [PATCH] [Mips] Remove isMoveReg=1 from wrdsp and rddsp instructions This is a prep patch for D150388. Treating rddsp and wrdsp as copy instructions was causing test failures as we tried using isCopyInstr() hook to query target-specific copy instructions for LiveRangeSplitting. As suggested, removing 'isMoveReg = 1' from wrdsp and rddsp so they aren't considered simple copy-like instructions for the moment. Reviewed By: sdardis Differential Revision: https://reviews.llvm.org/D151181 --- llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td | 1 - llvm/lib/Target/Mips/MipsDSPInstrInfo.td | 2 -- llvm/lib/Target/Mips/MipsSEInstrInfo.cpp | 34 ++------------------------- 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td b/llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td index 8950de2..f7d0105 100644 --- a/llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td +++ b/llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td @@ -374,7 +374,6 @@ class WRDSP_MM_DESC { string AsmString = !strconcat("wrdsp", "\t$rt, $mask"); list Pattern = [(int_mips_wrdsp GPR32Opnd:$rt, timmZExt7:$mask)]; InstrItinClass Itinerary = NoItinerary; - bit isMoveReg = 1; } class BPOSGE32C_MMR3_DESC { diff --git a/llvm/lib/Target/Mips/MipsDSPInstrInfo.td b/llvm/lib/Target/Mips/MipsDSPInstrInfo.td index dd0b485..9498cd0 100644 --- a/llvm/lib/Target/Mips/MipsDSPInstrInfo.td +++ b/llvm/lib/Target/Mips/MipsDSPInstrInfo.td @@ -452,7 +452,6 @@ class RDDSP_DESC_BASE Pattern = [(set GPR32Opnd:$rd, (OpNode timmZExt10:$mask))]; InstrItinClass Itinerary = itin; string BaseOpcode = instr_asm; - bit isMoveReg = 1; } class WRDSP_DESC_BASE Pattern = [(OpNode GPR32Opnd:$rs, timmZExt10:$mask)]; InstrItinClass Itinerary = itin; string BaseOpcode = instr_asm; - bit isMoveReg = 1; } class DPA_W_PH_DESC_BASE { diff --git a/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp b/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp index f752ab2..d76dc01 100644 --- a/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp +++ b/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp @@ -200,44 +200,14 @@ static bool isORCopyInst(const MachineInstr &MI) { 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 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; } -- 2.7.4