ARM big-endian fixes for vdup patterns, addressing PR128324
ARM big-endian code generation for vdup patterns is fixed, resolving potential assertion errors and incorrect lowpart selection.
This commit corrects two issues related to big-endian code generation for ARM’s vdup vector duplication patterns. First, it adds a reload_completed constraint to splits of 64->128-bit vdup patterns to prevent assertion errors when dealing with subregisters. Second, it fixes a big-endian specific bug where gen_lowpart would incorrectly select the upper 64 bits instead of the lower 64 bits when splitting a 128-bit vdup into its low part. The fix replaces gen_lowpart with simplify_gen_subreg for this scenario, ensuring correct big-endian behavior.
In Details
Two big-endian specific issues in ARM's vdup pattern handling are addressed. The first issue involved an assertion failure in neon_vdup_lane patterns when splitting 64->128-bit operations if the source was a subregister. This is resolved by guarding the split with reload_completed, ensuring it only occurs after reload. The second issue in neon_vdupq_lane for big-endian targets incorrectly used gen_lowpart on a 128-bit register, resulting in the upper 64 bits being returned. This is fixed by using simplify_gen_subreg to correctly extract the lower 64 bits, mirroring the fix for the…
- vdup
- Vector Duplicate. An ARM NEON instruction that duplicates a scalar value or a vector element across all elements of a vector register.
- big-endian
- A computer architecture's byte order where the most significant byte is stored at the lowest memory address. This is in contrast to little-endian, where the least significant byte is stored at the lowest address.
- subreg
- A subregister is a smaller part of a larger register. For example, the lower 32 bits of a 64-bit register can be considered a subregister.
- reload
- In compiler optimization, the process of assigning values to physical registers after register allocation. It may involve spilling values to memory if there aren't enough registers.
- PR128324
- Problem Report 128324. A bug identifier for an issue reported in the GCC bug tracking system.