From 0c662155b29891fe17f027710993b87186c4401d Mon Sep 17 00:00:00 2001 From: ktkachov Date: Mon, 21 Sep 2015 10:07:44 +0000 Subject: [PATCH] [ARM] Replacing variable swaps that use a temporary variable with a call to std::swap in gcc/config/arm/arm.c On behalf of 2015-09-21 Bilyan Borisov * config/arm/arm.c (thumb_output_move_mem_multiple): Replaced operands[4] operands[5] swap with std::swap, removed tmp variable. (arm_evpc_neon_vzip): Replaced in0/in1 and out0/out1 swaps with std::swap, removed x variable. (arm_evpc_neon_vtrn): Replaced in0/int1 and out0/out1 swaos with std::swap, removed x variable. (arm_expand_vec_perm_const_1): Replaced d->op0/d->op1 swap with std::swap, removed x variable. (arm_evpc_neon_vuzp): Replaced in0/in1 and out0/out1 swaps with std::swap, removed x variable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227963 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/config/arm/arm.c | 32 ++++++++++++-------------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c79ba8833d..93df84b82f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2015-09-21 Bilyan Borisov + + * config/arm/arm.c (thumb_output_move_mem_multiple): Replaced + operands[4] operands[5] swap with std::swap, removed tmp variable. + (arm_evpc_neon_vzip): Replaced in0/in1 and + out0/out1 swaps with std::swap, removed x variable. + (arm_evpc_neon_vtrn): Replaced in0/int1 and + out0/out1 swaos with std::swap, removed x variable. + (arm_expand_vec_perm_const_1): Replaced + d->op0/d->op1 swap with std::swap, removed x variable. + (arm_evpc_neon_vuzp): Replaced in0/in1 and + out0/out1 swaps with std::swap, removed x variable. + 2015-09-21 Jonathan Yong <10walls@gmail.com> * config/i386/cygwin.h (STARTFILE_SPEC): Explicitly search diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index b0239776b0c..02f5dc37ead 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -25656,17 +25656,12 @@ thumb_load_double_from_address (rtx *operands) const char * thumb_output_move_mem_multiple (int n, rtx *operands) { - rtx tmp; - switch (n) { case 2: if (REGNO (operands[4]) > REGNO (operands[5])) - { - tmp = operands[4]; - operands[4] = operands[5]; - operands[5] = tmp; - } + std::swap (operands[4], operands[5]); + output_asm_insn ("ldmia\t%1!, {%4, %5}", operands); output_asm_insn ("stmia\t%0!, {%4, %5}", operands); break; @@ -28216,7 +28211,7 @@ static bool arm_evpc_neon_vuzp (struct expand_vec_perm_d *d) { unsigned int i, odd, mask, nelt = d->nelt; - rtx out0, out1, in0, in1, x; + rtx out0, out1, in0, in1; rtx (*gen)(rtx, rtx, rtx, rtx); if (GET_MODE_UNIT_SIZE (d->vmode) >= 8) @@ -28260,14 +28255,14 @@ arm_evpc_neon_vuzp (struct expand_vec_perm_d *d) in1 = d->op1; if (BYTES_BIG_ENDIAN) { - x = in0, in0 = in1, in1 = x; + std::swap (in0, in1); odd = !odd; } out0 = d->target; out1 = gen_reg_rtx (d->vmode); if (odd) - x = out0, out0 = out1, out1 = x; + std::swap (out0, out1); emit_insn (gen (out0, in0, in1, out1)); return true; @@ -28279,7 +28274,7 @@ static bool arm_evpc_neon_vzip (struct expand_vec_perm_d *d) { unsigned int i, high, mask, nelt = d->nelt; - rtx out0, out1, in0, in1, x; + rtx out0, out1, in0, in1; rtx (*gen)(rtx, rtx, rtx, rtx); if (GET_MODE_UNIT_SIZE (d->vmode) >= 8) @@ -28327,14 +28322,14 @@ arm_evpc_neon_vzip (struct expand_vec_perm_d *d) in1 = d->op1; if (BYTES_BIG_ENDIAN) { - x = in0, in0 = in1, in1 = x; + std::swap (in0, in1); high = !high; } out0 = d->target; out1 = gen_reg_rtx (d->vmode); if (high) - x = out0, out0 = out1, out1 = x; + std::swap (out0, out1); emit_insn (gen (out0, in0, in1, out1)); return true; @@ -28420,7 +28415,7 @@ static bool arm_evpc_neon_vtrn (struct expand_vec_perm_d *d) { unsigned int i, odd, mask, nelt = d->nelt; - rtx out0, out1, in0, in1, x; + rtx out0, out1, in0, in1; rtx (*gen)(rtx, rtx, rtx, rtx); if (GET_MODE_UNIT_SIZE (d->vmode) >= 8) @@ -28465,14 +28460,14 @@ arm_evpc_neon_vtrn (struct expand_vec_perm_d *d) in1 = d->op1; if (BYTES_BIG_ENDIAN) { - x = in0, in0 = in1, in1 = x; + std::swap (in0, in1); odd = !odd; } out0 = d->target; out1 = gen_reg_rtx (d->vmode); if (odd) - x = out0, out0 = out1, out1 = x; + std::swap (out0, out1); emit_insn (gen (out0, in0, in1, out1)); return true; @@ -28595,14 +28590,11 @@ arm_expand_vec_perm_const_1 (struct expand_vec_perm_d *d) if (d->perm[0] >= d->nelt) { unsigned i, nelt = d->nelt; - rtx x; for (i = 0; i < nelt; ++i) d->perm[i] = (d->perm[i] + nelt) & (2 * nelt - 1); - x = d->op0; - d->op0 = d->op1; - d->op1 = x; + std::swap (d->op0, d->op1); } if (TARGET_NEON) -- 2.11.4.GIT