i386: Split DI<->V2DI patterns before reload with -m32.
32-bit x86 SSE2 code generation for DI<->V2DI transfers now avoids unnecessary stack usage.
This commit refactors the i386 backend to split patterns for transferring data between DI and V2DI types before the reload pass when compiling for 32-bit targets with SSE2 support. Previously, these operations could involve inefficient stack usage. The change introduces explicit handling of high and low parts of registers, leading to more direct and performant code, as demonstrated by improvements in test cases involving vector extracts and concatenations.
In Details
i386 backend: The strexmmodes (stv2) pass was improved to correctly cost moves between SI<->V4SI DI<->V2DI. For 32-bit targets with SSE2, moves between DI and V2DI were previously implemented via stack spills. This commit optimizes these transfers by splitting the relevant vec_extractv2di_0_sse and vec_concatv2di_0 patterns before the reload pass, making the high and low parts of the registers explicit. This avoids stack usage and improves performance for vector data transfers.
- DI
- A 64-bit integer data type on x86 architectures.
- V2DI
- A 128-bit vector data type consisting of two 64-bit integers, typically used with SSE2 instructions.
- SSE2
- Streaming SIMD Extensions 2, an instruction set extension for x86 that provides advanced floating-point and integer operations, including vector processing.
- reload pass
- A compiler optimization pass that determines how to map intermediate representations of values to physical machine registers, potentially spilling values to memory if registers are exhausted.
- stv2 pass
- A GCC pass specifically for optimizing scalar-to-vector and vector-to-scalar data transfers on x86 architectures.