diff mbox

[AArch64] Use std::swap instead of manually swapping

Message ID 54647D03.10803@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Nov. 13, 2014, 9:42 a.m. UTC
Hi all,

Following the trend in i386 and alpha, this patch uses std::swap to 
perform swapping of values in the aarch64 backend instead of declaring 
temporaries.
Tested and bootstrapped on aarch64-linux.

Ok for trunk?

Thanks,
Kyrill


2014-11-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/aarch64/aarch64.c (aarch64_evpc_ext): Use std::swap instead
     of manual swapping implementation.
     (aarch64_expand_vec_perm_const_1): Likewise.

Comments

Kyrylo Tkachov Nov. 27, 2014, 3:37 p.m. UTC | #1
Ping.

Thanks,
Kyrill

On 13/11/14 09:42, Kyrill Tkachov wrote:
> Hi all,
>
> Following the trend in i386 and alpha, this patch uses std::swap to
> perform swapping of values in the aarch64 backend instead of declaring
> temporaries.
> Tested and bootstrapped on aarch64-linux.
>
> Ok for trunk?
>
> Thanks,
> Kyrill
>
>
> 2014-11-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>       * config/aarch64/aarch64.c (aarch64_evpc_ext): Use std::swap instead
>       of manual swapping implementation.
>       (aarch64_expand_vec_perm_const_1): Likewise.
Kyrylo Tkachov Dec. 5, 2014, 4:40 p.m. UTC | #2
Ping.

https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01426.html

Thanks,
Kyrill

On 27/11/14 15:37, Kyrill Tkachov wrote:
> Ping.
>
> Thanks,
> Kyrill
>
> On 13/11/14 09:42, Kyrill Tkachov wrote:
>> Hi all,
>>
>> Following the trend in i386 and alpha, this patch uses std::swap to
>> perform swapping of values in the aarch64 backend instead of declaring
>> temporaries.
>> Tested and bootstrapped on aarch64-linux.
>>
>> Ok for trunk?
>>
>> Thanks,
>> Kyrill
>>
>>
>> 2014-11-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>
>>        * config/aarch64/aarch64.c (aarch64_evpc_ext): Use std::swap instead
>>        of manual swapping implementation.
>>        (aarch64_expand_vec_perm_const_1): Likewise.
>
>
Kyrylo Tkachov Dec. 12, 2014, 11:36 a.m. UTC | #3
Ping.

Marcus: Uros pointed out to me that these kinds of changes are 
considered obvious
(with precedent athttps://gcc.gnu.org/ml/gcc-patches/2014-12/msg00309.html)
but did you have some concerns about backporting to other branches?

Kyrill

On 05/12/14 16:40, Kyrill Tkachov wrote:
> Ping.
>
> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01426.html
>
> Thanks,
> Kyrill
>
> On 27/11/14 15:37, Kyrill Tkachov wrote:
>> Ping.
>>
>> Thanks,
>> Kyrill
>>
>> On 13/11/14 09:42, Kyrill Tkachov wrote:
>>> Hi all,
>>>
>>> Following the trend in i386 and alpha, this patch uses std::swap to
>>> perform swapping of values in the aarch64 backend instead of declaring
>>> temporaries.
>>> Tested and bootstrapped on aarch64-linux.
>>>
>>> Ok for trunk?
>>>
>>> Thanks,
>>> Kyrill
>>>
>>>
>>> 2014-11-13  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>>
>>>         * config/aarch64/aarch64.c (aarch64_evpc_ext): Use std::swap instead
>>>         of manual swapping implementation.
>>>         (aarch64_expand_vec_perm_const_1): Likewise.
>>
>
>
Mike Stump Dec. 12, 2014, 9:18 p.m. UTC | #4
On Dec 12, 2014, at 3:36 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> Marcus: Uros pointed out to me that these kinds of changes are considered obvious
> (with precedent athttps://gcc.gnu.org/ml/gcc-patches/2014-12/msg00309.html)
> but did you have some concerns about backporting to other branches?

So in general, there is no need to back port this to a previous release branch.  Unless it fixed a compelling bug in that release branch, or was possibly incidental to some other fix that did, it should not be back ported.  A private vendor release branch or a personal branch, well, they can do what they want on it, the owner would have to weigh in.
diff mbox

Patch

commit 20ce59f52c26f99ad3939597c5cd41a0cdc8a751
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Wed Nov 12 15:41:05 2014 +0000

    [AArch64] Use std::swap

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index d1f5673..f92b23a 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -9428,9 +9428,7 @@  aarch64_evpc_ext (struct expand_vec_perm_d *d)
       /* After setup, we want the high elements of the first vector (stored
          at the LSB end of the register), and the low elements of the second
          vector (stored at the MSB end of the register). So swap.  */
-      rtx temp = d->op0;
-      d->op0 = d->op1;
-      d->op1 = temp;
+      std::swap (d->op0, d->op1);
       /* location != 0 (above), so safe to assume (nelt - location) < nelt.  */
       location = nelt - location;
     }
@@ -9601,15 +9599,12 @@  aarch64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d)
   if (d->perm[0] >= d->nelt)
     {
       unsigned i, nelt = d->nelt;
-      rtx x;
 
       gcc_assert (nelt == (nelt & -nelt));
       for (i = 0; i < nelt; ++i)
 	d->perm[i] ^= nelt; /* Keep the same index, but in the other vector.  */
 
-      x = d->op0;
-      d->op0 = d->op1;
-      d->op1 = x;
+      std::swap (d->op0, d->op1);
     }
 
   if (TARGET_SIMD)