Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 2,984 of 4,675    |
|    rugxulo@nospicedham.gmail.com to Robert Prins    |
|    Re: Converting some way to clever PL/I c    |
|    02 Sep 17 16:54:23    |
   
   Hi,   
      
   On Thursday, August 31, 2017 at 10:49:11 AM UTC-5, Robert Prins wrote:   
   >   
   > my hacked-about code comes out as:   
   >   
   > {$ifdef mmx}   
   > ...   
   > {$else}   
   > mov ecx, [ebx + offset lift_list.dtime]   
   > mov [esi + offset s_rec.dtime], ecx   
   >   
   > mov ecx, [ebx + offset lift_list.atime]   
   > mov [esi + offset s_rec.atime], ecx   
   >   
   > mov ecx, [ebx + offset lift_list.wtime]   
   > mov [esi + offset s_rec.wtime], ecx   
   >   
   > mov ecx, [ebx + offset lift_list.itime]   
   > mov [esi + offset s_rec.itime], ecx   
   > {$endif}   
   >   
   > I would expect that GCC or the Intel C compiler would both   
   > generate at least the code in the {$else} branch above when   
   > the original Pascal is replaced by C(++).   
      
   So why not rewrite in C? It can't be that hard (famous last words!).   
      
   Though personally I'd suggest rather fixing to work with FPC,   
   that's more useful and important (IMHO).   
      
   > Both VP and FPC seem to make way too much use of EAX...   
      
   I'm not an optimization guru. I haven't read Agner Fog's manuals   
   closely. Modern cpus probably do heavy register renaming and   
   lots of out-of-order (pipelined, superscalar, whatever) stuff.   
   I think older ones were pickier about certain things, but I   
   don't know if you care about (or test your code on) such machines.   
      
   Relying too much on one register is probably a bad idea, but   
   they probably just want to simplify register shuffling.   
   I had thought I read that alternating registers was a better   
   idea, so maybe try not relying too heavily on ECX either.   
      
   Actually, your {$else} code seems pretty sequential. I would   
   just use "push dword[], pop dword[]" (but not for 486) and   
   avoid ECX altogether. Maybe I'm naive, but that's a quick   
   simplification. No idea if it really helps you, though.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca