Patchwork rs6000_emit_set_long_const tidy

login
register
mail settings
Submitter Alan Modra
Date April 24, 2013, 11:04 a.m.
Message ID <20130424110441.GP22536@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/239161/
State New
Headers show

Comments

Alan Modra - April 24, 2013, 11:04 a.m.
This just removes some unnecessary tests.  It's easy to see that if
the sign bit isn't set then xor 0x8000 followed by subtract 0x8000
leaves the value unchanged.  Bootstrapped etc. powerpc-linux.  OK
for mainline?

	* config/rs6000/rs6000.c (rs6000_emit_set_long_const): Tidy.
David Edelsohn - April 24, 2013, 1:54 p.m.
On Wed, Apr 24, 2013 at 7:04 AM, Alan Modra <amodra@gmail.com> wrote:
> This just removes some unnecessary tests.  It's easy to see that if
> the sign bit isn't set then xor 0x8000 followed by subtract 0x8000
> leaves the value unchanged.  Bootstrapped etc. powerpc-linux.  OK
> for mainline?
>
>         * config/rs6000/rs6000.c (rs6000_emit_set_long_const): Tidy.

This is okay.

Thanks, David

Patch

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 198174)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -7104,21 +7104,13 @@  rs6000_emit_set_long_const (rtx dest, HOST_WIDE_IN
 
       if ((ud4 == 0xffff && ud3 == 0xffff && ud2 == 0xffff && (ud1 & 0x8000))
 	  || (ud4 == 0 && ud3 == 0 && ud2 == 0 && ! (ud1 & 0x8000)))
-	{
-	  if (ud1 & 0x8000)
-	    emit_move_insn (dest, GEN_INT (((ud1 ^ 0x8000) -  0x8000)));
-	  else
-	    emit_move_insn (dest, GEN_INT (ud1));
-	}
+	emit_move_insn (dest, GEN_INT ((ud1 ^ 0x8000) - 0x8000));
 
       else if ((ud4 == 0xffff && ud3 == 0xffff && (ud2 & 0x8000))
 	       || (ud4 == 0 && ud3 == 0 && ! (ud2 & 0x8000)))
 	{
-	  if (ud2 & 0x8000)
-	    emit_move_insn (dest, GEN_INT (((ud2 << 16) ^ 0x80000000)
-					   - 0x80000000));
-	  else
-	    emit_move_insn (dest, GEN_INT (ud2 << 16));
+	  emit_move_insn (dest, GEN_INT (((ud2 << 16) ^ 0x80000000)
+					 - 0x80000000));
 	  if (ud1 != 0)
 	    emit_move_insn (copy_rtx (dest),
 			    gen_rtx_IOR (DImode, copy_rtx (dest),
@@ -7141,12 +7133,8 @@  rs6000_emit_set_long_const (rtx dest, HOST_WIDE_IN
       else if ((ud4 == 0xffff && (ud3 & 0x8000))
 	       || (ud4 == 0 && ! (ud3 & 0x8000)))
 	{
-	  if (ud3 & 0x8000)
-	    emit_move_insn (dest, GEN_INT (((ud3 << 16) ^ 0x80000000)
-					   - 0x80000000));
-	  else
-	    emit_move_insn (dest, GEN_INT (ud3 << 16));
-
+	  emit_move_insn (dest, GEN_INT (((ud3 << 16) ^ 0x80000000)
+					 - 0x80000000));
 	  if (ud2 != 0)
 	    emit_move_insn (copy_rtx (dest),
 			    gen_rtx_IOR (DImode, copy_rtx (dest),
@@ -7161,12 +7149,8 @@  rs6000_emit_set_long_const (rtx dest, HOST_WIDE_IN
 	}
       else
 	{
-	  if (ud4 & 0x8000)
-	    emit_move_insn (dest, GEN_INT (((ud4 << 16) ^ 0x80000000)
-					   - 0x80000000));
-	  else
-	    emit_move_insn (dest, GEN_INT (ud4 << 16));
-
+	  emit_move_insn (dest, GEN_INT (((ud4 << 16) ^ 0x80000000)
+					 - 0x80000000));
 	  if (ud3 != 0)
 	    emit_move_insn (copy_rtx (dest),
 			    gen_rtx_IOR (DImode, copy_rtx (dest),
@@ -7181,7 +7165,8 @@  rs6000_emit_set_long_const (rtx dest, HOST_WIDE_IN
 					 GEN_INT (ud2 << 16)));
 	  if (ud1 != 0)
 	    emit_move_insn (copy_rtx (dest),
-			    gen_rtx_IOR (DImode, copy_rtx (dest), GEN_INT (ud1)));
+			    gen_rtx_IOR (DImode, copy_rtx (dest),
+					 GEN_INT (ud1)));
 	}
     }
   return dest;