This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to replace -O1 with corresponding -f's?
Andrew Pinski <pinskia@physics.uc.edu> writes:
> On Jun 20, 2005, at 9:38 AM, Sergei Organov wrote:
>
> > 2. The resulting assembly is different from what I get with -O1 and
> > doesn't contain the mis-optimization I'm trying to debug though it
> > doesn't seem to have anything to do with loops. For reference, the
> > code I'm trying to compile is:
> >
> > extern double const osv;
> > double const osv = 314314314;
> > double osvf() { return osv; }
>
> I don't see anything wrong with what it gives for -O0 and -O2.
Well, it's on PowerPC with its small constant data sections.
With -O1 I get:
.globl osv
.section .sdata2,"a",@progbits
.align 3
.type osv, @object
.size osv, 8
osv:
.long 1102232590
.long 1241513984
.section .rodata.cst8,"aM",@progbits,8
.align 3
.LC0:
.long 1102232590
.long 1241513984
.section ".text"
.align 2
.globl osvf
.type osvf, @function
osvf:
lis %r9,.LC0@ha # tmp121,
lfd %f1,.LC0@l(%r9) #, <result>
blr #
With -O0 and a bunch of -f's from -O1 I get:
.globl osv
.section .sdata2,"a",@progbits
.align 3
.type osv, @object
.size osv, 8
osv:
.long 1102232590
.long 1241513984
.section ".text"
.align 2
.globl osvf
.type osvf, @function
osvf:
.LFB2:
lfd %f0,osv@sda21(%r0) # osv, D.1144
fmr %f1,%f0 # <result>, <result>
blr #
While the ideal code would be:
...
osvf:
.LFB2:
lfd %f1,osv@sda21(%r0) # osv, D.1144
blr #
--
Sergei.