[llvm] [Mips] Convert index to pointer type in lowerMSACopyIntr. (PR #228332)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 00:32:53 PDT 2026


https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/228332

>From ab54ef1fe80f61b8956873c9799629f8e3530b33 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 1 Oct 2026 22:35:34 -0700
Subject: [PATCH] [Mips] Convert index to pointer type in lowerMSACopyIntr.

The MipsISD::VEXTRACT_SEXT_ELT and other similar nodes expect
a pointer sized index.

Found while trying to implement SDTCisPtrTy checking in
verifySDNode.
---
 llvm/lib/Target/Mips/MipsSEISelLowering.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/Mips/MipsSEISelLowering.cpp b/llvm/lib/Target/Mips/MipsSEISelLowering.cpp
index 2d17cab760ac4..f9af7bd6c4034 100644
--- a/llvm/lib/Target/Mips/MipsSEISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsSEISelLowering.cpp
@@ -1559,7 +1559,9 @@ static SDValue lowerDSPIntr(SDValue Op, SelectionDAG &DAG, unsigned Opc) {
 static SDValue lowerMSACopyIntr(SDValue Op, SelectionDAG &DAG, unsigned Opc) {
   SDLoc DL(Op);
   SDValue Vec = Op->getOperand(1);
-  SDValue Idx = Op->getOperand(2);
+  const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+  SDValue Idx = DAG.getZExtOrTrunc(Op->getOperand(2), DL,
+                                   TLI.getVectorIdxTy(DAG.getDataLayout()));
   EVT ResTy = Op->getValueType(0);
   EVT EltTy = Vec->getValueType(0).getVectorElementType();
 



More information about the llvm-commits mailing list