From patchwork Wed Apr 15 22:27:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 461663 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2174114009B for ; Thu, 16 Apr 2015 08:27:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=A7yl5m+G; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=uBCHmqhc6hvWUyQkj 79lRAM6yTiY4sMw+cy8AZRkLz+pjtu7sVAjeIkWknthePe2ow86J8918EdiKQOlv YO4FhSAGi+WoALLvw9HZrHClRpUmoYQnC1IQyl7jK6O//btHdFOkKaz10GTv2Cdy /obLStpr3xsOtfe+6ShEKHY8aY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=QIhZL5OjJ9N9kPUX2+AoHvM PLaI=; b=A7yl5m+G4osI2Yv0lFbChjUFSnDrpbbq5Zidyls3OgTEUgS3OXEE8qQ llybjLV/jGw2lH1PGfHwV3UqXxIiIr1+BgjHjQn7rVzR4MjeAFpLesJCzYsDaPva MddJ9F/BH2CKPcE531NIQL8EyVdrYOsOEj9lcQzkYguSFVnE42yA= Received: (qmail 115553 invoked by alias); 15 Apr 2015 22:27:35 -0000 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 Received: (qmail 115473 invoked by uid 89); 15 Apr 2015 22:27:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f179.google.com Received: from mail-pd0-f179.google.com (HELO mail-pd0-f179.google.com) (209.85.192.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 15 Apr 2015 22:27:32 +0000 Received: by pdbqa5 with SMTP id qa5so67790518pdb.1 for ; Wed, 15 Apr 2015 15:27:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type; bh=cURjn2hNvqnRJSAUTpFOIfS2AGFEKSOnVDwbia/699w=; b=WM4PeT37V5OKUtLyRMem6iNjm8x8K24LIWncK+Ggc1XrmpBEhO36yZ7ua0raMCCWHO 8g1JIHWxeZyF5AHZLXGjGyaVr8mkAwBa2vSZHiSs+LwgPGD6YVdUZlQaNmEVdaU5ITpA MYw29uYQR/898SC7hKaPJhov26Nq953HA15LAvBMZraColTdd6Q/sZxxFKjNZVnfFBCC dzXCdcbaxu85X8JfKjP4ddAzsDdC4VP5C+RrW8EhlaVzoYbtj81FJBhTdsjvx48tZrMV Jc1G1zDHBfOvW0yYzG0z846gTLsLghxopx5GlhrYCWVH8XT1ApZ6WLnj2TwnETnxB2k8 /6Yg== X-Gm-Message-State: ALoCoQms9wyE9BlnnMqXbMZg19IvDUFF2EtEzU32DV5G0So3parjHqtwgzkSTD6saghzC41ecrpu X-Received: by 10.70.131.33 with SMTP id oj1mr34690373pdb.3.1429136851015; Wed, 15 Apr 2015 15:27:31 -0700 (PDT) Received: from [10.1.1.5] (58-6-183-210.dyn.iinet.net.au. [58.6.183.210]) by mx.google.com with ESMTPSA id ax2sm5130486pac.21.2015.04.15.15.27.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2015 15:27:30 -0700 (PDT) Message-ID: <552EE5CC.9040703@linaro.org> Date: Thu, 16 Apr 2015 08:27:24 +1000 From: Kugan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Jakub Jelinek , Richard Earnshaw CC: "gcc-patches@gcc.gnu.org" , Marcus Shawcroft , James Greenhalgh , Maxim Kuvyrkov Subject: Re: [AArch64][PR65139] use clobber with match_scratch for aarch64_lshr_sisd_or_int_3 References: <552D897C.2040207@linaro.org> <552E571C.3000306@foss.arm.com> <20150415123202.GW1725@tucnak.redhat.com> In-Reply-To: <20150415123202.GW1725@tucnak.redhat.com> X-IsSubscribed: yes On 15/04/15 22:32, Jakub Jelinek wrote: > On Wed, Apr 15, 2015 at 01:18:36PM +0100, Richard Earnshaw wrote: >> On 14/04/15 22:41, Kugan wrote: >>> This patch uses clobber with match_scratch instead of earlyclobber for >>> aarch64_lshr_sisd_or_int_3 so that RA can have more freedom in >>> selecting suitable register, as discussed in >>> http://thread.gmane.org/gmane.comp.gcc.patches/336162 and reported in >>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65139. >>> >>> This is based on Maxim's patch. I have bootstrapped and regression >>> tested on aarch64-linux-gnu with no new regressions. Is this OK for trunk? >>> >>> Thanks, >>> Kugan >>> >>> gcc/ChangeLog: >>> >>> 2015-04-15 Kugan Vivekanandarajah >>> Maxim Kuvyrkov >>> >>> PR target/65139 >>> * config/aarch64/aarch64.md (3): Expand lshr with >>> gen_aarch64_lshr_sisd_or_int_3. >>> (*aarch64_lshr_sisd_or_int_3): Rename to >>> aarch64_lshr_sisd_or_int_3 and use clobber with >>> match_scratch instead of early clobber. >>> >> >> + if (strcmp ("", "lshr") == 0) >> + { >> >> >> This can't be the best way to match the operation type. Yes, I know that >> the comparison is a compile time invariant, but there must be an attribute >> of optab (or one can be created for it) that would make the test trivial and >> not rely on the compiler optimizing the strcmp away. > > Perhaps just > if ( == LSHIFTRT) > { Thanks. I have now changed it as above and reran the regression. Richard, is this OK to you? Kugan diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 534a862..4a16529 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -3277,6 +3277,12 @@ DONE; } } + + if ( == LSHIFTRT) + { + emit_insn (gen_aarch64_lshr_sisd_or_int_3 (operands[0], operands[1], operands[2])); + DONE; + } } ) @@ -3361,11 +3367,12 @@ ) ;; Logical right shift using SISD or Integer instruction -(define_insn "*aarch64_lshr_sisd_or_int_3" - [(set (match_operand:GPI 0 "register_operand" "=w,&w,r") +(define_insn "aarch64_lshr_sisd_or_int_3" + [(set (match_operand:GPI 0 "register_operand" "=w,w,r") (lshiftrt:GPI (match_operand:GPI 1 "register_operand" "w,w,r") - (match_operand:QI 2 "aarch64_reg_or_shift_imm_" "Us,w,rUs")))] + (match_operand:QI 2 "aarch64_reg_or_shift_imm_" "Us,w,rUs"))) + (clobber (match_scratch:QI 3 "=X,w,X"))] "" "@ ushr\t%0, %1, %2 @@ -3379,30 +3386,28 @@ [(set (match_operand:DI 0 "aarch64_simd_register") (lshiftrt:DI (match_operand:DI 1 "aarch64_simd_register") - (match_operand:QI 2 "aarch64_simd_register")))] + (match_operand:QI 2 "aarch64_simd_register"))) + (clobber (match_scratch:QI 3))] "TARGET_SIMD && reload_completed" [(set (match_dup 3) (unspec:QI [(match_dup 2)] UNSPEC_SISD_NEG)) (set (match_dup 0) (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_SISD_USHL))] - { - operands[3] = gen_lowpart (QImode, operands[0]); - } + "" ) (define_split [(set (match_operand:SI 0 "aarch64_simd_register") (lshiftrt:SI (match_operand:SI 1 "aarch64_simd_register") - (match_operand:QI 2 "aarch64_simd_register")))] + (match_operand:QI 2 "aarch64_simd_register"))) + (clobber (match_scratch:QI 3))] "TARGET_SIMD && reload_completed" [(set (match_dup 3) (unspec:QI [(match_dup 2)] UNSPEC_SISD_NEG)) (set (match_dup 0) (unspec:SI [(match_dup 1) (match_dup 3)] UNSPEC_USHL_2S))] - { - operands[3] = gen_lowpart (QImode, operands[0]); - } + "" ) ;; Arithmetic right shift using SISD or Integer instruction