Computer Chess Club Archives


Search

Terms

Messages

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

Author: Dezhi Zhao

Date: 22:26:54 09/28/05

Go up one level in this thread


The compiler is not very aware of 64 bit operands. It should be not difficult to
calculate the size of a simple structure and utilize one of the many registers
instead of using the stack.

; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.26

include listing.inc

INCLUDELIB OLDNAMES

PUBLIC	wmain
; Function compile flags: /Ogtpy
; File c:\documents and settings\administrator\my documents\visual studio
2005\projects\x64\x64\x64.cpp
;	COMDAT wmain
_TEXT	SEGMENT
argc$ = 8
q$ = 16
argv$ = 16
wmain	PROC						; COMDAT

; 9    : 	union
; 10   : 	{
; 11   : 		unsigned __int64 qw;
; 12   : 		struct
; 13   : 		{
; 14   : 			unsigned lo32;
; 15   : 			unsigned hi32;
; 16   : 		};
; 17   : 	} q, i;
; 18   :
; 19   : 	q.lo32 = argc;
; 20   : 	q.hi32 = (unsigned) argv;
; 21   :
; 22   : 	i.qw = (unsigned __int64) argv | (unsigned __int64) argc << 32;
; 23   :
; 24   : 	return q.qw == i.qw;

	xor	eax, eax
	movsxd	r8, ecx
	mov	DWORD PTR q$[rsp], ecx
	shl	r8, 32					; 00000020H
	mov	DWORD PTR q$[rsp+4], edx
	or	r8, rdx
	cmp	QWORD PTR q$[rsp], r8
	sete	al

; 25   : }

	ret	0
wmain	ENDP
_TEXT	ENDS
END



This page took 0.01 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.