diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.h b/llvm/lib/Target/RISCV/RISCVISelLowering.h --- a/llvm/lib/Target/RISCV/RISCVISelLowering.h +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.h @@ -85,9 +85,8 @@ GORCI, GORCIW, // Vector Extension - // VMV_X_S matches the semantics of vmv.x.s. The result is always XLenVT - // sign extended from the vector element size. NOTE: The result size will - // never be less than the vector element size. + // VMV_X_S matches the semantics of vmv.x.s. The result is always XLenVT sign + // extended from the vector element size. VMV_X_S, // Splats an i64 scalar to a vector type (with element type i64) where the // scalar is a sign-extended i32. diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -368,9 +368,13 @@ setOperationAction(ISD::INTRINSIC_W_CHAIN, MVT::Other, Custom); + setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::i8, Custom); + setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::i16, Custom); + if (Subtarget.is64Bit()) { setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::i64, Custom); setOperationAction(ISD::INTRINSIC_W_CHAIN, MVT::i64, Custom); + setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::i32, Custom); } else { // We must custom-lower certain vXi64 operations on RV32 due to the vector // element type being illegal. @@ -1467,23 +1471,32 @@ } // Custom-lower EXTRACT_VECTOR_ELT operations to slide the vector down, then -// extract the first element: (extractelt (slidedown vec, idx), 0). This is -// done to maintain partity with the legalization of RV32 vXi64 legalization. +// extract the first element: (extractelt (slidedown vec, idx), 0). For integer +// types this is done using VMV_X_S to allow us to glean information about the +// sign bits of the result. SDValue RISCVTargetLowering::lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const { SDLoc DL(Op); SDValue Idx = Op.getOperand(1); - if (isNullConstant(Idx)) - return Op; - SDValue Vec = Op.getOperand(0); EVT EltVT = Op.getValueType(); EVT VecVT = Vec.getValueType(); - SDValue Slidedown = DAG.getNode(RISCVISD::VSLIDEDOWN, DL, VecVT, - DAG.getUNDEF(VecVT), Vec, Idx); + MVT XLenVT = Subtarget.getXLenVT(); - return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, EltVT, Slidedown, - DAG.getConstant(0, DL, Subtarget.getXLenVT())); + // If the index is 0, the vector is already in the right position. + if (!isNullConstant(Idx)) { + Vec = DAG.getNode(RISCVISD::VSLIDEDOWN, DL, VecVT, DAG.getUNDEF(VecVT), Vec, + Idx); + } + + if (!EltVT.isInteger()) { + // Floating-point extracts are handled in TableGen. + return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, EltVT, Vec, + DAG.getConstant(0, DL, XLenVT)); + } + + SDValue Elt0 = DAG.getNode(RISCVISD::VMV_X_S, DL, XLenVT, Vec); + return DAG.getNode(ISD::TRUNCATE, DL, EltVT, Elt0); } SDValue RISCVTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, @@ -1825,37 +1838,46 @@ break; } case ISD::EXTRACT_VECTOR_ELT: { - // Custom-legalize an EXTRACT_VECTOR_ELT where XLEN XLEN, only the least-significant XLEN bits are - // transferred to the destination register. We issue two of these from the - // upper- and lower- halves of the SEW-bit vector element, slid down to the - // first element. + // Custom-legalize EXTRACT_VECTOR_ELT where SEW != XLEN. + // All extracts (even legal ones) are lowered to a slidedown followed by + // vmv.x.s to extract the lowest XLEN bits. When SEW <= XLEN this is + // sufficent and provides us with information about the sign bits of the + // result. + // When SEW > XLEN (currently only vXi64 on RV32), we must issue a further + // sequence of instructions to get the upper XLEN bits of the destination + // register. SDLoc DL(N); SDValue Vec = N->getOperand(0); SDValue Idx = N->getOperand(1); EVT VecVT = Vec.getValueType(); - assert(!Subtarget.is64Bit() && N->getValueType(0) == MVT::i64 && - VecVT.getVectorElementType() == MVT::i64 && - "Unexpected EXTRACT_VECTOR_ELT legalization"); - SDValue Slidedown = Vec; + // We don't want to introduce custom nodes with illegal vector types. Let + // the generic combining handle that. + if (!isTypeLegal(VecVT)) + break; + // Unless the index is known to be 0, we must slide the vector down to get // the desired element into index 0. if (!isNullConstant(Idx)) - Slidedown = DAG.getNode(RISCVISD::VSLIDEDOWN, DL, VecVT, - DAG.getUNDEF(VecVT), Vec, Idx); + Vec = DAG.getNode(RISCVISD::VSLIDEDOWN, DL, VecVT, DAG.getUNDEF(VecVT), + Vec, Idx); MVT XLenVT = Subtarget.getXLenVT(); // Extract the lower XLEN bits of the correct vector element. - SDValue EltLo = DAG.getNode(RISCVISD::VMV_X_S, DL, XLenVT, Slidedown, Idx); + SDValue EltLo = DAG.getNode(RISCVISD::VMV_X_S, DL, XLenVT, Vec, Idx); + + if (Subtarget.is64Bit() || VecVT.getVectorElementType() != MVT::i64) { + Results.push_back( + DAG.getNode(ISD::TRUNCATE, DL, VecVT.getVectorElementType(), EltLo)); + break; + } // To extract the upper XLEN bits of the vector element, shift the first // element right by 32 bits and re-extract the lower XLEN bits. SDValue ThirtyTwoV = DAG.getNode(RISCVISD::SPLAT_VECTOR_I64, DL, VecVT, DAG.getConstant(32, DL, Subtarget.getXLenVT())); - SDValue LShr32 = DAG.getNode(ISD::SRL, DL, VecVT, Slidedown, ThirtyTwoV); + SDValue LShr32 = DAG.getNode(ISD::SRL, DL, VecVT, Vec, ThirtyTwoV); SDValue EltHi = DAG.getNode(RISCVISD::VMV_X_S, DL, XLenVT, LShr32, Idx); diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td @@ -650,53 +650,47 @@ // Vector Element Inserts/Extracts //===----------------------------------------------------------------------===// -// The built-in TableGen 'extractelt' and 'insertelt' nodes must return the -// same type as the vector element type. On RISC-V, XLenVT is the only legal -// integer type, so for integer inserts/extracts we use a custom node which -// returns XLenVT. +// The built-in TableGen 'insertelt' node must return the same type as the +// vector element type. On RISC-V, XLenVT is the only legal integer type, so +// for integer inserts we use a custom node which inserts an XLenVT-typed +// value. def riscv_insert_vector_elt : SDNode<"ISD::INSERT_VECTOR_ELT", SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, SDTCisVT<2, XLenVT>, SDTCisPtrTy<3>]>, []>; -def riscv_extract_vector_elt - : SDNode<"ISD::EXTRACT_VECTOR_ELT", - SDTypeProfile<1, 2, [SDTCisVT<0, XLenVT>, SDTCisPtrTy<2>]>, []>; - -multiclass VPatInsertExtractElt_XI_Idx { - defvar vtilist = !if(IsFloat, AllFloatVectors, AllIntegerVectors); - defvar insertelt_node = !if(IsFloat, insertelt, riscv_insert_vector_elt); - defvar extractelt_node = !if(IsFloat, extractelt, riscv_extract_vector_elt); - foreach vti = vtilist in { - defvar MX = vti.LMul.MX; - defvar vmv_xf_s_inst = !cast(!strconcat("PseudoV", - !if(IsFloat, "F", ""), - "MV_", - vti.ScalarSuffix, - "_S_", MX)); - defvar vmv_s_xf_inst = !cast(!strconcat("PseudoV", - !if(IsFloat, "F", ""), - "MV_S_", - vti.ScalarSuffix, - "_", MX)); - // Only pattern-match insert/extract-element operations where the index is - // 0. Any other index will have been custom-lowered to slide the vector - // correctly into place (and, in the case of insert, slide it back again - // afterwards). - def : Pat<(vti.Scalar (extractelt_node (vti.Vector vti.RegClass:$rs2), 0)), - (vmv_xf_s_inst vti.RegClass:$rs2, vti.SEW)>; - - def : Pat<(vti.Vector (insertelt_node (vti.Vector vti.RegClass:$merge), - vti.ScalarRegClass:$rs1, 0)), - (vmv_s_xf_inst vti.RegClass:$merge, - (vti.Scalar vti.ScalarRegClass:$rs1), - vti.AVL, vti.SEW)>; - } -} let Predicates = [HasStdExtV] in -defm "" : VPatInsertExtractElt_XI_Idx; +foreach vti = AllIntegerVectors in { + def : Pat<(vti.Vector (riscv_insert_vector_elt (vti.Vector vti.RegClass:$merge), + vti.ScalarRegClass:$rs1, 0)), + (!cast("PseudoVMV_S_X_"#vti.LMul.MX) + vti.RegClass:$merge, + (vti.Scalar vti.ScalarRegClass:$rs1), + vti.AVL, vti.SEW)>; +} + let Predicates = [HasStdExtV, HasStdExtF] in -defm "" : VPatInsertExtractElt_XI_Idx; +foreach vti = AllFloatVectors in { + defvar MX = vti.LMul.MX; + defvar vmv_f_s_inst = !cast(!strconcat("PseudoVFMV_", + vti.ScalarSuffix, + "_S_", MX)); + defvar vmv_s_f_inst = !cast(!strconcat("PseudoVFMV_S_", + vti.ScalarSuffix, + "_", vti.LMul.MX)); + // Only pattern-match insert/extract-element operations where the index is + // 0. Any other index will have been custom-lowered to slide the vector + // correctly into place (and, in the case of insert, slide it back again + // afterwards). + def : Pat<(vti.Scalar (extractelt (vti.Vector vti.RegClass:$rs2), 0)), + (vmv_f_s_inst vti.RegClass:$rs2, vti.SEW)>; + + def : Pat<(vti.Vector (insertelt (vti.Vector vti.RegClass:$merge), + vti.ScalarRegClass:$rs1, 0)), + (vmv_s_f_inst vti.RegClass:$merge, + (vti.Scalar vti.ScalarRegClass:$rs1), + vti.AVL, vti.SEW)>; +} //===----------------------------------------------------------------------===// // Miscellaneous RISCVISD SDNodes diff --git a/llvm/test/CodeGen/RISCV/rvv/extractelt-int-rv32.ll b/llvm/test/CodeGen/RISCV/rvv/extractelt-int-rv32.ll --- a/llvm/test/CodeGen/RISCV/rvv/extractelt-int-rv32.ll +++ b/llvm/test/CodeGen/RISCV/rvv/extractelt-int-rv32.ll @@ -7,8 +7,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,mf8,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -20,8 +18,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,mf8,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -33,8 +29,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,mf8,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -45,8 +39,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,mf4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -58,8 +50,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,mf4,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -71,8 +61,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,mf4,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -83,8 +71,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,mf2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -96,8 +82,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,mf2,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -109,8 +93,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,mf2,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -121,8 +103,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,m1,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -134,8 +114,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,m1,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -147,8 +125,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,m1,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -159,8 +135,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,m2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -172,8 +146,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,m2,ta,mu ; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -185,8 +157,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,m2,ta,mu ; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -197,8 +167,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,m4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -210,8 +178,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,m4,ta,mu ; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -223,8 +189,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,m4,ta,mu ; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -235,8 +199,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,m8,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -248,8 +210,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,m8,ta,mu ; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -261,8 +221,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,m8,ta,mu ; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 24 -; CHECK-NEXT: srai a0, a0, 24 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -273,8 +231,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,mf4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -286,8 +242,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -299,8 +253,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,mf4,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -311,8 +263,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,mf2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -324,8 +274,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -337,8 +285,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,mf2,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -349,8 +295,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,m1,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -362,8 +306,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -375,8 +317,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,m1,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -387,8 +327,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,m2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -400,8 +338,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu ; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -413,8 +349,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,m2,ta,mu ; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -425,8 +359,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,m4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -438,8 +370,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu ; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -451,8 +381,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,m4,ta,mu ; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -463,8 +391,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,m8,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -476,8 +402,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu ; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -489,8 +413,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu ; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 16 -; CHECK-NEXT: srai a0, a0, 16 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r diff --git a/llvm/test/CodeGen/RISCV/rvv/extractelt-int-rv64.ll b/llvm/test/CodeGen/RISCV/rvv/extractelt-int-rv64.ll --- a/llvm/test/CodeGen/RISCV/rvv/extractelt-int-rv64.ll +++ b/llvm/test/CodeGen/RISCV/rvv/extractelt-int-rv64.ll @@ -7,8 +7,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,mf8,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -20,8 +18,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,mf8,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -33,8 +29,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,mf8,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -45,8 +39,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,mf4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -58,8 +50,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,mf4,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -71,8 +61,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,mf4,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -83,8 +71,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,mf2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -96,8 +82,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,mf2,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -109,8 +93,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,mf2,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -121,8 +103,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,m1,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -134,8 +114,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,m1,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -147,8 +125,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,m1,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -159,8 +135,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,m2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -172,8 +146,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,m2,ta,mu ; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -185,8 +157,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,m2,ta,mu ; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -197,8 +167,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,m4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -210,8 +178,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,m4,ta,mu ; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -223,8 +189,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,m4,ta,mu ; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -235,8 +199,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e8,m8,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i8 %r @@ -248,8 +210,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e8,m8,ta,mu ; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i8 %r @@ -261,8 +221,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e8,m8,ta,mu ; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 56 -; CHECK-NEXT: srai a0, a0, 56 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i8 %r @@ -273,8 +231,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,mf4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -286,8 +242,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -299,8 +253,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,mf4,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -311,8 +263,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,mf2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -324,8 +274,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -337,8 +285,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,mf2,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -349,8 +295,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,m1,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -362,8 +306,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -375,8 +317,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,m1,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -387,8 +327,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,m2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -400,8 +338,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu ; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -413,8 +349,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,m2,ta,mu ; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -425,8 +359,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,m4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -438,8 +370,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu ; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -451,8 +381,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,m4,ta,mu ; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -463,8 +391,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e16,m8,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i16 %r @@ -476,8 +402,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu ; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i16 %r @@ -489,8 +413,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu ; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: slli a0, a0, 48 -; CHECK-NEXT: srai a0, a0, 48 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i16 %r @@ -501,7 +423,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e32,mf2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i32 %r @@ -513,7 +434,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i32 %r @@ -525,7 +445,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e32,mf2,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i32 %r @@ -536,7 +455,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e32,m1,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i32 %r @@ -548,7 +466,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu ; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i32 %r @@ -560,7 +477,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e32,m1,ta,mu ; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v25 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i32 %r @@ -571,7 +487,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e32,m2,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i32 %r @@ -583,7 +498,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu ; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i32 %r @@ -595,7 +509,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e32,m2,ta,mu ; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v26 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i32 %r @@ -606,7 +519,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e32,m4,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i32 %r @@ -618,7 +530,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu ; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i32 %r @@ -630,7 +541,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e32,m4,ta,mu ; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v28 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i32 %r @@ -641,7 +551,6 @@ ; CHECK: # %bb.0: ; CHECK-NEXT: vsetvli zero, zero, e32,m8,ta,mu ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 0 ret i32 %r @@ -653,7 +562,6 @@ ; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu ; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 2 ret i32 %r @@ -665,7 +573,6 @@ ; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu ; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vmv.x.s a0, v8 -; CHECK-NEXT: sext.w a0, a0 ; CHECK-NEXT: ret %r = extractelement %v, i32 %idx ret i32 %r