[llvm] [RISCV][TTI] Scale the cost of FP-Int conversion with LMUL (PR #87506)

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 07:17:36 PDT 2024


================
@@ -1134,16 +1134,13 @@ InstructionCost RISCVTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
       MVT ElementVT = MVT::getIntegerVT(SrcEltSize >> 1);
       MVT VecVT = DstLT.second.changeVectorElementType(ElementVT);
       Cost += getRISCVInstructionCost(FNCVT, VecVT, CostKind);
-    }
-    if ((SrcEltSize >> 1) > DstEltSize) {
-      // For mask type, we use:
-      // vand.vi v8, v9, 1
-      // vmsne.vi v0, v8, 0
-      VectorType *VecTy =
-          VectorType::get(IntegerType::get(Dst->getContext(), SrcEltSize >> 1),
-                          cast<VectorType>(Dst)->getElementCount());
-      Cost +=
-          getCastInstrCost(Instruction::Trunc, Dst, VecTy, CCH, CostKind, I);
+      if ((SrcEltSize >> 1) > DstEltSize) {
+        VectorType *VecTy = VectorType::get(
+            IntegerType::get(Dst->getContext(), SrcEltSize >> 1),
+            cast<VectorType>(Dst)->getElementCount());
----------------
arcbbb wrote:

Cool, thanks for catching that!

https://github.com/llvm/llvm-project/pull/87506


More information about the llvm-commits mailing list