Author: Walter Faxon
Date: 20:40:38 12/07/02
Go up one level in this thread
On December 07, 2002 at 14:14:32, Matt Taylor wrote: >On December 06, 2002 at 22:50:40, Walter Faxon wrote: > >>On December 06, 2002 at 05:33:42, Matt Taylor wrote: >> >><snip> >>> >>>It's also a tad strange that the code loads dl and then copies edx into eax. >It would be more direct to simply store the table value in eax. >>> >><snip> >> >>I get the feeling that, for the compiler in question at least, once it decides >>that a register is going to be used as an address or offset, it loses or ignores >>its knowledge of the register's bitwise mapping. It preps edx to receive the >>byte in dl, uses eax to load dl, then copies the whole thing to eax. If it used >>eax to write to al directly, the compiler would think it still needs to mask out >>the (already zeroed) rest of eax afterwards. So it does it this way because the >>reg-reg copy is faster and the edx prep can be overlapped with other work. >>Anyway, that's a possible explanation. One would need detailed knowledge of the >>compiler to know for sure. (And don't get mad at the compiler writers; writing >>good compilers is hard work!) >> >>-- Walter > >Yeah, but the x86 architecture has a movzx instruction for that very purpose. >AMD manuals actually advise that it is faster to use movzx than the equivalent >sequence... > >And yeah, I know compiler writing is very difficult. I have actually been >working on one for various reasons. The difference is that I have a human >optimizer. :-) > >Actually I was working on an optimizer that takes machine code and produces more >optimal machine code (which is what I will spit my compiler output through when >it's done). > >-Matt Man, it's clear I gotta get a PIV asm book (or the AMD equivalent). All I got is an old 486 manual and that says movzx is slower than mov, 3 clocks to 1. A machine code optimizer is terrifically general. Let us know when you're done; a lot of us will be interested. -- Walter
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.