This is the mail archive of the gcc-bugs@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]

redundant FPU reads on i386-linux


compiler: egcs-19981026
    host: i386-linux
    file: ftp://shell14.ba.best.com/pub.t/tm2/matrix.c
 options: -O2

GCC appears storing a value to a stack slot and immediately reloading
the value, which is probably suboptimal. It may be better to duplicate 
the value and store it instead...

00001090 <gl_Ortho+30> fstps  0xffffffbc(%ebp)
00001093 <gl_Ortho+33> flds   0xffffffbc(%ebp)
...
000010f6 <gl_Ortho+96> fstps  0xffffffbc(%ebp)
000010f9 <gl_Ortho+99> flds   0xffffffbc(%ebp)

There are some redundant load/stores here:

00001101 <gl_Ortho+a1> fstps  0xffffffbc(%ebp)
00001104 <gl_Ortho+a4> flds   0xffffffbc(%ebp)
00001107 <gl_Ortho+a7> fstps  0xfffffff4(%ebp)
0000110a <gl_Ortho+aa> fstps  0xffffffbc(%ebp)
0000110d <gl_Ortho+ad> flds   0xffffffbc(%ebp)

This is nasty because it's a store/load/modify/store/load;

00001146 <gl_Ortho+e6> fstps  0xffffffbc(%ebp)
00001149 <gl_Ortho+e9> flds   0xffffffbc(%ebp)
0000114c <gl_Ortho+ec> subl   $0x4,%esp
0000114f <gl_Ortho+ef> fstps  (%esp,1)
00001152 <gl_Ortho+f2> fldl   0x2c(%ebp)
00001155 <gl_Ortho+f5> fstps  0xffffffbc(%ebp)
00001158 <gl_Ortho+f8> flds   0xffffffbc(%ebp)

Toshi



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