https://gcc.gnu.org/g:5f5ca32dd175ccd2946cedef23769482c309945e

commit r16-7379-g5f5ca32dd175ccd2946cedef23769482c309945e
Author: Richard Biener <[email protected]>
Date:   Fri Feb 6 14:25:06 2026 +0100

    Revert part of r16-869-ge3d3d6d7d2c8ab
    
    The following reverts part of the changes done by r16-869-ge3d3d6d7d2c8ab
    which AFAICS was never posted on the mailing list.  The hunk reverted
    adds extra costs for vector construction of AVX or AVX512 vectors
    because Honza thought we're only adding 1 conversion for all constructs,
    but in fact we're costing each individual unique scalar source used.
    
    Noticed when investigating PR120234, but this does not affect it
    since there it's all SSE sized operations.
    
    Still this is a regression, though reading r16-869-ge3d3d6d7d2c8ab
    commit message indicating "correct numbers regress benchmarks" might
    make this somewhat dangerous.  Still r16-531-g37e61c793c1b22 already
    made the constructor costs much more expensive for integers, so
    this might compensate.
    
            * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost):
            Remove double and triple accounting of GPR -> XMM moves
            in construction of AVX and AVX512 vectors.

Diff:
---
 gcc/config/i386/i386.cc | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 42ae9ccb0518..8a54648337dc 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -26422,21 +26422,7 @@ ix86_vector_costs::add_stmt_cost (int count, 
vect_cost_for_stmt kind,
                {
                  m_num_gpr_needed[where]++;
 
-                 int cost = COSTS_N_INSNS (ix86_cost->integer_to_sse) / 2;
-
-                 /* For integer construction, the number of actual GPR -> XMM
-                    moves will be somewhere between 0 and n.
-                    We do not have very good idea about actual number, since
-                    the source may be a constant, memory or a chain of
-                    instructions that will be later converted by
-                    scalar-to-vector pass.  */
-                 if (kind == vec_construct
-                     && GET_MODE_BITSIZE (mode) == 256)
-                   cost *= 2;
-                 else if (kind == vec_construct
-                          && GET_MODE_BITSIZE (mode) == 512)
-                   cost *= 3;
-                 stmt_cost += cost;
+                 stmt_cost += COSTS_N_INSNS (ix86_cost->integer_to_sse) / 2;
                }
            }
        }

Reply via email to