Boost logo

Boost :

Subject: Re: [boost] different matrix library?
From: joel (joel.falcou_at_[hidden])
Date: 2009-08-18 10:59:38


DE wrote:
> looks smart and tricky but i don't see any advantages over computed
> indeces but only wasted spaces and time (for allocating additional
> storage for pointers)
> at the same time dereferencing a pointer is like computing an index -
> no computational advantage agai
Back to this issue here is the generated code using

1/ NRC array of dimension 4
mov 0x804c18c,%eax
mov %eax,-0x20(%ebp)
mov -0x20(%ebp),%eax

1> xor %ebx,%ebx
    mov (%eax,%edi,1),%eax
    mov %eax,-0x1c(%ebp)
    mov -0x1c(%ebp),%eax

 2> xor %ecx,%ecx
    mov (%eax,%ebx,1),%esi
    mov (%esi,%ecx,1),%eax

  3> add $0x4,%ecx
     mov 0x804c140,%edx
     cmp $0x8,%ecx
     mov %edx,(%eax)
     mov 0x804c140,%edx
     mov %edx,0x4(%eax)
    jne 3>

  add $0x4,%ebx
  cmp $0x8,%ebx
  jne 2>

add $0x4,%edi
cmp $0x8,%edi
jne 1>

2/ Same array allocated as a float* with index computation
mov %eax,0x804c198
mov %eax,-0x14(%ebp)
add $0x40,%eax
mov %eax,-0x24(%ebp)
mov -0x14(%ebp),%eax

1> xor %esi,%esi
   mov -0x14(%ebp),%edi
   add $0x4,%eax
   mov %eax,-0x18(%ebp)
   mov -0x18(%ebp),%ecx

 2> mov %edi,%ebx
    xor %edx,%edx
    mov 0x804c144,%eax

  3> add $0x1,%edx
     mov %eax,(%ebx)
     mov 0x804c144,%eax
     add $0x8,%ebx
     mov %eax,(%ecx)
     add $0x8,%ecx
     cmp $0x2,%edx
     jne 3>
 
  add$0x1,%esi
  add$0x10,%edi
  addl$0x10,-0x18(%ebp)
  cmp$0x2,%esi
  jne 2>

addl $0x20,-0x14(%ebp)
mov -0x24(%ebp),%eax
cmp %eax,-0x14(%ebp)
jne 1>

Lo and behold ;)
Doing the computation of index jump int he allcoation helps tremendously.

-- 
___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk