https://git.reactos.org/?p=reactos.git;a=commitdiff;h=955b5c27b19c81358007003b076e60079a2e2e84

commit 955b5c27b19c81358007003b076e60079a2e2e84
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Tue Apr 13 10:45:10 2021 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Apr 28 13:10:23 2021 +0200

    [CRT] Fix __ll_lshift, __ll_rshift and __ull_rshift intrinsics on gcc-amd64
---
 sdk/include/crt/mingw32/intrin_x86.h | 41 ++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/sdk/include/crt/mingw32/intrin_x86.h 
b/sdk/include/crt/mingw32/intrin_x86.h
index c772338d3fa..5cf6c2884b3 100644
--- a/sdk/include/crt/mingw32/intrin_x86.h
+++ b/sdk/include/crt/mingw32/intrin_x86.h
@@ -1298,6 +1298,46 @@ __INTRIN_INLINE unsigned long __cdecl _lrotr(unsigned 
long value, int shift)
 }
 #endif
 
+#ifdef __x86_64__
+__INTRIN_INLINE unsigned long long __ll_lshift(unsigned long long Mask, int 
Bit)
+{
+    unsigned long long retval;
+    unsigned char shift = Bit & 0x3F;
+
+    __asm__
+    (
+        "shlq %[shift], %[Mask]" : "=r"(retval) : [Mask] "0"(Mask), [shift] 
"c"(shift)
+    );
+
+    return retval;
+}
+
+__INTRIN_INLINE long long __ll_rshift(long long Mask, int Bit)
+{
+    long long retval;
+    unsigned char shift = Bit & 0x3F;
+
+    __asm__
+    (
+        "sarq %[shift], %[Mask]" : "=r"(retval) : [Mask] "0"(Mask), [shift] 
"c"(shift)
+    );
+
+    return retval;
+}
+
+__INTRIN_INLINE unsigned long long __ull_rshift(unsigned long long Mask, int 
Bit)
+{
+    long long retval;
+    unsigned char shift = Bit & 0x3F;
+
+    __asm__
+    (
+        "shrq %[shift], %[Mask]" : "=r"(retval) : [Mask] "0"(Mask), [shift] 
"c"(shift)
+    );
+
+    return retval;
+}
+#else
 /*
        NOTE: in __ll_lshift, __ll_rshift and __ull_rshift we use the "A"
        constraint (edx:eax) for the Mask argument, because it's the only way 
GCC
@@ -1346,6 +1386,7 @@ __INTRIN_INLINE unsigned long long __ull_rshift(unsigned 
long long Mask, int Bit
 
        return retval;
 }
+#endif
 
 __INTRIN_INLINE unsigned short __cdecl _byteswap_ushort(unsigned short value)
 {

Reply via email to