Author: Ed Schröder
Date: 00:09:30 06/19/00
Go up one level in this thread
On June 18, 2000 at 19:06:23, Tom Kerrigan wrote: >On June 18, 2000 at 17:15:36, James Robertson wrote: > >>On June 18, 2000 at 16:44:15, Bruce Moreland wrote: >> >>>On June 18, 2000 at 15:25:23, James Robertson wrote: >>> >>>>I cannot remember how to do a shift in assembler and save any bits shifted off. >>>>Specifically, I want to shift a 64-bit integer. What is the assembler equivalent >>>>of: >>>> >>>>unsigned __int64 x; >>>>x <<= shift; >>> >>>If you are using MSVC, you can often answer these questions by compiling with >>>the -Fc option, and looking at the code. >>> >>>It is possible that they do a function call to do this, but if they do it >>>inline, the answer is right in front of you. >> >>I did this. To do a 64 bit shift, MSVC calls a function named _allshl or >>_allshr. This is the code it provides (copied and directly from the debug >>executable and uncleaned): >> >>_allshl: >>00408190 cmp cl,40h >>00408193 jae RETZERO(0x004081aa) >>00408195 cmp cl,20h >>00408198 jae MORE32(0x004081a0) >>0040819A shld edx,eax,cl >>0040819D shl eax,cl >>0040819F ret >>MORE32: >>004081A0 mov edx,eax >>004081A2 xor eax,eax >>004081A4 and cl,1Fh >>004081A7 shl edx,cl >>004081A9 ret >>RETZERO: >>004081AA xor eax,eax >>004081AC xor edx,edx >>004081AE ret >> >>I am sure the MUST be something faster than this. > >I didn't actually look at the assembly, but I'm 100% certain this is the fastest >way to do it. Think about it, the people who wrote this function are geniuses at >MS and their top priority was to make it as fast as possible. No offense, but I >really doubt you can do a better job. > >-Tom Porting the ASM part of Rebel back to C++ using MVC6 gave me a speed loss of 30%. So there is much left for improvement. Ed
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.