This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR 15492: floating-point arguments are loaded too early to x87stack
Florian Weimer wrote:
You have to run benchmarks to see if this is actually a problem. fmul
with a memory operand seems to be awfully slow.
Have you actually benchmarked the code? I wouldn't be too surprised
if in this case, too, the more complicated -O2 code was faster.
Not yet, but it looks that schedule-insns2 pass is moving instructions
around and it looks that something is wrong for pentium4. Testcase from
PR 15492:
double test1 (double a, int x, double b, int y, double c)
{
return sin (c) + tan (b) / sqrt (a) + x * fabs (b) + y;
}
[
produces with "-O2 -ffast-math -fomit-frame-pointer":
;; Function test1
;; ======================================================
;; -- basic block 0 from 6 to 49 -- after reload
;; ======================================================
;; 0--> 6 st(2)=[sp+0x4] :decodern,p2
;; 1--> 18 st(2)=sqrt(st(2))
:decodern,(p0+fdiv),fdiv*30
;; 1--> 8 st(3)=[sp+0x10] :decodern,p2
;; 2--> 45 st(4)=st(3) :decodern,p0
;; 2--> 43 st=[sp+0x1c] :decodern,p2
;; 3--> 46 st(3)=abs(st(3)) :decodern,p0
;; 32--> 20 st(2)=[`*.LC1']/st(2)
:decoder0,(p2+p0+fdiv),fdiv*30
;; 63--> 17 {st(4)=unspec[st(4)]
82;st(1)=unspe:decodern,(p0+fdiv),fdiv*30
;; 94--> 42 st=unspec[st] 21
:decodern,(p0+fdiv),fdiv*30
;; 95--> 21 st(1)=st(1)*st(2) :decodern,p0
;; 126--> 22 st=st+st(1) :decodern,p0
;; 126--> 23 st(1)=flt([sp+0xc]) :decodern,p2
;; 132--> 25 st(1)=st(1)*st(3) :decodern,p0
;; 135--> 26 st=st+st(1) :decodern,p0
;; 135--> 27 st(1)=flt([sp+0x18]) :decodern,p2
;; 141--> 28 st=st+st(1) :decodern,p0
;; 141--> 38 use st :nothing
;; 144--> 49 return :decoder0
;; Ready list (final):
;; total time = 144
;; new head = 7
;; new tail = 49
but for pentium4, "-O2 -ffast-math -fomit-frame-pointer -march=pentium4":
;; Function test1
;; ======================================================
;; -- basic block 0 from 6 to 52 -- after reload
;; ======================================================
;; 0--> 8 st(5)=[sp+0x10] :nothing
;; 0--> 6 st(3)=[sp+0x4] :nothing
;; 0--> 44 st=[sp+0x1c] :nothing
;; 1--> 46 st(4)=st(5) :nothing
;; 1--> 43 st=unspec[st] 21 :nothing
;; 1--> 17 {st(4)=unspec[st(4)] 82;st(1)=unspe:nothing
;; 2--> 18 st(3)=sqrt(st(3)) :nothing
;; 2--> 47 st(2)=st(1) :nothing
;; 2--> 20 st(3)=[`*.LC2']/st(3) :nothing
;; 3--> 49 st(5)=abs(st(5)) :nothing
;; 3--> 21 st(2)=st(2)*st(3) :nothing
;; 3--> 26 st(5)=flt([sp+0xc])*st(5) :nothing
;; 4--> 22 st=st+st(2) :nothing
;; 4--> 27 st=st+st(5) :nothing
;; 4--> 29 st=flt([sp+0x18])+st :nothing
;; 5--> 39 use st :nothing
;; 5--> 52 return :decoder0
;; Ready list (final):
;; total time = 5
;; new head = 7
;; new tail = 52
Is there everything OK with fsched-insn2 for pentum4 case?
BTW: "tan (b) / sqrt (a)" part is still calculated as "tan (b) * 1.0 /
sqrt (a)". This is PR 14851.
Uros.