Author: Dezhi Zhao
Date: 11:42:46 09/29/05
Go up one level in this thread
On September 29, 2005 at 12:12:16, Eugene Nalimov wrote:
>On September 29, 2005 at 01:26:54, Dezhi Zhao wrote:
>
>>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.
>
>Yes, it is not very difficult, but we decided to spend resources optimizing
>legal C/C++ programs, not the cases where language standard explicitly says
>"behavior is undefined".
The test code is not involved in any issues of language standard.
The casts used there are legal by any standards.
>
>Program still does what programmer intended (it does not give you access
>violation, nor it formats your hard drive), though code is suboptimal...
Yes. The compiler does a good job. But we can still hope for more. I did not
forget to test the bsf and bsr intrinsic. The Beta2(and RC) compiler outputs for
both 32 and 64 bit machines are perfect. Thanks!
>
>Thanks,
>Eugene
>
>:-)
>
>>; 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 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.