Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: x86-64 ASM output of a simple test program

Author: Gerd Isenberg

Date: 02:47:48 10/01/05

Go up one level in this thread


On September 30, 2005 at 21:38:48, Dezhi Zhao wrote:

>PUBLIC	?diagonal1Attacks@@YA_K_K0@Z			; diagonal1Attacks
>; Function compile flags: /Ogtpy
>;	COMDAT ?diagonal1Attacks@@YA_K_K0@Z
>_TEXT	SEGMENT
>deo$ = 8
>pro$ = 16
>?diagonal1Attacks@@YA_K_K0@Z PROC			; diagonal1Attacks, COMDAT
>
>; 36   : 	return leftDownAttacks(deo, pro) | rightUpAttacks(deo, pro);
>
>	mov	r10, rdx
>	mov	r9, rcx
>	mov	r8, rcx
1	shr	r9, 9
>	mov	rax, 9187201950435737471		; 7f7f7f7f7f7f7f7fH
2	and	r10, rax
3	and	r9, r10
>	mov	rax, r10
4	shr	rax, 9
5	or	r9, rcx
6	shl	rcx, 9
7	and	r10, rax
>	mov	rax, r9
8	shr	rax, 18
9	and	rax, r10
10	or	r9, rax
>	mov	rax, -72340172838076674			; fefefefefefefefeH
11	and	rdx, rax
12	and	rcx, rdx
>	mov	rax, rdx
13	shl	rax, 9
14	or	rcx, r8
15	and	rdx, rax
>	mov	rax, rcx
16	shl	rax, 18
17	and	rax, rdx
18	or	rcx, rax
>	mov	rax, rcx
19	and	rax, -2057				; fffffffffffff7f7H
20	shl	rax, 18
21	and	rax, rdx
22	shl	rax, 18
23	and	rax, rdx
>	mov	rdx, -141289400074369			; ffff7f7f7f7f7f7fH
24	and	rcx, rdx
>	mov	rdx, r9
25	or	rax, rcx
26	shr	rdx, 36					; 00000024H
>	mov	rcx, r10
27	shr	rcx, 18
28	shl	rax, 9
29	and	rdx, rcx
>	mov	rcx, 35887507618889599			; 007f7f7f7f7f7f7fH
30	and	rdx, r10
31	or	rdx, r9
32	shr	rdx, 9
33	and	rdx, rcx
34	or	rax, rdx
>
>; 37   : }
>
>	ret	0
>?diagonal1Attacks@@YA_K_K0@Z ENDP			; diagonal1Attacks
>_TEXT	ENDS
>

Scheduling seems better here. A bit strange - i count 34 bitwise/shift
instructions (instead of 33 (2*16+1) in the C-code). The asm is a bit harder to
map to the source lines of course. I don't yet understand how the compiler comes
up with this one:

20	and	rax, -2057	; fffffffffffff7f7H

Gerd



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.