Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
61c0dcdb
Commit
61c0dcdb
authored
Jul 31, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 31, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include/winbase.h: MSC compiler implements interlocked* APIs as intrinsics in x86_64 mode.
parent
9d949605
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
winbase.h
include/winbase.h
+52
-0
No files found.
include/winbase.h
View file @
61c0dcdb
...
@@ -2435,6 +2435,10 @@ WINBASEAPI LONGLONG WINAPI InterlockedCompareExchange64(LONGLONG volatile*,LONGL
...
@@ -2435,6 +2435,10 @@ WINBASEAPI LONGLONG WINAPI InterlockedCompareExchange64(LONGLONG volatile*,LONGL
#else
/* __i386__ */
#else
/* __i386__ */
#if defined(__x86_64__) && defined(_MSC_VER)
#pragma intrinsic(_InterlockedCompareExchange)
#endif
static
FORCEINLINE
LONG
WINAPI
InterlockedCompareExchange
(
LONG
volatile
*
dest
,
LONG
xchg
,
LONG
compare
)
static
FORCEINLINE
LONG
WINAPI
InterlockedCompareExchange
(
LONG
volatile
*
dest
,
LONG
xchg
,
LONG
compare
)
{
{
#if defined(__x86_64__) && defined(__GNUC__)
#if defined(__x86_64__) && defined(__GNUC__)
...
@@ -2442,12 +2446,18 @@ static FORCEINLINE LONG WINAPI InterlockedCompareExchange( LONG volatile *dest,
...
@@ -2442,12 +2446,18 @@ static FORCEINLINE LONG WINAPI InterlockedCompareExchange( LONG volatile *dest,
__asm__
__volatile__
(
"lock; cmpxchgl %2,(%1)"
__asm__
__volatile__
(
"lock; cmpxchgl %2,(%1)"
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
return
ret
;
return
ret
;
#elif defined(__x86_64__) && defined(_MSC_VER)
return
_InterlockedCompareExchange
(
dest
,
xchg
,
compare
);
#else
#else
extern
int
interlocked_cmpxchg
(
int
*
dest
,
int
xchg
,
int
compare
);
extern
int
interlocked_cmpxchg
(
int
*
dest
,
int
xchg
,
int
compare
);
return
interlocked_cmpxchg
(
(
int
*
)
dest
,
xchg
,
compare
);
return
interlocked_cmpxchg
(
(
int
*
)
dest
,
xchg
,
compare
);
#endif
#endif
}
}
#if defined(__x86_64__) && defined(_MSC_VER)
#pragma intrinsic(_InterlockedCompareExchangePointer)
#endif
static
FORCEINLINE
PVOID
WINAPI
InterlockedCompareExchangePointer
(
PVOID
volatile
*
dest
,
PVOID
xchg
,
PVOID
compare
)
static
FORCEINLINE
PVOID
WINAPI
InterlockedCompareExchangePointer
(
PVOID
volatile
*
dest
,
PVOID
xchg
,
PVOID
compare
)
{
{
#if defined(__x86_64__) && defined(__GNUC__)
#if defined(__x86_64__) && defined(__GNUC__)
...
@@ -2455,12 +2465,18 @@ static FORCEINLINE PVOID WINAPI InterlockedCompareExchangePointer( PVOID volatil
...
@@ -2455,12 +2465,18 @@ static FORCEINLINE PVOID WINAPI InterlockedCompareExchangePointer( PVOID volatil
__asm__
__volatile__
(
"lock; cmpxchgq %2,(%1)"
__asm__
__volatile__
(
"lock; cmpxchgq %2,(%1)"
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
return
ret
;
return
ret
;
#elif defined(__x86_64__) && defined(_MSC_VER)
return
_InterlockedCompareExchangePointer
(
dest
,
xchg
,
compare
);
#else
#else
extern
void
*
interlocked_cmpxchg_ptr
(
void
**
dest
,
void
*
xchg
,
void
*
compare
);
extern
void
*
interlocked_cmpxchg_ptr
(
void
**
dest
,
void
*
xchg
,
void
*
compare
);
return
interlocked_cmpxchg_ptr
(
(
void
**
)
dest
,
xchg
,
compare
);
return
interlocked_cmpxchg_ptr
(
(
void
**
)
dest
,
xchg
,
compare
);
#endif
#endif
}
}
#if defined(__x86_64__) && defined(_MSC_VER)
#pragma intrinsic(_InterlockedCompareExchange64)
#endif
static
FORCEINLINE
LONGLONG
WINAPI
InterlockedCompareExchange64
(
LONGLONG
volatile
*
dest
,
LONGLONG
xchg
,
LONGLONG
compare
)
static
FORCEINLINE
LONGLONG
WINAPI
InterlockedCompareExchange64
(
LONGLONG
volatile
*
dest
,
LONGLONG
xchg
,
LONGLONG
compare
)
{
{
#if defined(__x86_64__) && defined(__GNUC__)
#if defined(__x86_64__) && defined(__GNUC__)
...
@@ -2468,12 +2484,18 @@ static FORCEINLINE LONGLONG WINAPI InterlockedCompareExchange64( LONGLONG volati
...
@@ -2468,12 +2484,18 @@ static FORCEINLINE LONGLONG WINAPI InterlockedCompareExchange64( LONGLONG volati
__asm__
__volatile__
(
"lock; cmpxchgq %2,(%1)"
__asm__
__volatile__
(
"lock; cmpxchgq %2,(%1)"
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
:
"=a"
(
ret
)
:
"r"
(
dest
),
"r"
(
xchg
),
"0"
(
compare
)
:
"memory"
);
return
ret
;
return
ret
;
#elif defined(__x86_64__) && defined(_MSC_VER)
return
_InterlockedCompareExchange64
(
dest
,
xchg
,
compare
);
#else
#else
extern
__int64
interlocked_cmpxchg64
(
__int64
*
dest
,
__int64
xchg
,
__int64
compare
);
extern
__int64
interlocked_cmpxchg64
(
__int64
*
dest
,
__int64
xchg
,
__int64
compare
);
return
interlocked_cmpxchg64
(
(
__int64
*
)
dest
,
xchg
,
compare
);
return
interlocked_cmpxchg64
(
(
__int64
*
)
dest
,
xchg
,
compare
);
#endif
#endif
}
}
#if defined(__x86_64__) && defined(_MSC_VER)
#pragma intrinsic(_InterlockedExchange)
#endif
static
FORCEINLINE
LONG
WINAPI
InterlockedExchange
(
LONG
volatile
*
dest
,
LONG
val
)
static
FORCEINLINE
LONG
WINAPI
InterlockedExchange
(
LONG
volatile
*
dest
,
LONG
val
)
{
{
#if defined(__x86_64__) && defined(__GNUC__)
#if defined(__x86_64__) && defined(__GNUC__)
...
@@ -2481,12 +2503,18 @@ static FORCEINLINE LONG WINAPI InterlockedExchange( LONG volatile *dest, LONG va
...
@@ -2481,12 +2503,18 @@ static FORCEINLINE LONG WINAPI InterlockedExchange( LONG volatile *dest, LONG va
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
__asm__
__volatile__
(
"lock; xchgl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
return
ret
;
return
ret
;
#elif defined(__x86_64__) && defined(_MSC_VER)
return
_InterlockedExchange
(
dest
,
val
);
#else
#else
extern
int
interlocked_xchg
(
int
*
dest
,
int
val
);
extern
int
interlocked_xchg
(
int
*
dest
,
int
val
);
return
interlocked_xchg
(
(
int
*
)
dest
,
val
);
return
interlocked_xchg
(
(
int
*
)
dest
,
val
);
#endif
#endif
}
}
#if defined(__x86_64__) && defined(_MSC_VER)
#pragma intrinsic(_InterlockedExchangePointer)
#endif
static
FORCEINLINE
PVOID
WINAPI
InterlockedExchangePointer
(
PVOID
volatile
*
dest
,
PVOID
val
)
static
FORCEINLINE
PVOID
WINAPI
InterlockedExchangePointer
(
PVOID
volatile
*
dest
,
PVOID
val
)
{
{
#if defined(__x86_64__) && defined(__GNUC__)
#if defined(__x86_64__) && defined(__GNUC__)
...
@@ -2494,12 +2522,18 @@ static FORCEINLINE PVOID WINAPI InterlockedExchangePointer( PVOID volatile *dest
...
@@ -2494,12 +2522,18 @@ static FORCEINLINE PVOID WINAPI InterlockedExchangePointer( PVOID volatile *dest
__asm__
__volatile__
(
"lock; xchgq %0,(%1)"
__asm__
__volatile__
(
"lock; xchgq %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
val
)
:
"memory"
);
return
ret
;
return
ret
;
#elif defined(__x86_64__) && defined(_MSC_VER)
return
_InterlockedExchangePointer
(
dest
,
val
);
#else
#else
extern
void
*
interlocked_xchg_ptr
(
void
**
dest
,
void
*
val
);
extern
void
*
interlocked_xchg_ptr
(
void
**
dest
,
void
*
val
);
return
interlocked_xchg_ptr
(
(
void
**
)
dest
,
val
);
return
interlocked_xchg_ptr
(
(
void
**
)
dest
,
val
);
#endif
#endif
}
}
#if defined(__x86_64__) && defined(_MSC_VER)
#pragma intrinsic(_InterlockedExchangeAdd)
#endif
static
FORCEINLINE
LONG
WINAPI
InterlockedExchangeAdd
(
LONG
volatile
*
dest
,
LONG
incr
)
static
FORCEINLINE
LONG
WINAPI
InterlockedExchangeAdd
(
LONG
volatile
*
dest
,
LONG
incr
)
{
{
#if defined(__x86_64__) && defined(__GNUC__)
#if defined(__x86_64__) && defined(__GNUC__)
...
@@ -2507,20 +2541,38 @@ static FORCEINLINE LONG WINAPI InterlockedExchangeAdd( LONG volatile *dest, LONG
...
@@ -2507,20 +2541,38 @@ static FORCEINLINE LONG WINAPI InterlockedExchangeAdd( LONG volatile *dest, LONG
__asm__
__volatile__
(
"lock; xaddl %0,(%1)"
__asm__
__volatile__
(
"lock; xaddl %0,(%1)"
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
incr
)
:
"memory"
);
:
"=r"
(
ret
)
:
"r"
(
dest
),
"0"
(
incr
)
:
"memory"
);
return
ret
;
return
ret
;
#elif defined(__x86_64__) && defined(_MSC_VER)
return
_InterlockedExchangeAdd
(
dest
,
incr
);
#else
#else
extern
int
interlocked_xchg_add
(
int
*
dest
,
int
incr
);
extern
int
interlocked_xchg_add
(
int
*
dest
,
int
incr
);
return
interlocked_xchg_add
(
(
int
*
)
dest
,
incr
);
return
interlocked_xchg_add
(
(
int
*
)
dest
,
incr
);
#endif
#endif
}
}
#if defined(__x86_64__) && defined(_MSC_VER)
#pragma intrinsic(_InterlockedIncrement)
#endif
static
FORCEINLINE
LONG
WINAPI
InterlockedIncrement
(
LONG
volatile
*
dest
)
static
FORCEINLINE
LONG
WINAPI
InterlockedIncrement
(
LONG
volatile
*
dest
)
{
{
#if defined(__x86_64__) && defined(_MSC_VER)
return
_InterlockedIncrement
(
dest
);
#else
return
InterlockedExchangeAdd
(
dest
,
1
)
+
1
;
return
InterlockedExchangeAdd
(
dest
,
1
)
+
1
;
#endif
}
}
#if defined(__x86_64__) && defined(_MSC_VER)
#pragma intrinsic(_InterlockedDecrement)
#endif
static
FORCEINLINE
LONG
WINAPI
InterlockedDecrement
(
LONG
volatile
*
dest
)
static
FORCEINLINE
LONG
WINAPI
InterlockedDecrement
(
LONG
volatile
*
dest
)
{
{
#if defined(__x86_64__) && defined(_MSC_VER)
return
_InterlockedDecrement
(
dest
);
#else
return
InterlockedExchangeAdd
(
dest
,
-
1
)
-
1
;
return
InterlockedExchangeAdd
(
dest
,
-
1
)
-
1
;
#endif
}
}
#endif
/* __i386__ */
#endif
/* __i386__ */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment