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

Re: Haney's real matrix test regression


Richard Kenner wrote:

>     In that C++ testsuite (it is a C++ testsuite, indeed), there are two
>     versions of a matrix multiplication loop: one "C++-style", which
>     involves member functions for indexing the matrices, the other one
>     "C-style" wich uses simple array indexing.
>
> Sorry, I misread.  I thought you meant actually written in C.
> The way the alias set code is written, *any* C++ code using aggregate
> types will be compiled much worse than the corresponding code in any
> language except Fortan.

I believe you!

>     Privately, I sent you the "C++-style" version of the test, which
>     indeed shows that the innermost loop is compiled radically better by
>     3.0.2 than current 3.1, you can confirm that??
>
> I can see what happens in 3.1, but I can't easily compile it in other
> versions of the compiler.

If some assembler suffices, this is the reduced testcode I sent you
privately, as compiled by 3.0.2 with -O2, look at the innermost loop, that
from d0 to e6, is almost perfect!

Cheers,
Paolo.

////////////////////////////////////////////////////7

forKenner.o:     file format elf32-i386

Disassembly of section .text:

00000000 <rmatMul(RealMatrix&, RealMatrix const&, RealMatrix const&)>:
   0: 55                    push   %ebp
   1: 89 e5                 mov    %esp,%ebp
   3: 57                    push   %edi
   4: 8b 45 0c              mov    0xc(%ebp),%eax
   7: 56                    push   %esi
   8: 53                    push   %ebx
   9: 83 ec 24              sub    $0x24,%esp
   c: 8b 40 08              mov    0x8(%eax),%eax
   f: 89 45 ec              mov    %eax,0xffffffec(%ebp)
  12: 8b 45 10              mov    0x10(%ebp),%eax
  15: 8b 40 0c              mov    0xc(%eax),%eax
  18: 89 45 e8              mov    %eax,0xffffffe8(%ebp)
  1b: 8b 45 10              mov    0x10(%ebp),%eax
  1e: 8b 55 e8              mov    0xffffffe8(%ebp),%edx
  21: 8b 40 08              mov    0x8(%eax),%eax
  24: c7 45 f0 01 00 00 00  movl   $0x1,0xfffffff0(%ebp)
  2b: 39 55 f0              cmp    %edx,0xfffffff0(%ebp)
  2e: 89 45 e4              mov    %eax,0xffffffe4(%ebp)
  31: 0f 8f d5 00 00 00     jg     10c <rmatMul(RealMatrix&, RealMatrix
const&, RealMatrix const&)+0x10c>
  37: c7 45 d4 00 00 00 00  movl   $0x0,0xffffffd4(%ebp)
  3e: d9 ee                 fldz
  40: c7 45 d0 00 00 00 00  movl   $0x0,0xffffffd0(%ebp)
  47: 89 f6                 mov    %esi,%esi
  49: 8d bc 27 00 00 00 00  lea    0x0(%edi,1),%edi
  50: bf 01 00 00 00        mov    $0x1,%edi
  55: 3b 7d e4              cmp    0xffffffe4(%ebp),%edi
  58: 0f 8f 97 00 00 00     jg     f5 <rmatMul(RealMatrix&, RealMatrix
const&, RealMatrix const&)+0xf5>
  5e: 8b 4d 10              mov    0x10(%ebp),%ecx
  61: d9 c0                 fld    %st(0)
  63: 8b 45 d0              mov    0xffffffd0(%ebp),%eax
  66: 8b 51 08              mov    0x8(%ecx),%edx
  69: c7 45 d8 00 00 00 00  movl   $0x0,0xffffffd8(%ebp)
  70: 0f af c2              imul   %edx,%eax
  73: 8b 55 d4              mov    0xffffffd4(%ebp),%edx
  76: 89 55 dc              mov    %edx,0xffffffdc(%ebp)
  79: 89 45 e0              mov    %eax,0xffffffe0(%ebp)
  7c: 8d 74 26 00           lea    0x0(%esi,1),%esi
  80: 8b 4d e0              mov    0xffffffe0(%ebp),%ecx
  83: 8d 14 39              lea    (%ecx,%edi,1),%edx
  86: 8b 4d 10              mov    0x10(%ebp),%ecx
  89: 8b 41 04              mov    0x4(%ecx),%eax
  8c: d9 44 90 fc           flds   0xfffffffc(%eax,%edx,4)
  90: dd e1                 fucom  %st(1)
  92: df e0                 fnstsw %ax
  94: 9e                    sahf
  95: 7a 02                 jp     99 <rmatMul(RealMatrix&, RealMatrix
const&, RealMatrix const&)+0x99>
  97: 74 4f                 je     e8 <rmatMul(RealMatrix&, RealMatrix
const&, RealMatrix const&)+0xe8>
  99: b9 01 00 00 00        mov    $0x1,%ecx
  9e: 3b 4d ec              cmp    0xffffffec(%ebp),%ecx
  a1: 7f 45                 jg     e8 <rmatMul(RealMatrix&, RealMatrix
const&, RealMatrix const&)+0xe8>
  a3: 8b 55 08              mov    0x8(%ebp),%edx
  a6: 8b 45 dc              mov    0xffffffdc(%ebp),%eax
  a9: 8b 72 08              mov    0x8(%edx),%esi
  ac: 8b 55 0c              mov    0xc(%ebp),%edx
  af: 0f af c6              imul   %esi,%eax
  b2: 8b 75 d8              mov    0xffffffd8(%ebp),%esi
  b5: 8b 5a 08              mov    0x8(%edx),%ebx
  b8: 8b 55 08              mov    0x8(%ebp),%edx
  bb: 0f af f3              imul   %ebx,%esi
  be: 8b 5a 04              mov    0x4(%edx),%ebx
  c1: c1 e0 02              shl    $0x2,%eax
  c4: 01 d8                 add    %ebx,%eax
  c6: 8d 50 04              lea    0x4(%eax),%edx
  c9: 8b 45 0c              mov    0xc(%ebp),%eax
  cc: 8b 58 04              mov    0x4(%eax),%ebx
  cf: 90                    nop

  d0: 8d 04 0e              lea    (%esi,%ecx,1),%eax
  d3: d9 c0                 fld    %st(0)
  d5: 41                    inc    %ecx
  d6: d8 4c 83 fc           fmuls  0xfffffffc(%ebx,%eax,4)
  da: d8 42 fc              fadds  0xfffffffc(%edx)
  dd: d9 5a fc              fstps  0xfffffffc(%edx)
  e0: 83 c2 04              add    $0x4,%edx
  e3: 3b 4d ec              cmp    0xffffffec(%ebp),%ecx
  e6: 7e e8                 jle    d0 <rmatMul(RealMatrix&, RealMatrix
const&, RealMatrix const&)+0xd0>

  e8: dd d8                 fstp   %st(0)
  ea: ff 45 d8              incl   0xffffffd8(%ebp)
  ed: 47                    inc    %edi
  ee: 3b 7d e4              cmp    0xffffffe4(%ebp),%edi
  f1: 7e 8d                 jle    80 <rmatMul(RealMatrix&, RealMatrix
const&, RealMatrix const&)+0x80>

  f3: dd d8                 fstp   %st(0)
  f5: ff 45 f0              incl   0xfffffff0(%ebp)
  f8: 8b 55 e8              mov    0xffffffe8(%ebp),%edx
  fb: ff 45 d4              incl   0xffffffd4(%ebp)
  fe: ff 45 d0              incl   0xffffffd0(%ebp)
 101: 39 55 f0              cmp    %edx,0xfffffff0(%ebp)
 104: 0f 8e 46 ff ff ff     jle    50 <rmatMul(RealMatrix&, RealMatrix
const&, RealMatrix const&)+0x50>

 10a: dd d8                 fstp   %st(0)
 10c: 83 c4 24              add    $0x24,%esp
 10f: 5b                    pop    %ebx
 110: 5e                    pop    %esi
 111: 5f                    pop    %edi
 112: 5d                    pop    %ebp
 113: c3                    ret
 114: 8d b6 00 00 00 00     lea    0x0(%esi),%esi
 11a: 8d bf 00 00 00 00     lea    0x0(%edi),%edi




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