Fix ICE on TImode comparison of SUBREGs
AArch64 compiler now correctly handles TImode comparisons involving SUBREGs, preventing an ICE.
This commit resolves an internal compiler error (ICE) on the AArch64 target that occurred during TImode comparisons involving SUBREGs. The issue stemmed from the aarch64_gen_compare_reg function incorrectly using operand_subword when operands were SUBREGs, leading to NULL_RTX returns. The fix replaces operand_subword with force_lowpart_subreg and force_highpart_subreg, which correctly handle nested SUBREGs and prevent the ICE.
In Details
The AArch64 backend's aarch64_gen_compare_reg function encountered an ICE when comparing TImode values that were SUBREGs. This was because operand_subword (used to extract high/low parts) would return NULL_RTX when called on a SUBREG of a SUBREG, as simplify_gen_subreg does not support such nesting. This patch replaces operand_subword with force_lowpart_subreg and force_highpart_subreg, which are designed to handle such cases gracefully by always returning valid RTXs for the low and high parts, thus fixing PR128762.
- AArch64
- The 64-bit ARM architecture, widely used in mobile devices, servers, and embedded systems.
- ICE
- Internal Compiler Error. An unexpected condition encountered by the compiler during compilation, indicating a bug in the compiler itself.
- TImode
- A GCC machine mode representing a two-word (typically 64-bit on 32-bit systems, or 128-bit on 64-bit systems) integer type.
- SUBREG
- An RTX (represtation of target) in GCC that refers to a sub-part of a larger machine mode register.
- RTX
- Representation of Target. GCC's internal representation for machine instructions and operands.
- operand_subword
- A GCC internal function that attempts to extract a lower or higher sub-word from an RTX operand, potentially simplifying it.
- force_lowpart_subreg / force_highpart_subreg
- GCC internal functions that ensure the low or high part of an RTX is represented as a SUBREG, even if it involves complex nesting.