Expand pass improves tuple extraction and fixes aarch64 regression.
The expand pass now handles tuple extraction more efficiently, improving code generation and fixing an aarch64 regression.
This commit refactors the expand pass to improve how values are extracted from tuple types, particularly in the context of vector operations. New functions are introduced to handle multi-vector-register to vector conversion and vector-element extraction, simplifying the target’s responsibility. This change resolves a regression on aarch64 concerning struct_3_256.c and improves code generation by preventing unnecessary spills to memory when extracting bit fields from vector types.
In Details
This patch addresses PR middle-end/125390 by improving tuple-extraction handling within the expand pass, particularly post-REGMODE_NATURAL_SIZE changes. It introduces new helper functions extract_vector_from_vector, extract_element_from_vector, and extract_vector_from_multireg in expmed.cc. The goal is to convert multi-vector-register types to vector types within the expand pass itself, leaving only vector-extract operations for the target. This simplifies target backends and fixes a struct_3_256.c regression on aarch64 by preventing memory spills for bit-field extractions that…
- expand pass
- A crucial stage in GCC's compilation pipeline where intermediate representation (IR) operations are expanded into a sequence of simpler machine-independent instructions. This pass bridges the gap between high-level IR and target-specific code generation.
- tuple type
- A data type that groups multiple values of potentially different types into a single composite type. In GCC's internal representation, this can be used to represent vector types or other aggregate structures.
- REGMODE_NATURAL_SIZE
- Refers to changes in how GCC handles the natural size of registers, potentially impacting how modes (data types and their sizes) are represented and manipulated internally.
- aarch64
- The 64-bit ARM architecture, a popular instruction set architecture used in mobile devices, servers, and embedded systems.
- spill to memory
- In compiler optimization, when there are not enough registers available to hold all the live values, some values are temporarily written (spilled) to memory to free up registers for other computations.
- vector extract
- An operation that retrieves a specific element or sub-part from a vector data type.