Andrew Pinski <[EMAIL PROTECTED]> 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,[EMAIL PROTECTED] # tmp121,
lfd %f1,[EMAIL PROTECTED](%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,[EMAIL PROTECTED](%r0) # osv, D.1144
fmr %f1,%f0 # <result>, <result>
blr #
While the ideal code would be:
...
osvf:
.LFB2:
lfd %f1,[EMAIL PROTECTED](%r0) # osv, D.1144
blr #
--
Sergei.