Author: Uri Blass
Date: 03:19:27 01/14/02
Go up one level in this thread
On January 14, 2002 at 04:16:54, Ed Schröder wrote: >On January 13, 2002 at 23:36:19, Eugene Nalimov wrote: > >>Can you please send me the function that was so badly compiled (probably via >>e-mail)? I'd like to find where VC screwed up. It's too late to fix it for VC7, >>but probably we can do it for VC7.x. >> >>Eugene > > >Screwed up is a big word, ASM being being just 30% faster than C is a very good >performance I would say. By head I remember the following cases: > >#1. a=b; c=d; > >The compiler will output something like: > >mov EAX,b >mov a,EAX >mov EAX,d >mov c,EAX > >Wheras it should generate: > >mov EAX,b >mov EBX,d >mov a,EAX >mov c,EBX > >#2. Always these unavoidable MOVSX and MOVZX instructions. No compiler can >optimize this because it is impossible, only the ASM programmer knows what it is >allowed under the circumstances. > >#3. Register use, same story as (2). I for instance use EBP and even ESP when I >am short on registers. > >#4. "char" use in MSVC, for instance: char a1,a2,a3,a4,a5,a6,a7,a8; > >Will NOT produce the 8 characters as a sequential memory block. So in case I >want to zero the 8 bytes I will be forced to write 8 instructions. Some other >compilers do generate a sequential memory block so you can redefine a1 and a5 as >32-bit and with 2 instructions zero them. This is pretty crucial in a chess >program, at least in mine, also because I have to "stack" many stuff when going >one ply deeper in the tree or when climbing back. > >#5. Special stuff, no compiler is able to recognize as only the ASM programmer >knows. I recently posted an example how to use the "indirect jump" the processor >is offering you when for instance generating moves. > >So it is not about bugs, it is more why no compiler will be ever able to beat an >experienced ASM programmer. However I do think that there is space for >improvement in the (1) and (4) case, maybe even on (3). > >Ed I believe that there is a room of improvement also for cases when you say that no compiler can know what is allowed under the circumstances. A good compiler may try also to run the program and if it finds that a condition never happens then the program may ask the user if it can assume that the same condition (transalted to C) never happens. Uri
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.