Use the sse_to_integer cost for vec_to_scalar and the integer_to_sse
cost for scalar_to_vec.

PR target/127268
* config/i386/i386.cc (ix86_default_vector_cost): Use the
sse_to_integer cost for vec_to_scalar and the integer_to_sse
cost for scalar_to_vec.

No regressions on Linux/x86-64.

-- 
H.J.
From 6ef0fb4da1d9fdcf36ab0fa4e775b9d5531961ce Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <[email protected]>
Date: Wed, 9 Sep 2026 09:45:20 +0800
Subject: [PATCH] x86: Use sse<>integer costs for vec_to_scalar/scalar_to_vec

Use the sse_to_integer cost for vec_to_scalar and the integer_to_sse
cost for scalar_to_vec.

	PR target/127268
	* config/i386/i386.cc (ix86_default_vector_cost): Use the
	sse_to_integer cost for vec_to_scalar and the integer_to_sse
	cost for scalar_to_vec.

Signed-off-by: H.J. Lu <[email protected]>
---
 gcc/config/i386/i386.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 3f00ddaa547..a686d91c3c3 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -26029,8 +26029,10 @@ ix86_default_vector_cost (enum vect_cost_for_stmt type_of_cost,
         return COSTS_N_INSNS (ix86_cost->sse_store[index]) / 2;
 
       case vec_to_scalar:
+	return ix86_vec_cost (mode, ix86_cost->sse_to_integer);
+
       case scalar_to_vec:
-        return ix86_vec_cost (mode, ix86_cost->sse_op);
+	return ix86_vec_cost (mode, ix86_cost->integer_to_sse);
 
       /* We should have separate costs for unaligned loads and gather/scatter.
 	 Do that incrementally.  */
-- 
2.55.0

Reply via email to