From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127255 invoked by alias); 27 Oct 2015 13:55:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 127244 invoked by uid 89); 27 Oct 2015 13:55:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Oct 2015 13:55:42 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-25-HE5QmO4gRZOs5TO4h3tyrA-1; Tue, 27 Oct 2015 13:55:35 +0000 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 27 Oct 2015 13:55:35 +0000 Message-ID: <562F8257.6080006@arm.com> Date: Tue, 27 Oct 2015 14:02:00 -0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches CC: Ramana Radhakrishnan , Richard Earnshaw Subject: [PATCH][ARM] Fix costing of vmul+vcvt combine pattern X-MC-Unique: HE5QmO4gRZOs5TO4h3tyrA-1 Content-Type: multipart/mixed; boundary="------------020806040002030808040104" X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg02899.txt.bz2 This is a multi-part message in MIME format. --------------020806040002030808040104 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 689 Hi all, This patch allows us to handle the *combine_vcvtf2i pattern in rtx costs by= properly identifying it as a toint coversion. Before this I saw a pattern like: (set (reg/i:SI 0 r0) (fix:SI (fix:SF (mult:SF (reg:SF 16 s0 [ a ]) (const_double:SF 3.2e+1 [0x0.8p+6]))))) being assigned a cost of 40 because the costs blindly recursed into the ope= rands. With this patch for -mcpu=3Dcortex-a57 I see it being assigned a cost of 4. Bootstrapped and tested on arm-none-linux-gnueabihf. Ok for trunk? Thanks, Kyrill 2015-10-27 Kyrylo Tkachov * config/arm/arm.c (arm_new_rtx_costs, FIX case): Handle combine_vcvtf2i pattern. --------------020806040002030808040104 Content-Type: text/x-patch; name=arm-vmul-vcvt-cost.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="arm-vmul-vcvt-cost.patch" Content-length: 1147 commit 1e040710d1022ce816eac9b4f6065bc7aa2be9cf Author: Kyrylo Tkachov Date: Wed Oct 14 11:26:07 2015 +0100 [ARM] Fix costing of vmul+vcvt combine pattern diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index b37b507..33ad433 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -11064,6 +11064,23 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum= rtx_code outer_code, case UNSIGNED_FIX: if (TARGET_HARD_FLOAT) { + /* The *combine_vcvtf2i reduces a vmul+vcvt into + a vcvt fixed-point conversion. */ + if (code =3D=3D FIX && mode =3D=3D SImode + && GET_CODE (XEXP (x, 0)) =3D=3D FIX + && GET_MODE (XEXP (x, 0)) =3D=3D SFmode + && GET_CODE (XEXP (XEXP (x, 0), 0)) =3D=3D MULT + && vfp3_const_double_for_bits (XEXP (XEXP (XEXP (x, 0), 0), 1)) + > 0) + { + if (speed_p) + *cost +=3D extra_cost->fp[0].toint; + + *cost +=3D rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0), mode, + code, 0, speed_p); + return true; + } + if (GET_MODE_CLASS (mode) =3D=3D MODE_INT) { mode =3D GET_MODE (XEXP (x, 0)); --------------020806040002030808040104--