From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25233 invoked by alias); 14 Apr 2015 12:39:15 -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 25207 invoked by uid 89); 14 Apr 2015 12:39:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 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) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Apr 2015 12:39:13 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-4.uk.mimecast.lan; Tue, 14 Apr 2015 13:39:11 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 14 Apr 2015 13:39:10 +0100 Message-ID: <552D0A6E.6080302@arm.com> Date: Tue, 14 Apr 2015 12:39: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][cleanup] Use std::sort rather than manually sorting in gen_ldm_seq X-MC-Unique: e3HCDBfWSvq0qtHAMJ2QaQ-1 Content-Type: multipart/mixed; boundary="------------060903030401090900040104" X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00657.txt.bz2 This is a multi-part message in MIME format. --------------060903030401090900040104 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 341 Hi all, This patch replaces a manual ascending-order sort by a call to std::sort. This makes the code simpler and more readable IMHO. Bootstrapped and tested on arm. Ok for trunk? Thanks, Kyrill 2015-04-14 Kyrylo Tkachov * config/arm/arm.c (gen_ldm_seq): Use std::sort instead of sorting manually. --------------060903030401090900040104 Content-Type: text/x-patch; name=arm-sort.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="arm-sort.patch" Content-length: 1069 commit 1c51dda9a66fc997ab0ab1e4de66ff861b4a9545 Author: Kyrylo Tkachov Date: Wed Mar 18 14:53:13 2015 +0000 [ARM][cleanup] Use std::sort rather than manually sorting in gen_ldm_seq diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 2925e09..21409a0 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -14407,7 +14407,7 @@ gen_ldm_seq (rtx *operands, int nops, bool sort_reg= s) { int regs[MAX_LDM_STM_OPS], mem_order[MAX_LDM_STM_OPS]; rtx mems[MAX_LDM_STM_OPS]; - int i, j, base_reg; + int i, base_reg; rtx base_reg_rtx; HOST_WIDE_INT offset; int write_back =3D FALSE; @@ -14421,14 +14421,8 @@ gen_ldm_seq (rtx *operands, int nops, bool sort_re= gs) return false; =20 if (sort_regs) - for (i =3D 0; i < nops - 1; i++) - for (j =3D i + 1; j < nops; j++) - if (regs[i] > regs[j]) - { - int t =3D regs[i]; - regs[i] =3D regs[j]; - regs[j] =3D t; - } + std::sort (regs, regs + nops); + base_reg_rtx =3D gen_rtx_REG (Pmode, base_reg); =20 if (TARGET_THUMB1) --------------060903030401090900040104--