From 7bf779f3775549f49c01f91a3967dbc193bb24f3 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 27 Jul 2015 01:37:11 +0200 Subject: [PATCH] vcomp: Implement 32-bit atomic integer functions. --- dlls/vcomp/main.c | 65 +++++++++++++++++++++++++++++++++++++ dlls/vcomp/vcomp.spec | 22 ++++++------- dlls/vcomp100/vcomp100.spec | 22 ++++++------- dlls/vcomp90/vcomp90.spec | 22 ++++++------- 4 files changed, 98 insertions(+), 33 deletions(-) diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c index ae5623b0ff4..6f0caf64830 100644 --- a/dlls/vcomp/main.c +++ b/dlls/vcomp/main.c @@ -22,6 +22,7 @@ */ #include "config.h" +#include "wine/port.h" #include #include @@ -221,6 +222,70 @@ static void vcomp_free_thread_data(void) vcomp_set_thread_data(NULL); } +void CDECL _vcomp_atomic_add_i4(int *dest, int val) +{ + interlocked_xchg_add(dest, val); +} + +void CDECL _vcomp_atomic_and_i4(int *dest, int val) +{ + int old; + do old = *dest; while (interlocked_cmpxchg(dest, old & val, old) != old); +} + +void CDECL _vcomp_atomic_div_i4(int *dest, int val) +{ + int old; + do old = *dest; while (interlocked_cmpxchg(dest, old / val, old) != old); +} + +void CDECL _vcomp_atomic_div_ui4(unsigned int *dest, unsigned int val) +{ + unsigned int old; + do old = *dest; while (interlocked_cmpxchg((int *)dest, old / val, old) != old); +} + +void CDECL _vcomp_atomic_mul_i4(int *dest, int val) +{ + int old; + do old = *dest; while (interlocked_cmpxchg(dest, old * val, old) != old); +} + +void CDECL _vcomp_atomic_or_i4(int *dest, int val) +{ + int old; + do old = *dest; while (interlocked_cmpxchg(dest, old | val, old) != old); +} + +void CDECL _vcomp_atomic_shl_i4(int *dest, int val) +{ + int old; + do old = *dest; while (interlocked_cmpxchg(dest, old << val, old) != old); +} + +void CDECL _vcomp_atomic_shr_i4(int *dest, int val) +{ + int old; + do old = *dest; while (interlocked_cmpxchg(dest, old >> val, old) != old); +} + +void CDECL _vcomp_atomic_shr_ui4(unsigned int *dest, unsigned int val) +{ + unsigned int old; + do old = *dest; while (interlocked_cmpxchg((int *)dest, old >> val, old) != old); +} + +void CDECL _vcomp_atomic_sub_i4(int *dest, int val) +{ + interlocked_xchg_add(dest, -val); +} + +void CDECL _vcomp_atomic_xor_i4(int *dest, int val) +{ + int old; + do old = *dest; while (interlocked_cmpxchg(dest, old ^ val, old) != old); +} + int CDECL omp_get_dynamic(void) { TRACE("stub\n"); diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec index 7083ce4ffdc..768daef1005 100644 --- a/dlls/vcomp/vcomp.spec +++ b/dlls/vcomp/vcomp.spec @@ -1,54 +1,54 @@ @ stub _vcomp_atomic_add_i1 @ stub _vcomp_atomic_add_i2 -@ stub _vcomp_atomic_add_i4 +@ cdecl _vcomp_atomic_add_i4(ptr long) @ stub _vcomp_atomic_add_i8 @ stub _vcomp_atomic_add_r4 @ stub _vcomp_atomic_add_r8 @ stub _vcomp_atomic_and_i1 @ stub _vcomp_atomic_and_i2 -@ stub _vcomp_atomic_and_i4 +@ cdecl _vcomp_atomic_and_i4(ptr long) @ stub _vcomp_atomic_and_i8 @ stub _vcomp_atomic_div_i1 @ stub _vcomp_atomic_div_i2 -@ stub _vcomp_atomic_div_i4 +@ cdecl _vcomp_atomic_div_i4(ptr long) @ stub _vcomp_atomic_div_i8 @ stub _vcomp_atomic_div_r4 @ stub _vcomp_atomic_div_r8 @ stub _vcomp_atomic_div_ui1 @ stub _vcomp_atomic_div_ui2 -@ stub _vcomp_atomic_div_ui4 +@ cdecl _vcomp_atomic_div_ui4(ptr long) @ stub _vcomp_atomic_div_ui8 @ stub _vcomp_atomic_mul_i1 @ stub _vcomp_atomic_mul_i2 -@ stub _vcomp_atomic_mul_i4 +@ cdecl _vcomp_atomic_mul_i4(ptr long) @ stub _vcomp_atomic_mul_i8 @ stub _vcomp_atomic_mul_r4 @ stub _vcomp_atomic_mul_r8 @ stub _vcomp_atomic_or_i1 @ stub _vcomp_atomic_or_i2 -@ stub _vcomp_atomic_or_i4 +@ cdecl _vcomp_atomic_or_i4(ptr long) @ stub _vcomp_atomic_or_i8 @ stub _vcomp_atomic_shl_i1 @ stub _vcomp_atomic_shl_i2 -@ stub _vcomp_atomic_shl_i4 +@ cdecl _vcomp_atomic_shl_i4(ptr long) @ stub _vcomp_atomic_shl_i8 @ stub _vcomp_atomic_shr_i1 @ stub _vcomp_atomic_shr_i2 -@ stub _vcomp_atomic_shr_i4 +@ cdecl _vcomp_atomic_shr_i4(ptr long) @ stub _vcomp_atomic_shr_i8 @ stub _vcomp_atomic_shr_ui1 @ stub _vcomp_atomic_shr_ui2 -@ stub _vcomp_atomic_shr_ui4 +@ cdecl _vcomp_atomic_shr_ui4(ptr long) @ stub _vcomp_atomic_shr_ui8 @ stub _vcomp_atomic_sub_i1 @ stub _vcomp_atomic_sub_i2 -@ stub _vcomp_atomic_sub_i4 +@ cdecl _vcomp_atomic_sub_i4(ptr long) @ stub _vcomp_atomic_sub_i8 @ stub _vcomp_atomic_sub_r4 @ stub _vcomp_atomic_sub_r8 @ stub _vcomp_atomic_xor_i1 @ stub _vcomp_atomic_xor_i2 -@ stub _vcomp_atomic_xor_i4 +@ cdecl _vcomp_atomic_xor_i4(ptr long) @ stub _vcomp_atomic_xor_i8 @ cdecl _vcomp_barrier() @ stub _vcomp_copyprivate_broadcast diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec index 56c7ae3bd79..7f77ce1cb88 100644 --- a/dlls/vcomp100/vcomp100.spec +++ b/dlls/vcomp100/vcomp100.spec @@ -1,54 +1,54 @@ @ stub _vcomp_atomic_add_i1 @ stub _vcomp_atomic_add_i2 -@ stub _vcomp_atomic_add_i4 +@ cdecl _vcomp_atomic_add_i4(ptr long) vcomp._vcomp_atomic_add_i4 @ stub _vcomp_atomic_add_i8 @ stub _vcomp_atomic_add_r4 @ stub _vcomp_atomic_add_r8 @ stub _vcomp_atomic_and_i1 @ stub _vcomp_atomic_and_i2 -@ stub _vcomp_atomic_and_i4 +@ cdecl _vcomp_atomic_and_i4(ptr long) vcomp._vcomp_atomic_and_i4 @ stub _vcomp_atomic_and_i8 @ stub _vcomp_atomic_div_i1 @ stub _vcomp_atomic_div_i2 -@ stub _vcomp_atomic_div_i4 +@ cdecl _vcomp_atomic_div_i4(ptr long) vcomp._vcomp_atomic_div_i4 @ stub _vcomp_atomic_div_i8 @ stub _vcomp_atomic_div_r4 @ stub _vcomp_atomic_div_r8 @ stub _vcomp_atomic_div_ui1 @ stub _vcomp_atomic_div_ui2 -@ stub _vcomp_atomic_div_ui4 +@ cdecl _vcomp_atomic_div_ui4(ptr long) vcomp._vcomp_atomic_div_ui4 @ stub _vcomp_atomic_div_ui8 @ stub _vcomp_atomic_mul_i1 @ stub _vcomp_atomic_mul_i2 -@ stub _vcomp_atomic_mul_i4 +@ cdecl _vcomp_atomic_mul_i4(ptr long) vcomp._vcomp_atomic_mul_i4 @ stub _vcomp_atomic_mul_i8 @ stub _vcomp_atomic_mul_r4 @ stub _vcomp_atomic_mul_r8 @ stub _vcomp_atomic_or_i1 @ stub _vcomp_atomic_or_i2 -@ stub _vcomp_atomic_or_i4 +@ cdecl _vcomp_atomic_or_i4(ptr long) vcomp._vcomp_atomic_or_i4 @ stub _vcomp_atomic_or_i8 @ stub _vcomp_atomic_shl_i1 @ stub _vcomp_atomic_shl_i2 -@ stub _vcomp_atomic_shl_i4 +@ cdecl _vcomp_atomic_shl_i4(ptr long) vcomp._vcomp_atomic_shl_i4 @ stub _vcomp_atomic_shl_i8 @ stub _vcomp_atomic_shr_i1 @ stub _vcomp_atomic_shr_i2 -@ stub _vcomp_atomic_shr_i4 +@ cdecl _vcomp_atomic_shr_i4(ptr long) vcomp._vcomp_atomic_shr_i4 @ stub _vcomp_atomic_shr_i8 @ stub _vcomp_atomic_shr_ui1 @ stub _vcomp_atomic_shr_ui2 -@ stub _vcomp_atomic_shr_ui4 +@ cdecl _vcomp_atomic_shr_ui4(ptr long) vcomp._vcomp_atomic_shr_ui4 @ stub _vcomp_atomic_shr_ui8 @ stub _vcomp_atomic_sub_i1 @ stub _vcomp_atomic_sub_i2 -@ stub _vcomp_atomic_sub_i4 +@ cdecl _vcomp_atomic_sub_i4(ptr long) vcomp._vcomp_atomic_sub_i4 @ stub _vcomp_atomic_sub_i8 @ stub _vcomp_atomic_sub_r4 @ stub _vcomp_atomic_sub_r8 @ stub _vcomp_atomic_xor_i1 @ stub _vcomp_atomic_xor_i2 -@ stub _vcomp_atomic_xor_i4 +@ cdecl _vcomp_atomic_xor_i4(ptr long) vcomp._vcomp_atomic_xor_i4 @ stub _vcomp_atomic_xor_i8 @ cdecl _vcomp_barrier() vcomp._vcomp_barrier @ stub _vcomp_copyprivate_broadcast diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec index 56c7ae3bd79..7f77ce1cb88 100644 --- a/dlls/vcomp90/vcomp90.spec +++ b/dlls/vcomp90/vcomp90.spec @@ -1,54 +1,54 @@ @ stub _vcomp_atomic_add_i1 @ stub _vcomp_atomic_add_i2 -@ stub _vcomp_atomic_add_i4 +@ cdecl _vcomp_atomic_add_i4(ptr long) vcomp._vcomp_atomic_add_i4 @ stub _vcomp_atomic_add_i8 @ stub _vcomp_atomic_add_r4 @ stub _vcomp_atomic_add_r8 @ stub _vcomp_atomic_and_i1 @ stub _vcomp_atomic_and_i2 -@ stub _vcomp_atomic_and_i4 +@ cdecl _vcomp_atomic_and_i4(ptr long) vcomp._vcomp_atomic_and_i4 @ stub _vcomp_atomic_and_i8 @ stub _vcomp_atomic_div_i1 @ stub _vcomp_atomic_div_i2 -@ stub _vcomp_atomic_div_i4 +@ cdecl _vcomp_atomic_div_i4(ptr long) vcomp._vcomp_atomic_div_i4 @ stub _vcomp_atomic_div_i8 @ stub _vcomp_atomic_div_r4 @ stub _vcomp_atomic_div_r8 @ stub _vcomp_atomic_div_ui1 @ stub _vcomp_atomic_div_ui2 -@ stub _vcomp_atomic_div_ui4 +@ cdecl _vcomp_atomic_div_ui4(ptr long) vcomp._vcomp_atomic_div_ui4 @ stub _vcomp_atomic_div_ui8 @ stub _vcomp_atomic_mul_i1 @ stub _vcomp_atomic_mul_i2 -@ stub _vcomp_atomic_mul_i4 +@ cdecl _vcomp_atomic_mul_i4(ptr long) vcomp._vcomp_atomic_mul_i4 @ stub _vcomp_atomic_mul_i8 @ stub _vcomp_atomic_mul_r4 @ stub _vcomp_atomic_mul_r8 @ stub _vcomp_atomic_or_i1 @ stub _vcomp_atomic_or_i2 -@ stub _vcomp_atomic_or_i4 +@ cdecl _vcomp_atomic_or_i4(ptr long) vcomp._vcomp_atomic_or_i4 @ stub _vcomp_atomic_or_i8 @ stub _vcomp_atomic_shl_i1 @ stub _vcomp_atomic_shl_i2 -@ stub _vcomp_atomic_shl_i4 +@ cdecl _vcomp_atomic_shl_i4(ptr long) vcomp._vcomp_atomic_shl_i4 @ stub _vcomp_atomic_shl_i8 @ stub _vcomp_atomic_shr_i1 @ stub _vcomp_atomic_shr_i2 -@ stub _vcomp_atomic_shr_i4 +@ cdecl _vcomp_atomic_shr_i4(ptr long) vcomp._vcomp_atomic_shr_i4 @ stub _vcomp_atomic_shr_i8 @ stub _vcomp_atomic_shr_ui1 @ stub _vcomp_atomic_shr_ui2 -@ stub _vcomp_atomic_shr_ui4 +@ cdecl _vcomp_atomic_shr_ui4(ptr long) vcomp._vcomp_atomic_shr_ui4 @ stub _vcomp_atomic_shr_ui8 @ stub _vcomp_atomic_sub_i1 @ stub _vcomp_atomic_sub_i2 -@ stub _vcomp_atomic_sub_i4 +@ cdecl _vcomp_atomic_sub_i4(ptr long) vcomp._vcomp_atomic_sub_i4 @ stub _vcomp_atomic_sub_i8 @ stub _vcomp_atomic_sub_r4 @ stub _vcomp_atomic_sub_r8 @ stub _vcomp_atomic_xor_i1 @ stub _vcomp_atomic_xor_i2 -@ stub _vcomp_atomic_xor_i4 +@ cdecl _vcomp_atomic_xor_i4(ptr long) vcomp._vcomp_atomic_xor_i4 @ stub _vcomp_atomic_xor_i8 @ cdecl _vcomp_barrier() vcomp._vcomp_barrier @ stub _vcomp_copyprivate_broadcast