Update vcomp patchset and add implementation for various atomic functions.

This commit is contained in:
Sebastian Lackner 2015-07-26 02:10:22 +02:00
parent 75174bcf22
commit 495e7f4985
10 changed files with 781 additions and 28 deletions

1
debian/changelog vendored
View File

@ -3,6 +3,7 @@ wine-staging (1.7.48) UNRELEASED; urgency=low
additional tests.
* Update patchset to query GPU infos with GLX_MESA_query_renderer extension
(fixes a regression with broken MESA versions).
* Update vcomp patchset and add implementation for various atomic functions.
* Added patch to forward exitcode from child process when in wineconsole.
* Added patch to check architecture before trying to load libraries.
* Added patch to share source of d3dx9_36 with d3dx9_33 to avoid Wine DLL

View File

@ -4535,9 +4535,21 @@ fi
# | dlls/vcomp90/vcomp90.spec
# |
if test "$enable_vcomp_Functions" -eq 1; then
patch_apply vcomp-Functions/0001-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch
patch_apply vcomp-Functions/0002-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch
patch_apply vcomp-Functions/0001-vcomp-Implement-32-bit-atomic-integer-functions.patch
patch_apply vcomp-Functions/0002-vcomp-tests-Add-tests-for-32-bit-atomic-integer-func.patch
patch_apply vcomp-Functions/0003-vcomp-Implement-atomic-float-functions.patch
patch_apply vcomp-Functions/0004-vcomp-tests-Add-tests-for-atomic-float-functions.patch
patch_apply vcomp-Functions/0005-vcomp-Implement-atomic-double-functions.patch
patch_apply vcomp-Functions/0006-vcomp-tests-Add-tests-for-atomic-double-functions.patch
patch_apply vcomp-Functions/0007-vcomp-Implement-_vcomp_for_dynamic_init-and-_vcomp_f.patch
patch_apply vcomp-Functions/0008-vcomp-tests-Add-tests-for-_vcomp_for_dynamic_init.patch
(
echo '+ { "Sebastian Lackner", "vcomp: Implement 32-bit atomic integer functions.", 1 },';
echo '+ { "Sebastian Lackner", "vcomp/tests: Add tests for 32-bit atomic integer functions.", 1 },';
echo '+ { "Sebastian Lackner", "vcomp: Implement atomic float functions.", 1 },';
echo '+ { "Sebastian Lackner", "vcomp/tests: Add tests for atomic float functions.", 1 },';
echo '+ { "Sebastian Lackner", "vcomp: Implement atomic double functions.", 1 },';
echo '+ { "Sebastian Lackner", "vcomp/tests: Add tests for atomic double functions.", 1 },';
echo '+ { "Sebastian Lackner", "vcomp: Implement _vcomp_for_dynamic_init and _vcomp_for_dynamic_next.", 1 },';
echo '+ { "Sebastian Lackner", "vcomp/tests: Add tests for _vcomp_for_dynamic_init.", 1 },';
) >> "$patchlist"

View File

@ -0,0 +1,166 @@
From 6f3f0538fc92bc42e942353a446df3afdb395a19 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 26 Jul 2015 01:53:56 +0200
Subject: vcomp: Implement 32-bit atomic integer functions.
---
dlls/vcomp/main.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++
dlls/vcomp/vcomp.spec | 22 ++++++++---------
2 files changed, 76 insertions(+), 11 deletions(-)
diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index ae5623b..6f0caf6 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -22,6 +22,7 @@
*/
#include "config.h"
+#include "wine/port.h"
#include <stdarg.h>
#include <assert.h>
@@ -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 7083ce4..768daef 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
--
2.4.5

View File

