[llvm] [X86] Add tuning for fast AVX2 vector division (PR #219873)

Xiaomeng Zhang via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 12 01:26:05 PDT 2026


================
@@ -1253,6 +1253,19 @@ InstructionCost X86TTIImpl::getArithmeticInstrCost(
     { ISD::FDIV, MVT::v4f64,   { 28, 35, 1, 3 } }, // vdivpd
   };
 
+  // Targets with fast 256-bit vector division use lower costs than the
+  // generic AVX2 table. This must be checked before the generic AVX2 lookup.
+  if (ST->hasAVX2() && ST->hasFastVectorFDIV()) {
+    static const CostKindTblEntry AVX2FastVectorFDIVCostTable[] = {
+      { ISD::FDIV, MVT::v8f32,   {  7, 13, 1, 3 } }, // vdivps
+      { ISD::FDIV, MVT::v4f64,   { 14, 20, 1, 3 } }, // vdivpd
----------------
JacketPants wrote:

I overlooked this value. It should be 1. Fixed.

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


More information about the llvm-commits mailing list