This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] ppc64 rs6000_emit_set_long_const improvements
On Thu, Jan 07, 2010 at 02:24:44PM -0500, David Edelsohn wrote:
> I did a quick C-only bootstrap and testsuite run on AIX. If this
> bootstraps successfully on powerpc64-linux, the patch is fine.
>
> An incremental solution is fine. Let's fix the cases we can now and
> figure out how to address the remaining two instruction DImode
> CONST_INT cases in the next patch.
The patch was incomplete, as it didn't update num_insns_constant_wide,
on the other side as I said most of the changes wouldn't ever make a
difference.
So, let's move in smaller steps. The rest can be addressed later.
Here is what I've bootstrapped/regtested on powerpc64-linux.
Ok for trunk?
2010-01-08 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (rs6000_emit_set_long_const): Shorten
sequence for DImode constants >= 0x80000000UL <= 0xFFFFFFFFUL by
1 insn.
(num_insns_constant_wide): Adjust for that change.
--- gcc/config/rs6000/rs6000.c.jj 2010-01-07 12:11:32.000000000 +0100
+++ gcc/config/rs6000/rs6000.c 2010-01-08 12:16:20.199916418 +0100
@@ -3794,6 +3794,8 @@ num_insns_constant_wide (HOST_WIDE_INT v
if (low == 0)
return num_insns_constant_wide (high) + 1;
+ else if (high == 0)
+ return num_insns_constant_wide (low) + 1;
else
return (num_insns_constant_wide (high)
+ num_insns_constant_wide (low) + 1);
@@ -6143,6 +6145,20 @@ rs6000_emit_set_long_const (rtx dest, HO
gen_rtx_IOR (DImode, copy_rtx (dest),
GEN_INT (ud1)));
}
+ else if (ud3 == 0 && ud4 == 0)
+ {
+ gcc_assert (ud2 & 0x8000);
+ 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),
+ GEN_INT (ud1)));
+ emit_move_insn (copy_rtx (dest),
+ gen_rtx_ZERO_EXTEND (DImode,
+ gen_lowpart (SImode,
+ copy_rtx (dest))));
+ }
else if ((ud4 == 0xffff && (ud3 & 0x8000))
|| (ud4 == 0 && ! (ud3 & 0x8000)))
{
Jakub