From patchwork Mon Jun 28 11:51:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Pettersson X-Patchwork-Id: 57132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BBCD2B6EEC for ; Mon, 28 Jun 2010 21:51:40 +1000 (EST) Received: (qmail 16407 invoked by alias); 28 Jun 2010 11:51:38 -0000 Received: (qmail 16395 invoked by uid 22791); 28 Jun 2010 11:51:38 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_SV, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fanny.its.uu.se (HELO fanny.its.uu.se) (130.238.4.241) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Jun 2010 11:51:28 +0000 Received: by fanny.its.uu.se (Postfix, from userid 212) id 4474461BE; Mon, 28 Jun 2010 13:51:25 +0200 (MSZ) Received: from fanny.its.uu.se(127.0.0.1) by fanny.its.uu.se via virus-scan id s24847; Mon, 28 Jun 10 13:51:18 +0200 Received: from pilspetsen.it.uu.se (pilspetsen.it.uu.se [130.238.18.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by fanny.its.uu.se (Postfix) with ESMTP id B629C61BE; Mon, 28 Jun 2010 13:51:18 +0200 (MSZ) Received: (from mikpe@localhost) by pilspetsen.it.uu.se (8.13.8+Sun/8.13.8) id o5SBpIvS020595; Mon, 28 Jun 2010 13:51:18 +0200 (MEST) MIME-Version: 1.0 Message-ID: <19496.36022.174178.20635@pilspetsen.it.uu.se> Date: Mon, 28 Jun 2010 13:51:18 +0200 From: Mikael Pettersson To: Richard Earnshaw Cc: GCC Patches Subject: Re: [patch, ARM] Improve optimization to transform TST into LSLS In-Reply-To: <4C23E1AC.5070602@buzzard.freeserve.co.uk> References: <4C23E1AC.5070602@buzzard.freeserve.co.uk> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 > > * 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 * 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")