@@ -24850,8 +24850,9 @@ arm_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
/* We allow almost any value to be stored in the general registers.
Restrict doubleword quantities to even register pairs in ARM state
- so that we can use ldrd. The same restriction applies for MVE
- in order to support Armv8.1-M Mainline instructions.
+ so that we can use ldrd. Thumb-2 has no such requirement;
+ instructions that need an even register pair enforce it through
+ their operand constraints instead.
Do not allow very large Neon structure opaque modes in general
registers; they would use too many. */
if (regno <= LAST_ARM_REGNUM)
@@ -24859,11 +24860,10 @@ arm_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
if (ARM_NUM_REGS (mode) > 4)
return false;
- if (TARGET_THUMB2 && !(TARGET_HAVE_MVE || TARGET_CDE))
+ if (TARGET_THUMB2)
return true;
- return !((TARGET_LDRD || TARGET_CDE)
- && GET_MODE_SIZE (mode) > 4 && (regno & 1) != 0);
+ return !TARGET_LDRD || GET_MODE_SIZE (mode) <= 4 || (regno & 1) == 0;
}
if (regno == FRAME_POINTER_REGNUM
@@ -4515,7 +4515,7 @@
;; Custom Datapath Extension insns.
(define_insn "arm_cx1<mode>"
- [(set (match_operand:SIDI 0 "s_register_operand" "=r")
+ [(set (match_operand:SIDI 0 "s_register_operand" "=<cde_constraint>")
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i")
(match_operand:SI 2 "const_int_ccde1_operand" "i")]
UNSPEC_CDE))]
@@ -4525,7 +4525,7 @@
)
(define_insn "arm_cx1a<mode>"
- [(set (match_operand:SIDI 0 "s_register_operand" "=r")
+ [(set (match_operand:SIDI 0 "s_register_operand" "=<cde_constraint>")
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i")
(match_operand:SIDI 2 "s_register_operand" "0")
(match_operand:SI 3 "const_int_ccde1_operand" "i")]
@@ -4536,7 +4536,7 @@
)
(define_insn "arm_cx2<mode>"
- [(set (match_operand:SIDI 0 "s_register_operand" "=r")
+ [(set (match_operand:SIDI 0 "s_register_operand" "=<cde_constraint>")
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i")
(match_operand:SI 2 "s_register_operand" "r")
(match_operand:SI 3 "const_int_ccde2_operand" "i")]
@@ -4547,7 +4547,7 @@
)
(define_insn "arm_cx2a<mode>"
- [(set (match_operand:SIDI 0 "s_register_operand" "=r")
+ [(set (match_operand:SIDI 0 "s_register_operand" "=<cde_constraint>")
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i")
(match_operand:SIDI 2 "s_register_operand" "0")
(match_operand:SI 3 "s_register_operand" "r")
@@ -4559,7 +4559,7 @@
)
(define_insn "arm_cx3<mode>"
- [(set (match_operand:SIDI 0 "s_register_operand" "=r")
+ [(set (match_operand:SIDI 0 "s_register_operand" "=<cde_constraint>")
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i")
(match_operand:SI 2 "s_register_operand" "r")
(match_operand:SI 3 "s_register_operand" "r")
@@ -4571,7 +4571,7 @@
)
(define_insn "arm_cx3a<mode>"
- [(set (match_operand:SIDI 0 "s_register_operand" "=r")
+ [(set (match_operand:SIDI 0 "s_register_operand" "=<cde_constraint>")
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i")
(match_operand:SIDI 2 "s_register_operand" "0")
(match_operand:SI 3 "s_register_operand" "r")
@@ -21,8 +21,8 @@
;; The following register constraints have been used:
;; - in ARM/Thumb-2 state: t, w, x
;; - in Thumb state: h, b
-;; - in both states: l, c, k, q, Cs, Ts, US
-;; In ARM state, 'l' is an alias for 'r'
+;; - in both states: l, c, k, q, Cs, Ts, Tl, Tr, US
+;; In ARM state, 'l' is an alias for 'r' and 'Tl' is an alias for 'Tr'
;; 'f' and 'v' were previously used for FPA and MAVERICK registers.
;; 'y' and 'z' were previously used for iWMMX registers (removed after gcc-15)
@@ -66,6 +66,14 @@
"EVEN core registers @code{r0}, @code{r2}, @code{r4}, @code{r6}, @code{r8},
@code{r10}, @code{r12}, @code{r14}")
+(define_register_constraint "Tr" "GENERAL_REGS"
+ "@internal As @code{r}, but the first register must be even-numbered."
+ "regno % 2 == 0")
+
+(define_register_constraint "Tl" "TARGET_THUMB ? LO_REGS : GENERAL_REGS"
+ "@internal As @code{l}, but the first register must be even-numbered."
+ "regno % 2 == 0")
+
(define_constraint "Rd"
"@internal In Thumb-2 state a constant in range 1 to 16"
(and (match_code "const_int")
@@ -2024,6 +2024,7 @@
(define_mode_attr cde_suffix [(SI "") (DI "d")])
(define_mode_attr cde_dest [(SI "%0") (DI "%0, %H0")])
+(define_mode_attr cde_constraint [(SI "r") (DI "Tr")])
;;MVE mode attribute.
(define_mode_attr MVE_CNVT [(V8HI "V8HF") (V4SI "V4SF") (V8HF "V8HI")
@@ -442,7 +442,7 @@
;;
(define_insn "@mve_<mve_insn>q_<supf>v4si"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:V4SI 1 "s_register_operand" "w")]
VADDLVQ))
]
@@ -618,7 +618,7 @@
;;
(define_insn "@mve_<mve_insn>q_p_<supf>v4si"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:V4SI 1 "s_register_operand" "w")
(match_operand:V4BI 2 "vpr_register_operand" "Up")]
VADDLVQ_P))
@@ -1135,7 +1135,7 @@
;;
(define_insn "@mve_<mve_insn>q_<supf>v4si"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:DI 1 "s_register_operand" "0")
(match_operand:V4SI 2 "s_register_operand" "w")]
VADDLVAQ))
@@ -1352,7 +1352,7 @@
;;
(define_insn "@mve_<mve_insn>q_<supf><mode>"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:MVE_5 1 "s_register_operand" "w")
(match_operand:MVE_5 2 "s_register_operand" "w")]
MVE_VMLxLDAVxQ))
@@ -1491,7 +1491,7 @@
;;
(define_insn "@mve_<mve_insn>q_<supf>v4si"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:V4SI 1 "s_register_operand" "w")
(match_operand:V4SI 2 "s_register_operand" "w")]
MVE_VRMLxLDAVxQ))
@@ -1631,7 +1631,7 @@
;;
(define_insn "@mve_<mve_insn>q_<supf>v4si"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:DI 1 "s_register_operand" "0")
(match_operand:V4SI 2 "s_register_operand" "w")
(match_operand:V4SI 3 "s_register_operand" "w")]
@@ -2061,7 +2061,7 @@
;;
(define_insn "@mve_<mve_insn>q_p_<supf>v4si"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:DI 1 "s_register_operand" "0")
(match_operand:V4SI 2 "s_register_operand" "w")
(match_operand:V4BI 3 "vpr_register_operand" "Up")]
@@ -2250,7 +2250,7 @@
;;
(define_insn "@mve_<mve_insn>q_<supf><mode>"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:DI 1 "s_register_operand" "0")
(match_operand:MVE_5 2 "s_register_operand" "w")
(match_operand:MVE_5 3 "s_register_operand" "w")]
@@ -2271,7 +2271,7 @@
;;
(define_insn "@mve_<mve_insn>q_p_<supf><mode>"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:MVE_5 1 "s_register_operand" "w")
(match_operand:MVE_5 2 "s_register_operand" "w")
(match_operand:<MVE_VPRED> 3 "vpr_register_operand" "Up")]
@@ -2434,7 +2434,7 @@
;;
(define_insn "@mve_<mve_insn>q_p_<supf>v4si"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:V4SI 1 "s_register_operand" "w")
(match_operand:V4SI 2 "s_register_operand" "w")
(match_operand:V4BI 3 "vpr_register_operand" "Up")]
@@ -2847,7 +2847,7 @@
;;
(define_insn "@mve_<mve_insn>q_p_<supf><mode>"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:DI 1 "s_register_operand" "0")
(match_operand:MVE_5 2 "s_register_operand" "w")
(match_operand:MVE_5 3 "s_register_operand" "w")
@@ -2897,7 +2897,7 @@
;;
(define_insn "@mve_<mve_insn>q_p_<supf>v4si"
[
- (set (match_operand:DI 0 "s_register_operand" "=r")
+ (set (match_operand:DI 0 "s_register_operand" "=Tr")
(unspec:DI [(match_operand:DI 1 "s_register_operand" "0")
(match_operand:V4SI 2 "s_register_operand" "w")
(match_operand:V4SI 3 "s_register_operand" "w")
@@ -3758,7 +3758,7 @@
(define_insn "@mve_<mve_insn>q_wb_u<mode>_insn"
[(set (match_operand:MVE_2 0 "s_register_operand" "=w")
(unspec:MVE_2 [(match_operand:SI 2 "s_register_operand" "1")
- (subreg:SI (match_operand:DI 3 "s_register_operand" "r") 4)
+ (subreg:SI (match_operand:DI 3 "s_register_operand" "Tr") 4)
(match_operand:SI 4 "mve_imm_selective_upto_8" "Rg")]
VIDWDUPQ))
(set (match_operand:SI 1 "s_register_operand" "=Te")
@@ -3778,7 +3778,7 @@
[(set (match_operand:MVE_2 0 "s_register_operand" "=w")
(unspec:MVE_2 [(match_operand:MVE_2 1 "s_register_operand" "0")
(match_operand:SI 3 "s_register_operand" "2")
- (subreg:SI (match_operand:DI 4 "s_register_operand" "r") 4)
+ (subreg:SI (match_operand:DI 4 "s_register_operand" "Tr") 4)
(match_operand:SI 5 "mve_imm_selective_upto_8" "Rg")
(match_operand:<MVE_VPRED> 6 "vpr_register_operand" "Up")]
VIDWDUPQ_M))
@@ -4280,7 +4280,7 @@
;; [uqrshll_di]
;;
(define_insn "@mve_uqrshll_sat<supf>_di"
- [(set (match_operand:DI 0 "arm_low_register_operand" "=l")
+ [(set (match_operand:DI 0 "arm_low_register_operand" "=Tl")
(unspec:DI [(match_operand:DI 1 "arm_low_register_operand" "0")
(match_operand:SI 2 "register_operand" "r")]
UQRSHLLQ))]
@@ -4292,7 +4292,7 @@
;; [sqrshrl_di]
;;
(define_insn "@mve_sqrshrl_sat<supf>_di"
- [(set (match_operand:DI 0 "arm_low_register_operand" "=l")
+ [(set (match_operand:DI 0 "arm_low_register_operand" "=Tl")
(unspec:DI [(match_operand:DI 1 "arm_low_register_operand" "0")
(match_operand:SI 2 "register_operand" "r")]
SQRSHRLQ))]
@@ -4328,7 +4328,7 @@
;; [uqshll_di]
;;
(define_insn "mve_uqshll_di"
- [(set (match_operand:DI 0 "arm_low_register_operand" "=l")
+ [(set (match_operand:DI 0 "arm_low_register_operand" "=Tl")
(us_ashift:DI (match_operand:DI 1 "arm_low_register_operand" "0")
(match_operand:SI 2 "immediate_operand" "Pg")))]
"TARGET_HAVE_MVE"
@@ -4339,7 +4339,7 @@
;; [urshrl_di]
;;
(define_insn "mve_urshrl_di"
- [(set (match_operand:DI 0 "arm_low_register_operand" "=l")
+ [(set (match_operand:DI 0 "arm_low_register_operand" "=Tl")
(unspec:DI [(match_operand:DI 1 "arm_low_register_operand" "0")
(match_operand:SI 2 "immediate_operand" "Pg")]
URSHRL))]
@@ -4397,7 +4397,7 @@
;; [srshrl_di]
;;
(define_insn "mve_srshrl_di"
- [(set (match_operand:DI 0 "arm_low_register_operand" "=l")
+ [(set (match_operand:DI 0 "arm_low_register_operand" "=Tl")
(unspec:DI [(match_operand:DI 1 "arm_low_register_operand" "0")
(match_operand:SI 2 "immediate_operand" "Pg")]
SRSHRL))]
@@ -4409,7 +4409,7 @@
;; [sqshll_di]
;;
(define_insn "mve_sqshll_di"
- [(set (match_operand:DI 0 "arm_low_register_operand" "=l")
+ [(set (match_operand:DI 0 "arm_low_register_operand" "=Tl")
(ss_ashift:DI (match_operand:DI 1 "arm_low_register_operand" "0")
(match_operand:SI 2 "immediate_operand" "Pg")))]
"TARGET_HAVE_MVE"
@@ -4760,7 +4760,7 @@
;; immediate shift amount
;; we have to split the insn if the amount is not in the [1..32] range
(define_insn_and_split "mve_asrl_imm"
- [(set (match_operand:DI 0 "arm_general_register_operand" "=r,r")
+ [(set (match_operand:DI 0 "arm_general_register_operand" "=Tr,r")
(ashiftrt:DI (match_operand:DI 1 "arm_general_register_operand" "0,r")
(match_operand:QI 2 "immediate_operand" "Pg,Ph")))]
"TARGET_HAVE_MVE"
@@ -4816,7 +4816,7 @@
(set_attr "length" "4,8")])
(define_insn "mve_asrl_internal"
- [(set (match_operand:DI 0 "arm_general_register_operand" "=r")
+ [(set (match_operand:DI 0 "arm_general_register_operand" "=Tr")
(if_then_else:DI
(ge:QI (match_operand:QI 2 "arm_general_register_operand" "r")
(const_int 0))
@@ -4856,7 +4856,7 @@
;; immediate shift amount
;; we have to split the insn if the amount is not in the [1..32] range
(define_insn_and_split "mve_lsll_imm"
- [(set (match_operand:DI 0 "arm_general_register_operand" "=r,r")
+ [(set (match_operand:DI 0 "arm_general_register_operand" "=Tr,r")
(ashift:DI (match_operand:DI 1 "arm_general_register_operand" "0,r")
(match_operand:QI 2 "immediate_operand" "Pg,Ph")))]
"TARGET_HAVE_MVE"
@@ -4909,7 +4909,7 @@
(set_attr "length" "4,8")])
(define_insn "mve_lsll_internal"
- [(set (match_operand:DI 0 "arm_general_register_operand" "=r")
+ [(set (match_operand:DI 0 "arm_general_register_operand" "=Tr")
(if_then_else:DI
(ge:QI (match_operand:QI 2 "arm_general_register_operand" "r")
(const_int 0))
@@ -4921,7 +4921,7 @@
[(set_attr "predicable" "yes")])
(define_insn "mve_lsrl"
- [(set (match_operand:DI 0 "arm_general_register_operand" "=r")
+ [(set (match_operand:DI 0 "arm_general_register_operand" "=Tr")
(lshiftrt:DI (match_operand:DI 1 "arm_general_register_operand" "0")
(match_operand:SI 2 "long_shift_imm" "Pg")))]
"TARGET_HAVE_MVE"