aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2015-03-18 12:01:24 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2015-03-18 12:01:24 +0000
commit076701b69d3a1f02e46df451ab9cb092863e5baa (patch)
tree3ec2433a8c1092dee7246adf698e27396ebf5658
parentfbf524de7b7f81d26b43a49c766ca6d1ac41457c (diff)
downloadgcc-076701b69d3a1f02e46df451ab9cb092863e5baa.zip
gcc-076701b69d3a1f02e46df451ab9cb092863e5baa.tar.gz
gcc-076701b69d3a1f02e46df451ab9cb092863e5baa.tar.bz2
[expmed][cleanup] Use std::swap instead of manual swapping
* expmed.c (synth_mult): Use std::swap instead of manually swapping algorithms. From-SVN: r221486
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/expmed.c27
2 files changed, 14 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 77abe67..d2ff5c0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * expmed.c (synth_mult): Use std::swap instead of manually
+ swapping algorithms.
+
2015-03-18 Jakub Jelinek <jakub@redhat.com>
PR target/65078
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 0034203..8d4f964 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 += op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = m;
best_alg->op[best_alg->ops] = alg_shift;
}
@@ -2582,9 +2581,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
alg_in->cost.latency += op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = m;
best_alg->op[best_alg->ops] = alg_shift;
}
@@ -2624,9 +2622,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
alg_in->cost.latency += op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = 0;
best_alg->op[best_alg->ops] = alg_sub_t_m2;
}
@@ -2644,9 +2641,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
alg_in->cost.latency += op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = 0;
best_alg->op[best_alg->ops] = alg_add_t_m2;
}
@@ -2667,9 +2663,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
alg_in->cost.latency += op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = m;
best_alg->op[best_alg->ops] = alg_sub_t_m2;
}
@@ -2723,9 +2718,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
alg_in->cost.latency = op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = m;
best_alg->op[best_alg->ops] = alg_add_factor;
}
@@ -2762,9 +2756,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
alg_in->cost.latency = op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = m;
best_alg->op[best_alg->ops] = alg_sub_factor;
}
@@ -2793,9 +2786,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
alg_in->cost.latency += op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = m;
best_alg->op[best_alg->ops] = alg_add_t2_m;
}
@@ -2818,9 +2810,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
alg_in->cost.latency += op_cost;
if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
{
- struct algorithm *x;
best_cost = alg_in->cost;
- x = alg_in, alg_in = best_alg, best_alg = x;
+ std::swap (alg_in, best_alg);
best_alg->log[best_alg->ops] = m;
best_alg->op[best_alg->ops] = alg_sub_t2_m;
}