[PATCH 3/3]ntdll/tests: Add tests for _allshl and _allshr.

Zhao Yi zhaoyi at uniontech.com
Fri Jun 10 04:57:42 CDT 2022


Signed-off-by: Zhao Yi <zhaoyi at uniontech.com>
---
 dlls/ntdll/tests/large_int.c | 57 ++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/dlls/ntdll/tests/large_int.c b/dlls/ntdll/tests/large_int.c
index 9635cac24ad..793696f1e4d 100644
--- a/dlls/ntdll/tests/large_int.c
+++ b/dlls/ntdll/tests/large_int.c
@@ -40,6 +40,9 @@ static LONGLONG (WINAPI *p_allmul)( LONGLONG a, LONGLONG b );
 static ULONGLONG (WINAPI *p_aulldiv)( ULONGLONG a, ULONGLONG b );
 static ULONGLONG (WINAPI *p_aullrem)( ULONGLONG a, ULONGLONG b );
 
+static LONGLONG (CDECL *p_allshl)(void);
+static LONGLONG (CDECL *p_allshr)(void);
+
 static void InitFunctionPtrs(void)
 {
     hntdll = LoadLibraryA("ntdll.dll");
@@ -56,6 +59,8 @@ static void InitFunctionPtrs(void)
         p_allmul = (void *)GetProcAddress(hntdll, "_allmul");
         p_aulldiv = (void *)GetProcAddress(hntdll, "_aulldiv");
         p_aullrem = (void *)GetProcAddress(hntdll, "_aullrem");
+        p_allshl = (void *)GetProcAddress(hntdll, "_allshl");
+        p_allshr = (void *)GetProcAddress(hntdll, "_allshr");
     } /* if */
 }
 
@@ -492,6 +497,56 @@ static void test_builtins(void)
 #endif /* __i386__ */
 }
 
+static void test_allshl(void)
+{
+	int c = 0;
+
+    asm("mov $0x55667788,%eax");
+    asm("mov $0x11223344,%edx");
+    asm("mov $0x4,%cl");
+    c = p_allshl();
+    ok(c == 0x56677880, "1. _allshl returned 0x%x\n", c);
+
+    asm("mov $0x55667788,%eax");
+    asm("mov $0x11223344,%edx");
+    asm("mov $0x28,%cl");
+    c = p_allshl();
+    ok(c == 0, "2. _allshl returned 0x%x\n", c);
+
+    asm("mov $0x55667788,%eax");
+    asm("mov $0x11223344,%edx");
+    asm("mov $0x46,%cl");
+    c = p_allshl();
+    ok(c == 0, "3. _allshl returned 0x%x\n", c);
+
+    return;
+}
+
+static void test_allshr(void)
+{
+	int c = 0;
+
+    asm("mov $0x55667788,%eax");
+    asm("mov $0x11223344,%edx");
+    asm("mov $0x4,%cl");
+    c = p_allshr();
+    ok(c == 0x45566778, "1. _allshr returned 0x%x\n", c);
+
+    asm("mov $0x55667788,%eax");
+    asm("mov $0x11223344,%edx");
+    asm("mov $0x28,%cl");
+    c = p_allshr();
+    ok(c == 0x112233, "2. _allshr returned 0x%x\n", c);
+
+    asm("mov $0x55667788,%eax");
+    asm("mov $0x11223344,%edx");
+    asm("mov $0x46,%cl");
+    c = p_allshr();
+    ok(c == 0, "3. _allshr returned 0x%x\n", c);
+
+	return;
+}
+
 START_TEST(large_int)
 {
     InitFunctionPtrs();
@@ -503,4 +558,6 @@ START_TEST(large_int)
     if (pRtlLargeIntegerToChar)
         test_RtlLargeIntegerToChar();
     test_builtins();
+    test_allshl();
+    test_allshr();
 }
-- 
2.20.1


More information about the wine-devel mailing list