diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 758c3adbaf3..747264ce9b2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2014-11-16 Uros Bizjak + + * config/sh/sh.c: Do not include algorithm. + (sh_emit_scc_to_t): Replace open-coded swap with std::swap + to swap values. + (sh_emit_compare_and_branch): Ditto. + (sh_emit_compare_and_set): Ditto. + * config/sh/sh.md (replacement peephole2): Ditto. + (cstore4_media): Ditto. + (*fmasf4): Ditto. + 2014-11-15 Vladimir Makarov * lra-remat.c (cand_transf_func): Process regno for diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index be944daa67b..5bac2afbcbc 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see #include #include -#include #include "config.h" #include "system.h" @@ -2351,11 +2350,7 @@ sh_emit_scc_to_t (enum rtx_code code, rtx op0, rtx op1) break; } if (code != oldcode) - { - rtx tmp = op0; - op0 = op1; - op1 = tmp; - } + std::swap (op0, op1); mode = GET_MODE (op0); if (mode == VOIDmode) @@ -2436,7 +2431,7 @@ sh_emit_compare_and_branch (rtx *operands, machine_mode mode) enum rtx_code branch_code; rtx op0 = operands[1]; rtx op1 = operands[2]; - rtx insn, tem; + rtx insn; bool need_ccmpeq = false; if (TARGET_SH2E && GET_MODE_CLASS (mode) == MODE_FLOAT) @@ -2461,7 +2456,7 @@ sh_emit_compare_and_branch (rtx *operands, machine_mode mode) || (code == LE && TARGET_IEEE && TARGET_SH2E) || (code == GE && !(TARGET_IEEE && TARGET_SH2E))) { - tem = op0, op0 = op1, op1 = tem; + std::swap (op0, op1); code = swap_condition (code); } @@ -2520,7 +2515,6 @@ sh_emit_compare_and_set (rtx *operands, machine_mode mode) rtx op1 = operands[3]; rtx_code_label *lab = NULL; bool invert = false; - rtx tem; op0 = force_reg (mode, op0); if ((code != EQ && code != NE @@ -2534,8 +2528,8 @@ sh_emit_compare_and_set (rtx *operands, machine_mode mode) { if (code == LT || code == LE) { + std::swap (op0, op1); code = swap_condition (code); - tem = op0, op0 = op1, op1 = tem; } if (code == GE) { diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 8246143fc51..7b902953ac6 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -1618,14 +1618,9 @@ extract_insn (insn2); if (! constrain_operands (1, get_preferred_alternatives (insn2, bb))) { - rtx tmp; failure: - tmp = replacements[0]; - replacements[0] = replacements[1]; - replacements[1] = tmp; - tmp = replacements[2]; - replacements[2] = replacements[3]; - replacements[3] = tmp; + std::swap (replacements[0], replacements[1]); + std::swap (replacements[2], replacements[3]); replace_n_hard_rtx (SET_DEST (set1), replacements, 2, 1); replace_n_hard_rtx (SET_DEST (set2), replacements, 2, 1); replace_n_hard_rtx (SET_SRC (set2), replacements, 2, 1); @@ -11348,9 +11343,7 @@ label: if (swap) { - rtx tem = operands[2]; - operands[2] = operands[3]; - operands[3] = tem; + std::swap (operands[2], operands[3]); code = swap_condition (code); } @@ -12538,11 +12531,7 @@ label: /* Change 'b * a + a' into 'a * b + a'. This is better for register allocation. */ if (REGNO (operands[2]) == REGNO (operands[3])) - { - rtx tmp = operands[1]; - operands[1] = operands[2]; - operands[2] = tmp; - } + std::swap (operands[1], operands[2]); } [(set_attr "type" "fp") (set_attr "fp_mode" "single")])