You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Rebase against 797c037bff2f7621f5b3d632bd899349529d6b2b.
This commit is contained in:
@ -1,166 +0,0 @@
|
||||
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
|
||||
|
@ -1,168 +0,0 @@
|
||||
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
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 95b19ecbd1cc556939bc6bd8d0b7d2ce71669fb0 Mon Sep 17 00:00:00 2001
|
||||
From 6c4782b340f4cd6c9262cda2a4023f3d472e380e 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,7 +8,7 @@ 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 0c7f8ba..8dab83a 100644
|
||||
index f021a72..faa7bd1 100644
|
||||
--- a/dlls/vcomp/tests/vcomp.c
|
||||
+++ b/dlls/vcomp/tests/vcomp.c
|
||||
@@ -51,6 +51,9 @@ static void (CDECL *p_vcomp_atomic_sub_r4)(float *dest, float val);
|
||||
@ -30,8 +30,8 @@ index 0c7f8ba..8dab83a 100644
|
||||
VCOMP_GET_PROC(_vcomp_for_static_end);
|
||||
VCOMP_GET_PROC(_vcomp_for_static_init);
|
||||
VCOMP_GET_PROC(_vcomp_for_static_simple_init);
|
||||
@@ -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);
|
||||
@@ -991,6 +996,68 @@ static void test_atomic_double(void)
|
||||
}
|
||||
}
|
||||
|
||||
+static void CDECL for_dynamic_cb(LONG *a, LONG *b, LONG *c)
|
||||
@ -99,14 +99,14 @@ index 0c7f8ba..8dab83a 100644
|
||||
START_TEST(vcomp)
|
||||
{
|
||||
if (!init_vcomp())
|
||||
@@ -1040,6 +1107,7 @@ START_TEST(vcomp)
|
||||
@@ -1002,6 +1069,7 @@ START_TEST(vcomp)
|
||||
test_vcomp_sections_init();
|
||||
test_vcomp_for_static_simple_init();
|
||||
test_vcomp_for_static_init();
|
||||
+ test_vcomp_for_dynamic_init();
|
||||
test_atomic_int32();
|
||||
test_atomic_uint32();
|
||||
test_atomic_integer32();
|
||||
test_atomic_float();
|
||||
test_atomic_double();
|
||||
--
|
||||
2.4.5
|
||||
|
@ -1,108 +0,0 @@
|
||||
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
|
||||
|
@ -1,92 +0,0 @@
|
||||
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
|
||||
|
@ -1,108 +0,0 @@
|
||||
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
|
||||
|
@ -1,98 +0,0 @@
|
||||
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
|
||||
|
Reference in New Issue
Block a user