[llvm] [AArch64][CostModel] Add cost model for pdep/pext instructions (PR #207657)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 20:56:00 PDT 2026


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 origin/main HEAD --extensions cpp,h -- llvm/include/llvm/CodeGen/BasicTTIImpl.h llvm/lib/Target/AArch64/AArch64ISelLowering.cpp llvm/lib/Target/AArch64/AArch64Subtarget.h llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 1d1eacbef..d67a4f257 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -3173,13 +3173,15 @@ public:
           thisT()->getArithmeticInstrCost(Instruction::Or, RetTy, CostKind);
       InstructionCost XorCost =
           thisT()->getArithmeticInstrCost(Instruction::Xor, RetTy, CostKind);
-      IntrinsicCostAttributes ClmulAttrs(Intrinsic::clmul, RetTy, {RetTy, RetTy});
+      IntrinsicCostAttributes ClmulAttrs(Intrinsic::clmul, RetTy,
+                                         {RetTy, RetTy});
       InstructionCost MulCost =
           thisT()->getIntrinsicInstrCost(ClmulAttrs, CostKind);
 
       int Iterations = Log2_32_Ceil(BW);
-      InstructionCost Cost = AndCost + ShiftCost;  // Prefix cost
-      Cost += Iterations * (MulCost + 2*AndCost + 2*ShiftCost + OrCost + 2*XorCost);
+      InstructionCost Cost = AndCost + ShiftCost; // Prefix cost
+      Cost += Iterations *
+              (MulCost + 2 * AndCost + 2 * ShiftCost + OrCost + 2 * XorCost);
       return Cost;
     }
     default:

``````````

</details>


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


More information about the llvm-commits mailing list