diff options
author | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2021-10-13 16:42:47 +0100 |
---|---|---|
committer | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2021-10-13 16:44:03 +0100 |
commit | 5efeaa0d29525fa28e189e6278c1b1651fb0d7bf (patch) | |
tree | b295b1d5cae56f6685ce89fdcbd415f871366787 /gcc/config/arm | |
parent | 20995e68c28c1091be915f5ab4fcfa45c1cd0bc5 (diff) | |
download | gcc-5efeaa0d29525fa28e189e6278c1b1651fb0d7bf.zip gcc-5efeaa0d29525fa28e189e6278c1b1651fb0d7bf.tar.gz gcc-5efeaa0d29525fa28e189e6278c1b1651fb0d7bf.tar.bz2 |
[arm] Fix MVE addressing modes for VLDR[BHW] and VSTR[BHW]
The way we were previously dealing with addressing modes for MVE was preventing
the use of pre, post and offset addressing modes for the normal loads and
stores, including widening and narrowing. This patch fixes that and
adds tests to ensure we are capable of using all the available addressing
modes.
gcc/ChangeLog:
2021-10-12 Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/arm/arm.c (thumb2_legitimate_address_p): Use VALID_MVE_MODE
when checking mve addressing modes.
(mve_vector_mem_operand): Fix the way we handle pre, post and offset
addressing modes.
(arm_print_operand): Fix printing of POST_ and PRE_MODIFY.
* config/arm/mve.md: Use mve_memory_operand predicate everywhere where
there is a single Ux constraint.
gcc/testsuite/ChangeLog:
2021-10-12 Andre Vieira <andre.simoesdiasvieira@arm.com>
* gcc.target/arm/mve/mve.exp: Make it test main directory.
* gcc.target/arm/mve/mve_load_memory_modes.c: New test.
* gcc.target/arm/mve/mve_store_memory_modes.c: New test.
Diffstat (limited to 'gcc/config/arm')
-rw-r--r-- | gcc/config/arm/arm.c | 63 | ||||
-rw-r--r-- | gcc/config/arm/mve.md | 16 |
2 files changed, 37 insertions, 42 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 471128f..d8c5d2b 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -8531,8 +8531,7 @@ thumb2_legitimate_address_p (machine_mode mode, rtx x, int strict_p) bool use_ldrd; enum rtx_code code = GET_CODE (x); - if (TARGET_HAVE_MVE - && (mode == V8QImode || mode == E_V4QImode || mode == V4HImode)) + if (TARGET_HAVE_MVE && VALID_MVE_MODE (mode)) return mve_vector_mem_operand (mode, x, strict_p); if (arm_address_register_rtx_p (x, strict_p)) @@ -13434,53 +13433,49 @@ mve_vector_mem_operand (machine_mode mode, rtx op, bool strict) || code == PRE_INC || code == POST_DEC) { reg_no = REGNO (XEXP (op, 0)); - return (((mode == E_V8QImode || mode == E_V4QImode || mode == E_V4HImode) - ? reg_no <= LAST_LO_REGNUM - :(reg_no < LAST_ARM_REGNUM && reg_no != SP_REGNUM)) - || (!strict && reg_no >= FIRST_PSEUDO_REGISTER)); - } - else if ((code == POST_MODIFY || code == PRE_MODIFY) - && GET_CODE (XEXP (op, 1)) == PLUS && REG_P (XEXP (XEXP (op, 1), 1))) + return ((mode == E_V8QImode || mode == E_V4QImode || mode == E_V4HImode) + ? reg_no <= LAST_LO_REGNUM + :(reg_no < LAST_ARM_REGNUM && reg_no != SP_REGNUM)) + || reg_no >= FIRST_PSEUDO_REGISTER; + } + else if (((code == POST_MODIFY || code == PRE_MODIFY) + && GET_CODE (XEXP (op, 1)) == PLUS + && XEXP (op, 0) == XEXP (XEXP (op, 1), 0) + && REG_P (XEXP (op, 0)) + && GET_CODE (XEXP (XEXP (op, 1), 1)) == CONST_INT) + /* Make sure to only accept PLUS after reload_completed, otherwise + this will interfere with auto_inc's pattern detection. */ + || (reload_completed && code == PLUS && REG_P (XEXP (op, 0)) + && GET_CODE (XEXP (op, 1)) == CONST_INT)) { reg_no = REGNO (XEXP (op, 0)); - val = INTVAL (XEXP ( XEXP (op, 1), 1)); + if (code == PLUS) + val = INTVAL (XEXP (op, 1)); + else + val = INTVAL (XEXP(XEXP (op, 1), 1)); + switch (mode) { case E_V16QImode: - if (abs (val) <= 127) - return ((reg_no < LAST_ARM_REGNUM && reg_no != SP_REGNUM) - || (!strict && reg_no >= FIRST_PSEUDO_REGISTER)); - return FALSE; - case E_V8HImode: - case E_V8HFmode: - if (abs (val) <= 255) - return ((reg_no < LAST_ARM_REGNUM && reg_no != SP_REGNUM) - || (!strict && reg_no >= FIRST_PSEUDO_REGISTER)); - return FALSE; case E_V8QImode: case E_V4QImode: if (abs (val) <= 127) - return (reg_no <= LAST_LO_REGNUM - || (!strict && reg_no >= FIRST_PSEUDO_REGISTER)); + return (reg_no < LAST_ARM_REGNUM && reg_no != SP_REGNUM) + || reg_no >= FIRST_PSEUDO_REGISTER; return FALSE; + case E_V8HImode: + case E_V8HFmode: case E_V4HImode: case E_V4HFmode: if (val % 2 == 0 && abs (val) <= 254) - return (reg_no <= LAST_LO_REGNUM - || (!strict && reg_no >= FIRST_PSEUDO_REGISTER)); + return reg_no <= LAST_LO_REGNUM + || reg_no >= FIRST_PSEUDO_REGISTER; return FALSE; case E_V4SImode: case E_V4SFmode: if (val % 4 == 0 && abs (val) <= 508) - return ((reg_no < LAST_ARM_REGNUM && reg_no != SP_REGNUM) - || (!strict && reg_no >= FIRST_PSEUDO_REGISTER)); - return FALSE; - case E_V2DImode: - case E_V2DFmode: - case E_TImode: - if (val % 4 == 0 && val >= 0 && val <= 1020) - return ((reg_no < LAST_ARM_REGNUM && reg_no != SP_REGNUM) - || (!strict && reg_no >= FIRST_PSEUDO_REGISTER)); + return (reg_no < LAST_ARM_REGNUM && reg_no != SP_REGNUM) + || reg_no >= FIRST_PSEUDO_REGISTER; return FALSE; default: return FALSE; @@ -24277,7 +24272,7 @@ arm_print_operand (FILE *stream, rtx x, int code) else if (code == POST_MODIFY || code == PRE_MODIFY) { asm_fprintf (stream, "[%r", REGNO (XEXP (addr, 0))); - postinc_reg = XEXP ( XEXP (x, 1), 1); + postinc_reg = XEXP (XEXP (addr, 1), 1); if (postinc_reg && CONST_INT_P (postinc_reg)) { if (code == POST_MODIFY) diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index e393518..a66af4d 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -7570,7 +7570,7 @@ ;; (define_insn "mve_vldrwq_fv4sf" [(set (match_operand:V4SF 0 "s_register_operand" "=w") - (unspec:V4SF [(match_operand:V4SI 1 "memory_operand" "Ux")] + (unspec:V4SF [(match_operand:V4SI 1 "mve_memory_operand" "Ux")] VLDRWQ_F)) ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" @@ -7589,7 +7589,7 @@ ;; (define_insn "mve_vldrwq_<supf>v4si" [(set (match_operand:V4SI 0 "s_register_operand" "=w") - (unspec:V4SI [(match_operand:V4SI 1 "memory_operand" "Ux")] + (unspec:V4SI [(match_operand:V4SI 1 "mve_memory_operand" "Ux")] VLDRWQ)) ] "TARGET_HAVE_MVE" @@ -7608,7 +7608,7 @@ ;; (define_insn "mve_vldrwq_z_fv4sf" [(set (match_operand:V4SF 0 "s_register_operand" "=w") - (unspec:V4SF [(match_operand:V4SI 1 "memory_operand" "Ux") + (unspec:V4SF [(match_operand:V4SI 1 "mve_memory_operand" "Ux") (match_operand:HI 2 "vpr_register_operand" "Up")] VLDRWQ_F)) ] @@ -7628,7 +7628,7 @@ ;; (define_insn "mve_vldrwq_z_<supf>v4si" [(set (match_operand:V4SI 0 "s_register_operand" "=w") - (unspec:V4SI [(match_operand:V4SI 1 "memory_operand" "Ux") + (unspec:V4SI [(match_operand:V4SI 1 "mve_memory_operand" "Ux") (match_operand:HI 2 "vpr_register_operand" "Up")] VLDRWQ)) ] @@ -8282,7 +8282,7 @@ ;; [vstrwq_f] ;; (define_insn "mve_vstrwq_fv4sf" - [(set (match_operand:V4SI 0 "memory_operand" "=Ux") + [(set (match_operand:V4SI 0 "mve_memory_operand" "=Ux") (unspec:V4SI [(match_operand:V4SF 1 "s_register_operand" "w")] VSTRWQ_F)) ] @@ -8301,7 +8301,7 @@ ;; [vstrwq_p_f] ;; (define_insn "mve_vstrwq_p_fv4sf" - [(set (match_operand:V4SI 0 "memory_operand" "=Ux") + [(set (match_operand:V4SI 0 "mve_memory_operand" "=Ux") (unspec:V4SI [(match_operand:V4SF 1 "s_register_operand" "w") (match_operand:HI 2 "vpr_register_operand" "Up")] VSTRWQ_F)) @@ -8321,7 +8321,7 @@ ;; [vstrwq_p_s vstrwq_p_u] ;; (define_insn "mve_vstrwq_p_<supf>v4si" - [(set (match_operand:V4SI 0 "memory_operand" "=Ux") + [(set (match_operand:V4SI 0 "mve_memory_operand" "=Ux") (unspec:V4SI [(match_operand:V4SI 1 "s_register_operand" "w") (match_operand:HI 2 "vpr_register_operand" "Up")] VSTRWQ)) @@ -8341,7 +8341,7 @@ ;; [vstrwq_s vstrwq_u] ;; (define_insn "mve_vstrwq_<supf>v4si" - [(set (match_operand:V4SI 0 "memory_operand" "=Ux") + [(set (match_operand:V4SI 0 "mve_memory_operand" "=Ux") (unspec:V4SI [(match_operand:V4SI 1 "s_register_operand" "w")] VSTRWQ)) ] |