Fix rs6000 vec_permx incorrect code generation
rs6000: Fixes incorrect code generation for vec_permx by using a temporary register for the control vector.
A bug in the little-endian expansion of vec_permx on rs6000 modified the permute control vector. This modification caused subsequent vec_permx calls using the same control vector to produce incorrect results. The fix generates the negated control vector in a new pseudo register instead of altering the input operand, and a new test case is added.
In Details
The rs6000 backend's implementation of vec_permx for little-endian targets incorrectly modified the permute control vector. When this vector was reused across multiple vec_permx instructions, subsequent operations used the modified, incorrect control value. This commit resolves the issue by allocating a temporary pseudo register for the negated control vector, preventing in-place modification of the input operand.
- vec_permx
- A vector permutation instruction that rearranges elements within a vector register based on a control vector. It is commonly found in SIMD instruction sets.
- little-endian
- A byte order where the least significant byte is stored at the lowest memory address. Common on x86 architectures.
- pseudo register
- A temporary, compiler-managed register that does not directly correspond to a physical hardware register. Used to hold intermediate values during compilation.