s390 byte-swaps for halfwords use rotate instead of vperm
s390 halfword byte-swaps now use efficient rotates, avoiding constant pool loads and vector register allocations.
For s390, byte-swapping operations on halfwords will now be implemented using a rotate instruction instead of a vperm instruction. This change avoids the overhead of loading a permutation vector from the constant pool and allocating an unused vector register, leading to more efficient code generation, especially when vector extensions are not fully utilized.
In Details
This commit refactors the expansion of byte-swap operations for V8HI (vector halfword) on s390. Instead of using vperm which requires a constant pool load for the permutation vector, it now uses a direct rotate instruction. This avoids unnecessary register allocation for the permutation vector and constant pool usage, particularly impacting the TARGET_VECTORIZE_VEC_PERM_CONST handling when VXE2 is not available.
- vperm
- A vector permutation instruction that rearranges elements within vectors based on a control vector.
- halfword
- A unit of data consisting of 16 bits (2 bytes). In the context of s390 vector operations, V8HI refers to a vector of 8 halfwords.
- VXE2
- An extension for s390 vector processing, likely referring to specific vector processing capabilities or instruction set.
- constant pool
- A section of memory where literal values used by the program are stored. Instructions may load values from the constant pool.
- RA
- Register Allocation, a compiler phase that assigns program variables and intermediate values to hardware registers.