Author: Gerd Isenberg
Date: 23:48:09 09/29/05
Go up one level in this thread
On September 29, 2005 at 18:45:15, Dezhi Zhao wrote: >Here it is: Thanks, looks fine. Compact code. Perfect register usage - only the fastcall parameter registers rcx, rdx and the the "return"-register rax are used. No memory access. And a nice rearrangement of the three last source lines. Otoh, there are a lot dependencies - i prefere using one additional register and some more "parallel" work. In "reality", those leaf-routines are inlined with others and instruction scheduling may be a bit more independent. Gerd > >; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.26 > >include listing.inc > >INCLUDELIB OLDNAMES > >PUBLIC ?rightUpAttacks@@YA_K_K0@Z ; rightUpAttacks >; Function compile flags: /Ogtpy >; File c:\documents and settings\administrator\my documents\visual studio >2005\projects\x64\x64\x64.cpp >; COMDAT ?rightUpAttacks@@YA_K_K0@Z >_TEXT SEGMENT >deo$ = 8 >pro$ = 16 >?rightUpAttacks@@YA_K_K0@Z PROC ; rightUpAttacks, COMDAT > >; 11 : BitBoard notA = 0xfefefefefefefefe; >; 12 : >; 13 : pro = pro & notA; > > mov rax, -72340172838076674 ; fefefefefefefefeH > and rdx, rax > >; 14 : deo |= pro & (deo << 9); > > mov rax, rcx > shl rax, 9 > and rax, rdx > or rcx, rax > >; 15 : pro = pro & (pro << 9); > > mov rax, rdx > shl rax, 9 > and rdx, rax > >; 16 : deo |= pro & (deo << 18); > > mov rax, rcx > shl rax, 18 > and rax, rdx > or rcx, rax > >; 17 : pro = pro & (pro << 18); >; 18 : deo |= pro & (deo << 36); >; 19 : return (deo << 9) & notA; > > mov rax, rcx > shl rax, 18 > and rax, rdx > shl rax, 18 > and rax, rdx > or rax, rcx > mov rcx, -141289400074369 ; ffff7f7f7f7f7f7fH > and rax, rcx > shl rax, 9 > >; 20 : } > > ret 0 >?rightUpAttacks@@YA_K_K0@Z ENDP ; rightUpAttacks >_TEXT ENDS > > >On September 29, 2005 at 14:16:06, Gerd Isenberg wrote: > >>Dezhi, can you please post some x86-64 assembly of this routine? >> >>Thanks, >>Gerd >> >> >>typedef unsigned __int64 BitBoard; >> >>BitBoard notA = 0xfefefefefefefefe; >> >>BitBoard rightUpAttacks(BitBoard deo, BitBoard pro) { >> pro = pro & notA; >> deo |= pro & (deo << 9); >> pro = pro & (pro << 9); >> deo |= pro & (deo << 18); >> pro = pro & (pro << 18); >> deo |= pro & (deo << 36); >> return (deo << 9) & notA; >>}
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.