From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1773 invoked by alias); 16 Mar 2015 10:11:03 -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 1153 invoked by uid 89); 16 Mar 2015 10:11:02 -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: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Mar 2015 10:11:00 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by service87.mimecast.com; Mon, 16 Mar 2015 10:10:58 +0000 Received: from [10.2.207.50] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 16 Mar 2015 10:10:57 +0000 Message-ID: <5506AC2E.3090509@arm.com> Date: Mon, 16 Mar 2015 10:11: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 Subject: [PATCH][expmed][cleanup] Use std::swap instead of manual swapping X-MC-Unique: 115031610105803801 Content-Type: multipart/mixed; boundary="------------060509050406000903080707" X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00812.txt.bz2 This is a multi-part message in MIME format. --------------060509050406000903080707 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 509 Hi all, This patch replaces manual swapping in synth_mult with std::swap. Not much else to say about this. This code could arguably be refactored a bit but that's another story. I believe these are considered obvious at this point. I'll apply it in 24 hours unless somebody objects Tested aarch64-none-elf and bootstrapped on x86_64-linux-gnu. Thanks, Kyrill 2015-03-16 Kyrylo Tkachov * expmed.c (synth_mult): Use std::swap instead of manually swapping algorithms.= --------------060509050406000903080707 Content-Type: text/x-patch; name=expmed-swap.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="expmed-swap.patch" Content-length: 4416 commit 20372baa835e35e365117b4e3f6bdc5e28a78a98 Author: Kyrylo Tkachov Date: Thu Mar 12 16:22:58 2015 +0000 [expmed] Use std::swap instead of manual swapping diff --git a/gcc/expmed.c b/gcc/expmed.c index d2b2534..e84ab36 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2551,9 +2551,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency +=3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D m; best_alg->op[best_alg->ops] =3D alg_shift; } @@ -2582,9 +2581,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency +=3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D m; best_alg->op[best_alg->ops] =3D alg_shift; } @@ -2624,9 +2622,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency +=3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D 0; best_alg->op[best_alg->ops] =3D alg_sub_t_m2; } @@ -2644,9 +2641,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency +=3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D 0; best_alg->op[best_alg->ops] =3D alg_add_t_m2; } @@ -2667,9 +2663,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency +=3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D m; best_alg->op[best_alg->ops] =3D alg_sub_t_m2; } @@ -2723,9 +2718,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency =3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D m; best_alg->op[best_alg->ops] =3D alg_add_factor; } @@ -2762,9 +2756,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency =3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D m; best_alg->op[best_alg->ops] =3D alg_sub_factor; } @@ -2793,9 +2786,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency +=3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D m; best_alg->op[best_alg->ops] =3D alg_add_t2_m; } @@ -2818,9 +2810,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_= WIDE_INT t, alg_in->cost.latency +=3D op_cost; if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost)) { - struct algorithm *x; best_cost =3D alg_in->cost; - x =3D alg_in, alg_in =3D best_alg, best_alg =3D x; + std::swap (alg_in, best_alg); best_alg->log[best_alg->ops] =3D m; best_alg->op[best_alg->ops] =3D alg_sub_t2_m; }= --------------060509050406000903080707--