Patch: fix compress_float_constant heuristics

Dale Johannesen dalej@apple.com
Mon Jul 11 01:57:00 GMT 2005


This adds a simple cost comparison to compress_float_constant, so that
loading and extending a float constant from memory will not be preferred
to loading a double constant if the latter is cheaper.

The possibility exists that rtx_cost for some of the targets I am 
unable to test
will have have latent bugs that cause this patch to do the wrong thing.
This was the case on rs6000, and the patch includes a fix; I've 
verified that
x86 does the right thing for both 387 and sse modes.

Paolo Bonzini suggested the other targets at risk are sparc, mips, alpha
and vax.  Sparc doesn't have a load-and-convert instruction and it 
appears that
Mips doesn't either, so they shouldn't be an issue.   Can I get some 
help from
the maintainers of the other two?  If you could see whether the patch 
does the
right thing on your target (whatever it is) for a simple test like

double foo (double x) {
   return x + 1.75;
}

that should suffice.  I think alpha may need such an adjustment, but I 
can't test it.
Bootstrapped and tested on darwin-ppc, built and verified that patch 
does what it's
supposed to on darwin-x86.
OK?

2005-07-10  Dale Johannesen  <dalej@apple.com>

         * expr.c (compress_float_constant):  Add cost check.
         * config/rs6000.c (rs6000_rtx_cost):  Adjust FLOAT_EXTEND cost.

2005-07-10  Dale Johannesen  <dalej@apple.com>

         * gcc.dg/compress-float-i386-sse.c:  New.
         * gcc.dg/compress-float-i386-sse-pic.c:  New.
         * gcc.dg/compress-float-i386-387.c:  New.
         * gcc.dg/compress-float-i386-387-pic.c:  New.
         * gcc.dg/compress-float-ppc.c:  New.
         * gcc.dg/compress-float-ppc-pic.c:  New.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs3.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050711/cbe16d67/attachment.txt>
-------------- next part --------------

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: compress-float-i386-387-pic.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050711/cbe16d67/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: compress-float-i386-387.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050711/cbe16d67/attachment-0001.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: compress-float-i386-sse-pic.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050711/cbe16d67/attachment-0002.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: compress-float-i386-sse.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050711/cbe16d67/attachment-0003.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: compress-float-ppc-pic.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050711/cbe16d67/attachment-0004.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: compress-float-ppc.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050711/cbe16d67/attachment-0005.c>


More information about the Gcc-patches mailing list