Account for SSE to integer move cost for vec_to_scalar
GCC now accounts for the cost of moving data from SSE registers to general-purpose registers.
GCC’s cost model for vector operations has been updated to include the extra cost of converting a vector’s element to an integer scalar. This change specifically addresses the vec_to_scalar operation when the target is a general-purpose register, ensuring more accurate performance estimations by accounting for the lane extraction process.
In Details
The ix86_default_vector_cost function in GCC's x86 backend now incorporates an SSE-to-integer move cost. This aims to improve vectorization decisions by more accurately reflecting the performance impact of converting vector elements, particularly when the destination is a GPR. The change targets vec_to_scalar operations, ensuring they are not incorrectly vectorized if the associated cost is too high.
- vec_to_scalar
- A compiler intrinsic or operation that converts an element from a vector data type to a scalar data type.
- SSE
- Streaming SIMD Extensions, an instruction set extension for x86 processors that provides scalar and vector processing capabilities, primarily for multimedia and signal processing tasks.
- GPR
- General-Purpose Register. A register in a CPU that can be used for various purposes, such as holding data, addresses, or intermediate results during computation.
- vectorization
- An optimization technique where a single instruction operates on multiple data elements simultaneously, often by transforming scalar code into SIMD (Single Instruction, Multiple Data) instructions.