Author: Eugene Nalimov
Date: 20:51:43 10/24/00
Go up one level in this thread
On October 23, 2000 at 17:30:27, Bruce Moreland wrote:
>On October 23, 2000 at 12:29:27, Oliver Roese wrote:
>
>>On October 23, 2000 at 01:09:02, Landon Rabern wrote:
>>
>>>is it faster to cast to a char or to AND by 0xff, or to do they take the same
>>>number of clock cycles?
>>>
>>>Thanks,
>>>
>>>Landon W. Rabern
>>
>>Since "(unsigned char) u" and "u & 0xff" are equivalent expressions in C (or
>>arent they??) and nearly equivalent in other languages you surely cant tell
>>that, without looking on the assembler output of your compiler.
>>In C dont ever use char, there are implicitely converted to ints and that could
>>hurt. If the compiler can decide not to convert, slow 86-instructions must be
>>used. Hard to tell, what is slowest.
>>
>>Oliver
>
>I know that with the original pentium, in 32-bit mode, 32-bit and 8-bit
>operations were fine, but 16-bit operations were bad.
>
>I don't know if 8-bit operations are now bad, but if they are, it has been since
>sometime after the Pentium Pro.
>
>bruce
Not exactly true. Even on Pentium Pro you'll get severe penalty ("partial
register stall") if you'll write to part of the register, and then use larger
register or a bigger part of it, i.e.
mov al, ...
push eax
Exception: in the following code
xor eax, eax
mov al, ...
push eax
you'll (usually) get no partial register stall -- that sequence was too common
in the older x86 programs, so Intel hacked its processors to handle it better.
That stall happens on the entire P6 family of processors, i.e. all flavors of
Pentium Pro, PII, PIII.
Eugene
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.