This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] improve float to double on PPC a little


On May 27, 2004, at 5:01 PM, Andrew Pinski wrote:

Since on rs6000, the floating point registers are always in double precision,
the need for conversion is not needed at all. This improves the conversion by
make the cost for the case where the registers are different.

It would be good to teach hard register copyprop that SF->DF conversions are
really copies, too; they can be removed freely. I've had the following patch
in Apple's branch for some time, but don't know how to make it FSF-compliant.
(Might need adjustment now that we have 128-bit long doubles, haven't exercised it.)


--- ./regrename.c Tue Mar 30 19:53:12 2004
*************** static bool
*** 1268,1273 ****
--- 1267,1280 ----
mode_change_ok (enum machine_mode orig_mode, enum machine_mode new_mode,
unsigned int regno ATTRIBUTE_UNUSED)
{
+ /* APPLE LOCAL begin add mode change case */
+ #ifdef TARGET_POWERPC
+ /* This arises from FLOAT_EXTEND which is really a NOP. */
+ if (orig_mode == SFmode && new_mode == DFmode)
+ return true;
+ #endif
+ /* APPLE LOCAL end add mode change case */
+
if (GET_MODE_SIZE (orig_mode) < GET_MODE_SIZE (new_mode))
return false;


*************** copyprop_hardreg_forward_1 (basic_block
*** 1713,1718 ****
--- 1720,1734 ----
        /* Notice copies.  */
        if (set && REG_P (SET_DEST (set)) && REG_P (SET_SRC (set)))
        copy_value (SET_DEST (set), SET_SRC (set), vd);
+       /* APPLE LOCAL begin record that float extend is a copy */
+ #ifdef TARGET_POWERPC
+       /* FLOAT_EXTEND is actually a copy; record that too.  */
+       if (set && REG_P (SET_DEST (set))
+         && GET_CODE (SET_SRC (set)) == FLOAT_EXTEND
+         && REG_P (XEXP (SET_SRC (set), 0)))
+         copy_value (SET_DEST (set), XEXP (SET_SRC (set), 0), vd);
+ #endif
+       /* APPLE LOCAL end record that float extend is a copy */

        if (insn == BB_END (bb))
        break;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]