<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
I tried a few differnt switches.<BR>
They always seem to get the actual address into a register.<BR>
<BR>C:\dev2\cm3.2\m3-sys\m3back\src>type t.c && cl -c -Ox -FAsc t.c && type t.cod<BR><BR>
long __cdecl _InterlockedExchange(long volatile*, long);<BR>#pragma intrinsic(_InterlockedIncrement)<BR>
<BR>
<BR>
long __cdecl _InterlockedIncrement(long volatile*);<BR>#pragma intrinsic(_InterlockedIncrement)<BR>
<BR>
<BR>
long __cdecl _InterlockedExchangeAdd(long volatile*, long);<BR>#pragma intrinsic(_InterlockedExchangeAdd)<BR>
<BR>
<BR>
long __cdecl _InterlockedCompareExchange(long volatile*, long, long);<BR>#pragma intrinsic(_InterlockedCompareExchange)<BR>
<BR>
<BR>
long F1(volatile long* a)<BR>{<BR>return _InterlockedIncrement(&a[10]);<BR>}<BR>
<BR>
<BR>typedef struct S1 { int a; long b; } S1;<BR>
long F2(volatile S1* a)<BR>{<BR>return _InterlockedExchangeAdd(&a->b, 123);<BR>}<BR>
<BR>
<BR>long F3(volatile S1* a)<BR>{<BR>return _InterlockedCompareExchange(&a->b, 1, 2);<BR>}<BR>
<BR>
<BR>long F4(volatile S1* a)<BR>{<BR>return _InterlockedExchange(&a->b, 1);<BR>}<BR><BR>
<BR>
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86<BR>Copyright (C) Microsoft Corporation. All rights reserved.<BR>
t.c<BR>; Listing generated by Microsoft (R) Optimizing Compiler Version 15.00.21022.08<BR>
<BR> TITLE C:\dev2\cm3.2\m3-sys\m3back\src\t.c<BR> .686P<BR> .XMM<BR> include listing.inc<BR> .model flat<BR>
INCLUDELIB LIBCMT<BR>INCLUDELIB OLDNAMES<BR>
PUBLIC _F1<BR>; Function compile flags: /Ogtpy<BR>; File c:\dev2\cm3.2\m3-sys\m3back\src\t.c<BR>_TEXT SEGMENT<BR>_a$ = 8 ; size = 4<BR>_F1 PROC<BR>
; 15 : return _InterlockedIncrement(&a[10]);<BR>
00000 8b 44 24 04 mov eax, DWORD PTR _a$[esp-4]<BR> 00004 8d 48 28 lea ecx, DWORD PTR [eax+40]<BR> 00007 b8 01 00 00 00 mov eax, 1<BR> 0000c f0 0f c1 01 lock xadd DWORD PTR [ecx], eax<BR> 00010 40 inc eax<BR>
; 16 : }<BR>
00011 c3 ret 0<BR>_F1 ENDP<BR>_TEXT ENDS<BR>PUBLIC _F2<BR>; Function compile flags: /Ogtpy<BR>_TEXT SEGMENT<BR>_a$ = 8 ; size = 4<BR>_F2 PROC<BR>
; 23 : return _InterlockedExchangeAdd(&a->b, 123);<BR>
00020 8b 4c 24 04 mov ecx, DWORD PTR _a$[esp-4]<BR> 00024 b8 7b 00 00 00 mov eax, 123 ; 0000007bH<BR> 00029 83 c1 04 add ecx, 4<BR> 0002c f0 0f c1 01 lock xadd DWORD PTR [ecx], eax<BR>
; 24 : }<BR>
00030 c3 ret 0<BR>_F2 ENDP<BR>_TEXT ENDS<BR>PUBLIC _F3<BR>; Function compile flags: /Ogtpy<BR>_TEXT SEGMENT<BR>_a$ = 8 ; size = 4<BR>_F3 PROC<BR>
; 29 : return _InterlockedCompareExchange(&a->b, 1, 2);<BR>
00040 8b 54 24 04 mov edx, DWORD PTR _a$[esp-4]<BR> 00044 b9 01 00 00 00 mov ecx, 1<BR> 00049 83 c2 04 add edx, 4<BR> 0004c b8 02 00 00 00 mov eax, 2<BR> 00051 f0 0f b1 0a lock cmpxchg DWORD PTR [edx], ecx<BR>
; 30 : }<BR>
00055 c3 ret 0<BR>_F3 ENDP<BR>_TEXT ENDS<BR>PUBLIC _F4<BR>; Function compile flags: /Ogtpy<BR>_TEXT SEGMENT<BR>_a$ = 8 ; size = 4<BR>_F4 PROC<BR>
; 35 : return _InterlockedExchange(&a->b, 1);<BR>
00060 8b 4c 24 04 mov ecx, DWORD PTR _a$[esp-4]<BR> 00064 b8 01 00 00 00 mov eax, 1<BR> 00069 83 c1 04 add ecx, 4<BR> 0006c 87 01 xchg DWORD PTR [ecx], eax<BR>
; 36 : }<BR>
0006e c3 ret 0<BR>_F4 ENDP<BR>_TEXT ENDS<BR>END<BR>
C:\dev2\cm3.2\m3-sys\m3back\src><BR><BR><BR>
probably should try IA64 though.<BR>
<BR>
<BR>
- Jay<BR> </body>
</html>