Hello!

2014-11-16  Uros Bizjak  <ubiz...@gmail.com>

    * 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.

Tested by building a crosscompiler to sh-elf, otherwise untested.

Uros.
Index: sh.c
===================================================================
--- sh.c        (revision 217624)
+++ sh.c        (working copy)
@@ -21,7 +21,6 @@ along with GCC; see the file COPYING3.  If not see
 
 #include <sstream>
 #include <vector>
-#include <algorithm>
 
 #include "config.h"
 #include "system.h"
@@ -2351,11 +2350,7 @@ sh_emit_scc_to_t (enum rtx_code code, rtx op0, rtx
       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
   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
          || (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_mo
   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_mo
     {
       if (code == LT || code == LE)
        {
+         std::swap (op0, op1);
          code = swap_condition (code);
-         tem = op0, op0 = op1, op1 = tem;
        }
       if (code == GE)
        {
Index: sh.md
===================================================================
--- sh.md       (revision 217624)
+++ sh.md       (working copy)
@@ -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")])

Reply via email to