This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, ARM] Improve optimization to transform TST into LSLS
- From: Mikael Pettersson <mikpe at it dot uu dot se>
- To: Richard Earnshaw <Richard dot Earnshaw at buzzard dot freeserve dot co dot uk>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 28 Jun 2010 13:51:18 +0200
- Subject: Re: [patch, ARM] Improve optimization to transform TST into LSLS
- References: <4C23E1AC.5070602@buzzard.freeserve.co.uk>
Richard Earnshaw writes:
> We recently added a pattern to the Thumb2 machine description to try to
> transform TST reg, # (1 << n) into LSLS reg, #(31-n). Subsequent
> discussions on another patch led me to realize that this patch could
> probably be done a better way. Experimentation bears this out: the
> following patch saves a further 0.1% when compiling CSiBE.
>
> This version of the patch uses a peephole2 rather than a combine pattern
> to spot the optimization. This has two benefits:
> 1) The pattern will not be used if there's no scratch available
> (probably better, since tst only costs 2 bytes, but spilling can often
> cost significantly more).
> 2) It gives rise to further optimization opportunities, such as
> if-conversion, that the other patch did not support.
>
> Tested on arm-eabi and committed to trunk.
>
> R.
>
> 2010-06-24 Richard Earnshaw <rearnsha@arm.com>
>
> * thumb2.md (thumb2_tlobits_cbranch): Delete.
> (peephole2 to convert zero_extract/compare of single bit to
> lshift/compare): New.
There was a followup bug fix (PR44227) to the patch that added
thumb2_tlobits_cbranch, which added a Thumb-2 'Pu' constraint
used only in thumb2_tlobits_cbranch. After your patch above
this constraint is unused, so the following patch deletes it.
Tested by successfully building a cross to arm-linux-gnueabi.
(A reference to an undefined constraint causes a build error so
this shows there aren't any.)
Ok for trunk? (I don't have svn write access.)
gcc/
2010-06-28 Mikael Pettersson <mikpe@it.uu.se>
* config/arm/constraints.md (Pu): Delete constraint.
--- gcc-4.6-20100626/gcc/config/arm/constraints.md.~1~ 2010-06-20 01:00:31.000000000 +0200
+++ gcc-4.6-20100626/gcc/config/arm/constraints.md 2010-06-28 12:58:01.000000000 +0200
@@ -31,7 +31,7 @@
;; The following multi-letter normal constraints have been used:
;; in ARM/Thumb-2 state: Da, Db, Dc, Dn, Dl, DL, Dv, Dy
;; in Thumb-1 state: Pa, Pb
-;; in Thumb-2 state: Ps, Pt, Pu, Pv, Pw, Px
+;; in Thumb-2 state: Ps, Pt, Pv, Pw, Px
;; The following memory constraints have been used:
;; in ARM/Thumb-2 state: Q, Ut, Uv, Uy, Un, Um, Us
@@ -158,11 +158,6 @@
(and (match_code "const_int")
(match_test "TARGET_THUMB2 && ival >= -7 && ival <= 7")))
-(define_constraint "Pu"
- "@internal In Thumb-2 state a constant in the range +1 to +8"
- (and (match_code "const_int")
- (match_test "TARGET_THUMB2 && ival >= 1 && ival <= 8")))
-
(define_constraint "Pv"
"@internal In Thumb-2 state a constant in the range -255 to 0"
(and (match_code "const_int")