@ -0,0 +1,168 @@
From 48fc0019e5f426177b420c0115bf813f989fd1e8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 26 Jul 2015 01:56:05 +0200
Subject: vcomp/tests: Add tests for 32-bit atomic integer functions.
---
dlls/vcomp/tests/vcomp.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 124 insertions(+)
diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index 17b37f2..6405f1d 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -31,6 +31,17 @@ static BOOL (WINAPI *pActivateActCtx)(HANDLE, ULONG_PTR*);
static BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR);
static VOID (WINAPI *pReleaseActCtx)(HANDLE);
+static void (CDECL *p_vcomp_atomic_add_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_and_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_div_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_div_ui4)(unsigned int *dest, unsigned int val);
+static void (CDECL *p_vcomp_atomic_mul_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_or_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_shl_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_shr_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_shr_ui4)(unsigned int *dest, unsigned int val);
+static void (CDECL *p_vcomp_atomic_sub_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_xor_i4)(int *dest, int val);
static void (CDECL *p_vcomp_barrier)(void);
static void (CDECL *p_vcomp_for_static_end)(void);
static void (CDECL *p_vcomp_for_static_init)(int first, int last, int step, int chunksize, unsigned int *loops,
@@ -175,6 +186,17 @@ static BOOL init_vcomp(void)
return FALSE;
}
+ VCOMP_GET_PROC(_vcomp_atomic_add_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_and_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_div_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_div_ui4);
+ VCOMP_GET_PROC(_vcomp_atomic_mul_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_or_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_shl_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_shr_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_shr_ui4);
+ VCOMP_GET_PROC(_vcomp_atomic_sub_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_xor_i4);
VCOMP_GET_PROC(_vcomp_barrier);
VCOMP_GET_PROC(_vcomp_for_static_end);
VCOMP_GET_PROC(_vcomp_for_static_init);
@@ -849,6 +871,106 @@ static void test_vcomp_for_static_init(void)
pomp_set_num_threads(max_threads);
}
+static void test_atomic_int32(void)
+{
+ int val;
+
+ val = 0x11223344;
+ p_vcomp_atomic_add_i4(&val, 0x77665544);
+ ok(val == -0x77777778, "expected val == -0x77777778, got %d\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_and_i4(&val, 0x77665544);
+ ok(val == 0x11221144, "expected val == 0x11221144, got %d\n", val);
+
+ val = 0x77665544;
+ p_vcomp_atomic_div_i4(&val, 0x11223344);
+ ok(val == 6, "expected val == 6, got %d\n", val);
+
+ val = 0x77665544;
+ p_vcomp_atomic_div_i4(&val, -0x11223344);
+ ok(val == -6, "expected val == -6, got %d\n", val);
+
+if (0)
+{
+ /* crashes on Windows */
+ val = 0x11223344;
+ p_vcomp_atomic_div_i4(&val, 0);
+}
+
+ val = 0x11223344;
+ p_vcomp_atomic_mul_i4(&val, 0x77665544);
+ ok(val == -0xecccdf0, "expected val == -0xecccdf0, got %d\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_mul_i4(&val, -0x77665544);
+ ok(val == 0xecccdf0, "expected val == 0xecccdf0, got %d\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_or_i4(&val, 0x77665544);
+ ok(val == 0x77667744, "expected val == 0x77667744, got %d\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_shl_i4(&val, 3);
+ ok(val == -0x76ee65e0, "expected val == -0x76ee65e0, got %d\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_shl_i4(&val, 35);
+ ok(val == -0x76ee65e0, "expected val == -0x76ee65e0, got %d\n", val);
+
+ val = -0x11223344;
+ p_vcomp_atomic_shl_i4(&val, 3);
+ ok(val == 0x76ee65e0, "expected val == 0x76ee65e0, got %d\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_shr_i4(&val, 3);
+ ok(val == 0x2244668, "expected val == 0x2244668, got %d\n", val);
+
+ val = -0x11223344;
+ p_vcomp_atomic_shr_i4(&val, 3);
+ ok(val == -0x2244669, "expected val == -0x2244669, got %d\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_sub_i4(&val, 0x77665544);
+ ok(val == -0x66442200, "expected val == -0x66442200, got %d\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_xor_i4(&val, 0x77665544);
+ ok(val == 0x66446600, "expected val == 0x66446600, got %d\n", val);
+}
+
+static void test_atomic_uint32(void)
+{
+ unsigned int val;
+
+ val = 0x77665544;
+ p_vcomp_atomic_div_ui4(&val, 0x11223344);
+ ok(val == 6, "expected val == 6, got %u\n", val);
+
+ val = 0x77665544;
+ p_vcomp_atomic_div_ui4(&val, 0xeeddccbc);
+ ok(val == 0, "expected val == 6, got %u\n", val);
+
+if (0)
+{
+ /* crashes on Windows */
+ val = 0x11223344;
+ p_vcomp_atomic_div_ui4(&val, 0);
+}
+
+ val = 0x11223344;
+ p_vcomp_atomic_shr_ui4(&val, 3);
+ ok(val == 0x2244668, "expected val == 0x2244668, got %u\n", val);
+
+ val = 0x11223344;
+ p_vcomp_atomic_shr_ui4(&val, 35);
+ ok(val == 0x2244668, "expected val == 0x2244668, got %u\n", val);
+
+ val = -0x11223344;
+ p_vcomp_atomic_shr_ui4(&val, 3);
+ ok(val == 0x1ddbb997, "expected val == 0x1ddbb997, got %u\n", val);
+}
+
START_TEST(vcomp)
{
if (!init_vcomp())
@@ -860,6 +982,8 @@ START_TEST(vcomp)
test_vcomp_sections_init();
test_vcomp_for_static_simple_init();
test_vcomp_for_static_init();
+ test_atomic_int32();
+ test_atomic_uint32();
release_vcomp();
}
--
2.4.5

View File

@ -0,0 +1,108 @@
From 0fc6d292b2874ddfb7d11d0adfb1796e0ce1ad02 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 26 Jul 2015 01:59:14 +0200
Subject: vcomp: Implement atomic float functions.
---
dlls/vcomp/main.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
dlls/vcomp/vcomp.spec | 8 ++++----
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 6f0caf6..92c8eaf 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -286,6 +286,50 @@ void CDECL _vcomp_atomic_xor_i4(int *dest, int val)
do old = *dest; while (interlocked_cmpxchg(dest, old ^ val, old) != old);
}
+void CDECL _vcomp_atomic_add_r4(float *dest, float val)
+{
+ int old, new;
+ do
+ {
+ old = *(int *)dest;
+ *(float *)&new = *(float *)&old + val;
+ }
+ while (interlocked_cmpxchg((int *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_div_r4(float *dest, float val)
+{
+ int old, new;
+ do
+ {
+ old = *(int *)dest;
+ *(float *)&new = *(float *)&old / val;
+ }
+ while (interlocked_cmpxchg((int *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_mul_r4(float *dest, float val)
+{
+ int old, new;
+ do
+ {
+ old = *(int *)dest;
+ *(float *)&new = *(float *)&old * val;
+ }
+ while (interlocked_cmpxchg((int *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_sub_r4(float *dest, float val)
+{
+ int old, new;
+ do
+ {
+ old = *(int *)dest;
+ *(float *)&new = *(float *)&old - val;
+ }
+ while (interlocked_cmpxchg((int *)dest, new, old) != old);
+}
+
int CDECL omp_get_dynamic(void)
{
TRACE("stub\n");
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index 768daef..bc963cb 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -2,7 +2,7 @@
@ stub _vcomp_atomic_add_i2
@ cdecl _vcomp_atomic_add_i4(ptr long)
@ stub _vcomp_atomic_add_i8
-@ stub _vcomp_atomic_add_r4
+@ cdecl _vcomp_atomic_add_r4(ptr float)
@ stub _vcomp_atomic_add_r8
@ stub _vcomp_atomic_and_i1
@ stub _vcomp_atomic_and_i2
@@ -12,7 +12,7 @@
@ stub _vcomp_atomic_div_i2
@ cdecl _vcomp_atomic_div_i4(ptr long)
@ stub _vcomp_atomic_div_i8
-@ stub _vcomp_atomic_div_r4
+@ cdecl _vcomp_atomic_div_r4(ptr float)
@ stub _vcomp_atomic_div_r8
@ stub _vcomp_atomic_div_ui1
@ stub _vcomp_atomic_div_ui2
@@ -22,7 +22,7 @@
@ stub _vcomp_atomic_mul_i2
@ cdecl _vcomp_atomic_mul_i4(ptr long)
@ stub _vcomp_atomic_mul_i8
-@ stub _vcomp_atomic_mul_r4
+@ cdecl _vcomp_atomic_mul_r4(ptr float)
@ stub _vcomp_atomic_mul_r8
@ stub _vcomp_atomic_or_i1
@ stub _vcomp_atomic_or_i2
@@ -44,7 +44,7 @@
@ stub _vcomp_atomic_sub_i2
@ cdecl _vcomp_atomic_sub_i4(ptr long)
@ stub _vcomp_atomic_sub_i8
-@ stub _vcomp_atomic_sub_r4
+@ cdecl _vcomp_atomic_sub_r4(ptr float)
@ stub _vcomp_atomic_sub_r8
@ stub _vcomp_atomic_xor_i1
@ stub _vcomp_atomic_xor_i2
--
2.4.5

View File

@ -0,0 +1,92 @@
From 520f89435a4d23962fc9acf1438a41e0d8a6f350 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 26 Jul 2015 02:00:04 +0200
Subject: vcomp/tests: Add tests for atomic float functions.
---
dlls/vcomp/tests/vcomp.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index 6405f1d..ddb691c 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -32,15 +32,19 @@ static BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR);
static VOID (WINAPI *pReleaseActCtx)(HANDLE);
static void (CDECL *p_vcomp_atomic_add_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_add_r4)(float *dest, float val);
static void (CDECL *p_vcomp_atomic_and_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_div_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_div_r4)(float *dest, float val);
static void (CDECL *p_vcomp_atomic_div_ui4)(unsigned int *dest, unsigned int val);
static void (CDECL *p_vcomp_atomic_mul_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_mul_r4)(float *dest, float val);
static void (CDECL *p_vcomp_atomic_or_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_shl_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_shr_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_shr_ui4)(unsigned int *dest, unsigned int val);
static void (CDECL *p_vcomp_atomic_sub_i4)(int *dest, int val);
+static void (CDECL *p_vcomp_atomic_sub_r4)(float *dest, float val);
static void (CDECL *p_vcomp_atomic_xor_i4)(int *dest, int val);
static void (CDECL *p_vcomp_barrier)(void);
static void (CDECL *p_vcomp_for_static_end)(void);
@@ -187,15 +191,19 @@ static BOOL init_vcomp(void)
}
VCOMP_GET_PROC(_vcomp_atomic_add_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_add_r4);
VCOMP_GET_PROC(_vcomp_atomic_and_i4);
VCOMP_GET_PROC(_vcomp_atomic_div_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_div_r4);
VCOMP_GET_PROC(_vcomp_atomic_div_ui4);
VCOMP_GET_PROC(_vcomp_atomic_mul_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_mul_r4);
VCOMP_GET_PROC(_vcomp_atomic_or_i4);
VCOMP_GET_PROC(_vcomp_atomic_shl_i4);
VCOMP_GET_PROC(_vcomp_atomic_shr_i4);
VCOMP_GET_PROC(_vcomp_atomic_shr_ui4);
VCOMP_GET_PROC(_vcomp_atomic_sub_i4);
+ VCOMP_GET_PROC(_vcomp_atomic_sub_r4);
VCOMP_GET_PROC(_vcomp_atomic_xor_i4);
VCOMP_GET_PROC(_vcomp_barrier);
VCOMP_GET_PROC(_vcomp_for_static_end);
@@ -971,6 +979,27 @@ if (0)
ok(val == 0x1ddbb997, "expected val == 0x1ddbb997, got %u\n", val);
}
+static void test_atomic_float(void)
+{
+ float val;
+
+ val = 42.0;
+ p_vcomp_atomic_add_r4(&val, 17.0);
+ ok(58.9999 < val && val < 59.0001, "expected val == 59.0, got %f\n", val);
+
+ val = 42.0;
+ p_vcomp_atomic_div_r4(&val, 17.0);
+ ok(2.4705 < val && val < 2.4707, "expected val == 2.4706, got %f\n", val);
+
+ val = 42.0;
+ p_vcomp_atomic_mul_r4(&val, 17.0);
+ ok(713.9999 < val && val < 714.0001, "expected val == 714.0, got %f\n", val);
+
+ val = 42.0;
+ p_vcomp_atomic_sub_r4(&val, 17.0);
+ ok(24.9999 < val && val < 25.0001, "expected val == 25.0, got %f\n", val);
+}
+
START_TEST(vcomp)
{
if (!init_vcomp())
@@ -984,6 +1013,7 @@ START_TEST(vcomp)
test_vcomp_for_static_init();
test_atomic_int32();
test_atomic_uint32();
+ test_atomic_float();
release_vcomp();
}
--
2.4.5

View File

@ -0,0 +1,108 @@
From 932eec0d4c46b47bace34f1bcee0483be0b450e0 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 26 Jul 2015 02:01:17 +0200
Subject: vcomp: Implement atomic double functions.
---
dlls/vcomp/main.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
dlls/vcomp/vcomp.spec | 8 ++++----
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 92c8eaf..301370c 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -330,6 +330,50 @@ void CDECL _vcomp_atomic_sub_r4(float *dest, float val)
while (interlocked_cmpxchg((int *)dest, new, old) != old);
}
+void CDECL _vcomp_atomic_add_r8(double *dest, double val)
+{
+ LONG64 old, new;
+ do
+ {
+ old = *(LONG64 *)dest;
+ *(double *)&new = *(double *)&old + val;
+ }
+ while (interlocked_cmpxchg64((LONG64 *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_div_r8(double *dest, double val)
+{
+ LONG64 old, new;
+ do
+ {
+ old = *(LONG64 *)dest;
+ *(double *)&new = *(double *)&old / val;
+ }
+ while (interlocked_cmpxchg64((LONG64 *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_mul_r8(double *dest, double val)
+{
+ LONG64 old, new;
+ do
+ {
+ old = *(LONG64 *)dest;
+ *(double *)&new = *(double *)&old * val;
+ }
+ while (interlocked_cmpxchg64((LONG64 *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_sub_r8(double *dest, double val)
+{
+ LONG64 old, new;
+ do
+ {
+ old = *(LONG64 *)dest;
+ *(double *)&new = *(double *)&old - val;
+ }
+ while (interlocked_cmpxchg64((LONG64 *)dest, new, old) != old);
+}
+
int CDECL omp_get_dynamic(void)
{
TRACE("stub\n");
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index bc963cb..3a709df 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -3,7 +3,7 @@
@ cdecl _vcomp_atomic_add_i4(ptr long)
@ stub _vcomp_atomic_add_i8
@ cdecl _vcomp_atomic_add_r4(ptr float)
-@ stub _vcomp_atomic_add_r8
+@ cdecl _vcomp_atomic_add_r8(ptr double)
@ stub _vcomp_atomic_and_i1
@ stub _vcomp_atomic_and_i2
@ cdecl _vcomp_atomic_and_i4(ptr long)
@@ -13,7 +13,7 @@
@ cdecl _vcomp_atomic_div_i4(ptr long)
@ stub _vcomp_atomic_div_i8
@ cdecl _vcomp_atomic_div_r4(ptr float)
-@ stub _vcomp_atomic_div_r8
+@ cdecl _vcomp_atomic_div_r8(ptr double)
@ stub _vcomp_atomic_div_ui1
@ stub _vcomp_atomic_div_ui2
@ cdecl _vcomp_atomic_div_ui4(ptr long)
@@ -23,7 +23,7 @@
@ cdecl _vcomp_atomic_mul_i4(ptr long)
@ stub _vcomp_atomic_mul_i8
@ cdecl _vcomp_atomic_mul_r4(ptr float)
-@ stub _vcomp_atomic_mul_r8
+@ cdecl _vcomp_atomic_mul_r8(ptr double)
@ stub _vcomp_atomic_or_i1
@ stub _vcomp_atomic_or_i2
@ cdecl _vcomp_atomic_or_i4(ptr long)
@@ -45,7 +45,7 @@
@ cdecl _vcomp_atomic_sub_i4(ptr long)
@ stub _vcomp_atomic_sub_i8
@ cdecl _vcomp_atomic_sub_r4(ptr float)
-@ stub _vcomp_atomic_sub_r8
+@ cdecl _vcomp_atomic_sub_r8(ptr double)
@ stub _vcomp_atomic_xor_i1
@ stub _vcomp_atomic_xor_i2
@ cdecl _vcomp_atomic_xor_i4(ptr long)
--
2.4.5

View File

@ -0,0 +1,98 @@
From 3858848a1e3057ad9c1edc8d92f8d6f4e614261e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 26 Jul 2015 02:02:23 +0200
Subject: vcomp/tests: Add tests for atomic double functions.
---
dlls/vcomp/tests/vcomp.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index ddb691c..0c7f8ba 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -33,18 +33,22 @@ static VOID (WINAPI *pReleaseActCtx)(HANDLE);
static void (CDECL *p_vcomp_atomic_add_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_add_r4)(float *dest, float val);
+static void (CDECL *p_vcomp_atomic_add_r8)(double *dest, double val);
static void (CDECL *p_vcomp_atomic_and_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_div_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_div_r4)(float *dest, float val);
+static void (CDECL *p_vcomp_atomic_div_r8)(double *dest, double val);
static void (CDECL *p_vcomp_atomic_div_ui4)(unsigned int *dest, unsigned int val);
static void (CDECL *p_vcomp_atomic_mul_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_mul_r4)(float *dest, float val);
+static void (CDECL *p_vcomp_atomic_mul_r8)(double *dest, double val);
static void (CDECL *p_vcomp_atomic_or_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_shl_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_shr_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_shr_ui4)(unsigned int *dest, unsigned int val);
static void (CDECL *p_vcomp_atomic_sub_i4)(int *dest, int val);
static void (CDECL *p_vcomp_atomic_sub_r4)(float *dest, float val);
+static void (CDECL *p_vcomp_atomic_sub_r8)(double *dest, double val);
static void (CDECL *p_vcomp_atomic_xor_i4)(int *dest, int val);
static void (CDECL *p_vcomp_barrier)(void);
static void (CDECL *p_vcomp_for_static_end)(void);
@@ -192,18 +196,22 @@ static BOOL init_vcomp(void)
VCOMP_GET_PROC(_vcomp_atomic_add_i4);
VCOMP_GET_PROC(_vcomp_atomic_add_r4);
+ VCOMP_GET_PROC(_vcomp_atomic_add_r8);
VCOMP_GET_PROC(_vcomp_atomic_and_i4);
VCOMP_GET_PROC(_vcomp_atomic_div_i4);
VCOMP_GET_PROC(_vcomp_atomic_div_r4);
+ VCOMP_GET_PROC(_vcomp_atomic_div_r8);
VCOMP_GET_PROC(_vcomp_atomic_div_ui4);
VCOMP_GET_PROC(_vcomp_atomic_mul_i4);
VCOMP_GET_PROC(_vcomp_atomic_mul_r4);
+ VCOMP_GET_PROC(_vcomp_atomic_mul_r8);
VCOMP_GET_PROC(_vcomp_atomic_or_i4);
VCOMP_GET_PROC(_vcomp_atomic_shl_i4);
VCOMP_GET_PROC(_vcomp_atomic_shr_i4);
VCOMP_GET_PROC(_vcomp_atomic_shr_ui4);
VCOMP_GET_PROC(_vcomp_atomic_sub_i4);
VCOMP_GET_PROC(_vcomp_atomic_sub_r4);
+ VCOMP_GET_PROC(_vcomp_atomic_sub_r8);
VCOMP_GET_PROC(_vcomp_atomic_xor_i4);
VCOMP_GET_PROC(_vcomp_barrier);
VCOMP_GET_PROC(_vcomp_for_static_end);
@@ -1000,6 +1008,27 @@ static void test_atomic_float(void)
ok(24.9999 < val && val < 25.0001, "expected val == 25.0, got %f\n", val);
}
+static void test_atomic_double(void)
+{
+ double val;
+
+ val = 42.0;
+ p_vcomp_atomic_add_r8(&val, 17.0);
+ ok(58.9999 < val && val < 59.0001, "expected val == 59.0, got %f\n", val);
+
+ val = 42.0;
+ p_vcomp_atomic_div_r8(&val, 17.0);
+ ok(2.4705 < val && val < 2.4707, "expected val == 2.4706, got %f\n", val);
+
+ val = 42.0;
+ p_vcomp_atomic_mul_r8(&val, 17.0);
+ ok(713.9999 < val && val < 714.0001, "expected val == 714.0, got %f\n", val);
+
+ val = 42.0;
+ p_vcomp_atomic_sub_r8(&val, 17.0);
+ ok(24.9999 < val && val < 25.0001, "expected val == 25.0, got %f\n", val);
+}
+
START_TEST(vcomp)
{
if (!init_vcomp())
@@ -1014,6 +1043,7 @@ START_TEST(vcomp)
test_atomic_int32();
test_atomic_uint32();
test_atomic_float();
+ test_atomic_double();
release_vcomp();
}
--
2.4.5

View File

@ -1,4 +1,4 @@
From 69ccde5d615c9d4fef7263ffc887bc1cab96bf5c Mon Sep 17 00:00:00 2001
From ae5dc1f9033a941c293ad221c19e5d49c140a13f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 19 Jul 2015 01:01:28 +0200
Subject: vcomp: Implement _vcomp_for_dynamic_init and _vcomp_for_dynamic_next.
@ -11,10 +11,10 @@ Subject: vcomp: Implement _vcomp_for_dynamic_init and _vcomp_for_dynamic_next.
4 files changed, 83 insertions(+), 6 deletions(-)
diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index ae5623b..d123327 100644
index 301370c..2433abc 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -63,6 +63,9 @@ struct vcomp_thread_data
@@ -64,6 +64,9 @@ struct vcomp_thread_data
/* section */
unsigned int section;
@ -24,7 +24,7 @@ index ae5623b..d123327 100644
};
struct vcomp_team_data
@@ -87,6 +90,14 @@ struct vcomp_task_data
@@ -88,6 +91,14 @@ struct vcomp_task_data
unsigned int section;
int num_sections;
int section_index;
@ -39,7 +39,7 @@ index ae5623b..d123327 100644
};
#if defined(__i386__)
@@ -199,6 +210,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void)
@@ -200,6 +211,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void)
}
data->task.section = 0;
@ -47,7 +47,7 @@ index ae5623b..d123327 100644
thread_data = &data->thread;
thread_data->team = NULL;
@@ -207,6 +219,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void)
@@ -208,6 +220,7 @@ static struct vcomp_thread_data *vcomp_init_thread_data(void)
thread_data->parallel = FALSE;
thread_data->fork_threads = 0;
thread_data->section = 1;
@ -55,7 +55,7 @@ index ae5623b..d123327 100644
vcomp_set_thread_data(thread_data);
return thread_data;
@@ -481,6 +494,66 @@ void CDECL _vcomp_for_static_end(void)
@@ -634,6 +647,66 @@ void CDECL _vcomp_for_static_end(void)
/* nothing to do here */
}
@ -122,7 +122,7 @@ index ae5623b..d123327 100644
int CDECL omp_in_parallel(void)
{
TRACE("()\n");
@@ -558,6 +631,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
@@ -711,6 +784,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
team_data.barrier_count = 0;
task_data.section = 0;
@ -130,7 +130,7 @@ index ae5623b..d123327 100644
thread_data.team = &team_data;
thread_data.task = &task_data;
@@ -565,6 +639,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
@@ -718,6 +792,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
thread_data.parallel = ifval || prev_thread_data->parallel;
thread_data.fork_threads = 0;
thread_data.section = 1;
@ -138,7 +138,7 @@ index ae5623b..d123327 100644
list_init(&thread_data.entry);
InitializeConditionVariable(&thread_data.cond);
@@ -583,6 +658,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
@@ -736,6 +811,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
data->parallel = thread_data.parallel;
data->fork_threads = 0;
data->section = 1;
@ -146,7 +146,7 @@ index ae5623b..d123327 100644
list_remove(&data->entry);
list_add_tail(&thread_data.entry, &data->entry);
WakeAllConditionVariable(&data->cond);
@@ -604,6 +680,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
@@ -757,6 +833,7 @@ void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
data->parallel = thread_data.parallel;
data->fork_threads = 0;
data->section = 1;
@ -155,7 +155,7 @@ index ae5623b..d123327 100644
thread = CreateThread(NULL, 0, _vcomp_fork_worker, data, 0, NULL);
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index 7083ce4..1b02a65 100644
index 3a709df..6e2fcec 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -55,9 +55,9 @@

View File

@ -1,4 +1,4 @@
From a175543f726f1205054a69bef12d901453326016 Mon Sep 17 00:00:00 2001
From 95b19ecbd1cc556939bc6bd8d0b7d2ce71669fb0 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 19 Jul 2015 01:05:02 +0200
Subject: vcomp/tests: Add tests for _vcomp_for_dynamic_init.
@ -8,12 +8,12 @@ Subject: vcomp/tests: Add tests for _vcomp_for_dynamic_init.
1 file changed, 68 insertions(+)
diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index bb1026b..769edf9 100644
index 0c7f8ba..8dab83a 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -32,6 +32,9 @@ static BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR);
static VOID (WINAPI *pReleaseActCtx)(HANDLE);
@@ -51,6 +51,9 @@ static void (CDECL *p_vcomp_atomic_sub_r4)(float *dest, float val);
static void (CDECL *p_vcomp_atomic_sub_r8)(double *dest, double val);
static void (CDECL *p_vcomp_atomic_xor_i4)(int *dest, int val);
static void (CDECL *p_vcomp_barrier)(void);
+static void (CDECL *p_vcomp_for_dynamic_init)(unsigned int flags, unsigned int first, unsigned int last,
+ int step, unsigned int chunksize);
@ -21,17 +21,17 @@ index bb1026b..769edf9 100644
static void (CDECL *p_vcomp_for_static_end)(void);
static void (CDECL *p_vcomp_for_static_init)(int first, int last, int step, int chunksize, unsigned int *loops,
int *begin, int *end, int *next, int *lastchunk);
@@ -176,6 +179,8 @@ static BOOL init_vcomp(void)
}
@@ -214,6 +217,8 @@ static BOOL init_vcomp(void)
VCOMP_GET_PROC(_vcomp_atomic_sub_r8);
VCOMP_GET_PROC(_vcomp_atomic_xor_i4);
VCOMP_GET_PROC(_vcomp_barrier);
+ VCOMP_GET_PROC(_vcomp_for_dynamic_init);
+ VCOMP_GET_PROC(_vcomp_for_dynamic_next);
VCOMP_GET_PROC(_vcomp_for_static_end);
VCOMP_GET_PROC(_vcomp_for_static_init);
VCOMP_GET_PROC(_vcomp_for_static_simple_init);
@@ -849,6 +854,68 @@ static void test_vcomp_for_static_init(void)
pomp_set_num_threads(max_threads);
@@ -1029,6 +1034,68 @@ static void test_atomic_double(void)
ok(24.9999 < val && val < 25.0001, "expected val == 25.0, got %f\n", val);
}
+static void CDECL for_dynamic_cb(LONG *a, LONG *b, LONG *c)
@ -99,14 +99,14 @@ index bb1026b..769edf9 100644
START_TEST(vcomp)
{
if (!init_vcomp())
@@ -860,6 +927,7 @@ START_TEST(vcomp)
@@ -1040,6 +1107,7 @@ START_TEST(vcomp)
test_vcomp_sections_init();
test_vcomp_for_static_simple_init();
test_vcomp_for_static_init();
+ test_vcomp_for_dynamic_init();
release_vcomp();
}
test_atomic_int32();
test_atomic_uint32();
test_atomic_float();
--
2.4.5