[llvm] [RISCV][CostModel][NFC] Add getRISCVInstructionCost() to TTI for Cost… (PR #73651)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 06:19:59 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 01091fd101ee78fb8068a2b916ae007a4873d66a 1d060a261a78af62f74c54db2b618bc01e7ccc7a -- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index e48f51c751..b583a6a9cb 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -34,9 +34,10 @@ static cl::opt<unsigned> SLPMaxVF(
         "exclusively by SLP vectorizer."),
     cl::Hidden);
 
-InstructionCost RISCVTTIImpl::getRISCVInstructionCost(
-    RISCVInstruction Inst, MVT VT, unsigned NumInstr,
-    TTI::TargetCostKind CostKind) {
+InstructionCost
+RISCVTTIImpl::getRISCVInstructionCost(RISCVInstruction Inst, MVT VT,
+                                      unsigned NumInstr,
+                                      TTI::TargetCostKind CostKind) {
   if (CostKind == TTI::TCK_CodeSize)
     return NumInstr;
 
@@ -337,8 +338,8 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
         VectorType *IdxTy = getVRGatherIndexType(LT.second, *ST, Tp->getContext());
         InstructionCost IndexCost = getConstantPoolLoadCost(IdxTy, CostKind);
         return IndexCost +
-               getRISCVInstructionCost(RISCVInstruction::VRGATHER_VV,
-                                       LT.second, 1, CostKind);
+               getRISCVInstructionCost(RISCVInstruction::VRGATHER_VV, LT.second,
+                                       1, CostKind);
       }
       [[fallthrough]];
     }
@@ -357,8 +358,8 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
         InstructionCost IndexCost = getConstantPoolLoadCost(IdxTy, CostKind);
         InstructionCost MaskCost = getConstantPoolLoadCost(MaskTy, CostKind);
         return 2 * IndexCost +
-               getRISCVInstructionCost(RISCVInstruction::VRGATHER_VV,
-                                       LT.second, 2, CostKind) +
+               getRISCVInstructionCost(RISCVInstruction::VRGATHER_VV, LT.second,
+                                       2, CostKind) +
                MaskCost;
       }
       [[fallthrough]];
@@ -447,8 +448,8 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
         //   vmsne.vi v0, v8, 0
         return LT.first *
                (TLI->getLMULCost(LT.second) + // FIXME: should be 1 for andi
-                getRISCVInstructionCost(RISCVInstruction::VMV, LT.second,
-                                        1, CostKind) +
+                getRISCVInstructionCost(RISCVInstruction::VMV, LT.second, 1,
+                                        CostKind) +
                 getRISCVInstructionCost(RISCVInstruction::VSIMPLE_INT,
                                         LT.second, 1, CostKind));
       }
@@ -465,10 +466,10 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
              (TLI->getLMULCost(LT.second) + // FIXME: this should be 1 for andi
               getRISCVInstructionCost(RISCVInstruction::VMV, LT.second, 3,
                                       CostKind) +
-              getRISCVInstructionCost(RISCVInstruction::VMERGE, LT.second,
-                                      1, CostKind) +
-              getRISCVInstructionCost(RISCVInstruction::VSIMPLE_INT,
-                                      LT.second, 1, CostKind));
+              getRISCVInstructionCost(RISCVInstruction::VMERGE, LT.second, 1,
+                                      CostKind) +
+              getRISCVInstructionCost(RISCVInstruction::VSIMPLE_INT, LT.second,
+                                      1, CostKind));
     }
 
     if (HasScalar) {
@@ -511,8 +512,8 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
     // FIXME: replace the constant `2` below with cost of VSIMPLE_INT (vid.v &
     // vrsub.vx)
     InstructionCost GatherCost =
-        2 + getRISCVInstructionCost(RISCVInstruction::VRGATHER_VV,
-                                    LT.second, 1, CostKind);
+        2 + getRISCVInstructionCost(RISCVInstruction::VRGATHER_VV, LT.second, 1,
+                                    CostKind);
     // Mask operation additionally required extend and truncate
     InstructionCost ExtendCost = Tp->getElementType()->isIntegerTy(1) ? 3 : 0;
     return LT.first * (LenCost + GatherCost + ExtendCost);

``````````

</details>


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


More information about the llvm-commits mailing list