public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386]: Use std::swap some more.
@ 2014-12-30 15:23 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2014-12-30 15:23 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

Hello!

2014-12-30  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.c (ix86_legitimize_address): Use std::swap.
    (ix86_split_fp_branch): Ditto.
    (ix86_expand_int_movcc): Ditto.
    (ix86_expand_sse_compare): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32} ,
committed to mainline SVN.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1836 bytes --]

Index: i386.c
===================================================================
--- i386.c	(revision 219107)
+++ i386.c	(working copy)
@@ -14362,9 +14362,7 @@ ix86_legitimize_address (rtx x, rtx, machine_mode
       /* Put multiply first if it isn't already.  */
       if (GET_CODE (XEXP (x, 1)) == MULT)
 	{
-	  rtx tmp = XEXP (x, 0);
-	  XEXP (x, 0) = XEXP (x, 1);
-	  XEXP (x, 1) = tmp;
+	  std::swap (XEXP (x, 0), XEXP (x, 1));
 	  changed = 1;
 	}
 
@@ -20497,10 +20495,8 @@ ix86_split_fp_branch (enum rtx_code code, rtx op1,
 
   if (target2 != pc_rtx)
     {
-      rtx tmp = target2;
+      std::swap (target1, target2);
       code = reverse_condition_maybe_unordered (code);
-      target2 = target1;
-      target1 = tmp;
     }
 
   condition = ix86_expand_fp_compare (code, op1, op2,
@@ -20720,9 +20716,7 @@ ix86_expand_int_movcc (rtx operands[])
 	      /* To simplify rest of code, restrict to the GEU case.  */
 	      if (compare_code == LTU)
 		{
-		  HOST_WIDE_INT tmp = ct;
-		  ct = cf;
-		  cf = tmp;
+		  std::swap (ct, cf);
 		  compare_code = reverse_condition (compare_code);
 		  code = reverse_condition (code);
 		}
@@ -20754,9 +20748,7 @@ ix86_expand_int_movcc (rtx operands[])
 		code = reverse_condition (code);
 	      else
 		{
-		  HOST_WIDE_INT tmp = ct;
-		  ct = cf;
-		  cf = tmp;
+		  std::swap (ct, cf);
 		  diff = ct - cf;
 		}
 	      tmp = emit_store_flag (tmp, code, op0, op1, VOIDmode, 0, -1);
@@ -36036,12 +36028,7 @@ ix86_expand_sse_compare (const struct builtin_desc
   /* Swap operands if we have a comparison that isn't available in
      hardware.  */
   if (swap)
-    {
-      rtx tmp = gen_reg_rtx (mode1);
-      emit_move_insn (tmp, op1);
-      op1 = op0;
-      op0 = tmp;
-    }
+    std::swap (op0, op1);
 
   if (optimize || !target
       || GET_MODE (target) != tmode

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-30 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-30 15:23 [PATCH, i386]: Use std::swap some more Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).