diff options
author | Richard Earnshaw <rearnsha@arm.com> | 2025-03-10 14:12:38 +0000 |
---|---|---|
committer | Richard Earnshaw <rearnsha@arm.com> | 2025-03-12 14:33:53 +0000 |
commit | 6e4045513d789587b2c7750e9016c7035b461299 (patch) | |
tree | 422c04a49a15873f01035ddd9dccf2d4ef5e87fb /gcc | |
parent | baa9b2b8d2eef7177118652d93ca0e7c933ba174 (diff) | |
download | gcc-6e4045513d789587b2c7750e9016c7035b461299.zip gcc-6e4045513d789587b2c7750e9016c7035b461299.tar.gz gcc-6e4045513d789587b2c7750e9016c7035b461299.tar.bz2 |
arm: allow type-punning subregs in vpr_register_operand [PR115439]
Subregs that only change the mode of an operand (ie don't change the
size) should be safe for the VPR register. If we don't permit them
we may end up with some redundant copy instructions.
gcc:
PR target/115439
* config/arm/predicates.md (vpr_register_operand): Allow type-punning
subregs.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/arm/predicates.md | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/config/arm/predicates.md b/gcc/config/arm/predicates.md index 5c78421..75c06d9 100644 --- a/gcc/config/arm/predicates.md +++ b/gcc/config/arm/predicates.md @@ -99,11 +99,21 @@ }) (define_predicate "vpr_register_operand" - (match_code "reg") + (match_code "reg,subreg") { - return REG_P (op) + if (SUBREG_P (op)) + { + /* Only allow subregs if they are strictly type punning. */ + if ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (op))) + != GET_MODE_SIZE (GET_MODE (op))) + || SUBREG_BYTE (op) != 0) + return false; + op = SUBREG_REG (op); + } + + return (REG_P (op) && (REGNO (op) >= FIRST_PSEUDO_REGISTER - || IS_VPR_REGNUM (REGNO (op))); + || IS_VPR_REGNUM (REGNO (op)))); }) (define_predicate "imm_for_neon_inv_logic_operand" |