This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, ARM] Work around out-of-range branch error for Thumb-2
- From: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>
- To: Julian Brown <julian at codesourcery dot com>, Richard Earnshaw <rearnsha at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, dan at codesourcery dot com, paul at codesourcery dot com
- Date: Thu, 17 Dec 2009 10:23:10 +0000
- Subject: Re: [PATCH, ARM] Work around out-of-range branch error for Thumb-2
- References: <20091127165811.6d09a1f1@rex.config> <1259341531.9961.68.camel@e200601-lin.cambridge.arm.com> <20091204190452.0340f1d5@rex.config>
- Reply-to: ramana dot radhakrishnan at arm dot com
> I've verified that this patch still fixes the original test case, and
> re-tested with a cross-compiler to ARM EABI. OK now?
Tested the attached backport to 4.4 branch and arm-none-eabi cross on
qemu for cpu=cortex-a8 and Thumb2 with no regressions.
Ok to commit ?
Ramana
2009-12-17 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Backport from mainline
2009-12-07 Julian Brown <julian@codesourcery.com>
* config/arm/constraints.md (Ps, Pt): New constraint letters.
* config/arm/thumb2.md (*thumb2_addsi_short): Tighten constraints.
--
Ramana Radhakrishnan
GNU Tools
ARM Ltd.
Index: gcc/config/arm/thumb2.md
===================================================================
--- gcc/config/arm/thumb2.md (revision 155293)
+++ gcc/config/arm/thumb2.md (working copy)
@@ -1108,9 +1108,9 @@
)
(define_insn "*thumb2_addsi_short"
- [(set (match_operand:SI 0 "low_register_operand" "=l")
- (plus:SI (match_operand:SI 1 "low_register_operand" "l")
- (match_operand:SI 2 "low_reg_or_int_operand" "lIL")))
+ [(set (match_operand:SI 0 "low_register_operand" "=l,l")
+ (plus:SI (match_operand:SI 1 "low_register_operand" "l,0")
+ (match_operand:SI 2 "low_reg_or_int_operand" "lPt,Ps")))
(clobber (reg:CC CC_REGNUM))]
"TARGET_THUMB2 && reload_completed"
"*
@@ -1128,7 +1128,7 @@
return \"add%!\\t%0, %1, %2\";
"
[(set_attr "predicable" "yes")
- (set_attr "length" "2")]
+ (set_attr "length" "2,2")]
)
(define_insn "divsi3"
Index: gcc/config/arm/constraints.md
===================================================================
--- gcc/config/arm/constraints.md (revision 155293)
+++ gcc/config/arm/constraints.md (working copy)
@@ -35,6 +35,7 @@
;; in ARM/Thumb-2 state: Q, Ut, Uv, Uy, Un, Us
;; in ARM state: Uq
+;; in Thumb-2 state: Ps, Pt
(define_register_constraint "f" "TARGET_ARM ? FPA_REGS : NO_REGS"
"Legacy FPA registers @code{f0}-@code{f7}.")
@@ -246,3 +247,13 @@
;; Additionally, we used to have a Q constraint in Thumb state, but
;; this wasn't really a valid memory constraint. Again, all uses of
;; this now seem to have been removed.
+(define_constraint "Ps"
+ "@internal In Thumb-2 state a constant in the range -255 to +255"
+ (and (match_code "const_int")
+ (match_test "TARGET_THUMB2 && ival >= -255 && ival <= 255")))
+
+(define_constraint "Pt"
+ "@internal In Thumb-2 state a constant in the range -7 to +7"
+ (and (match_code "const_int")
+ (match_test "TARGET_THUMB2 && ival >= -7 && ival <= 7")))
+