Power10 VSX registers simplify zero extensions from memory.
New Power10 instructions simplify zero-extending memory values into VSX registers, reducing code size and improving efficiency.
GCC now leverages new Power10 instructions to simplify the process of zero-extending values from memory into VSX registers. Previously, this involved multiple steps, including extending to a general-purpose register pair and then moving to a VSX register. The new lxvrdx (and similar) instructions can directly load and zero-extend data into VSX registers, eliminating intermediate steps and resulting in more efficient code for operations involving __uint128_t.
In Details
A peephole2 optimization has been added to the PowerPC backend (rs6000.md) to recognize sequences that zero-extend a DImode (or smaller) value from memory into a TImode VSX register. This pattern is now replaced by a single lxvrdx (or lxvrWx variant) instruction, which performs the load and zero-extension in one step. This avoids intermediate GPR usage and instructions like mtvsrdd, simplifying code generated for __uint128_t assignments from memory.
- VSX
- Vector-Scalar Extension. A set of instructions for IBM's Power Architecture that combines SIMD (Single Instruction, Multiple Data) vector processing with scalar floating-point operations, often used for high-performance computing.
- Power10
- A specific generation of IBM's Power ISA, introducing new instructions and capabilities, including enhanced vector processing.
- Zero-extend
- To extend a number by adding zero bits to its most significant end, typically when converting a smaller data type to a larger one, ensuring the higher-order bits are zero.
- DImode / TImode
- GCC's internal modes representing data types. DImode typically refers to a 64-bit integer, and TImode to a 128-bit integer.
- peephole optimization
- A compiler optimization technique that examines a small sequence ('peephole') of target machine instructions and replaces it with a more efficient sequence if a pattern is recognized.
- lxvrdx
- A PowerPC instruction that loads a 64-bit value from memory into a VSX register, zero-extending it to 128 bits.