From 76d29a732a58d7d4b71e820740cef199b0624b33 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Thu, 20 Feb 2014 19:28:27 +0000 Subject: [PATCH] [CRT] - Force the use of memory operands in bit test intrinsics. Bit offsets above 31 (or 63) can't behave correctly with registers (the constant case is fine because it ensures low offsets). Thanks to Timo Kreuzer and Alex Radocea. svn path=/trunk/; revision=62266 --- reactos/include/crt/mingw32/intrin_x86.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/include/crt/mingw32/intrin_x86.h b/reactos/include/crt/mingw32/intrin_x86.h index 00ef94d79d4..d129b1ac700 100644 --- a/reactos/include/crt/mingw32/intrin_x86.h +++ b/reactos/include/crt/mingw32/intrin_x86.h @@ -1032,7 +1032,7 @@ __INTRIN_INLINE unsigned char _bittest(const long * const a, const long b) if(__builtin_constant_p(b)) __asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*(a + (b / 32))), [b] "Ir" (b % 32)); else - __asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*a), [b] "r" (b)); + __asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "m" (*a), [b] "r" (b)); return retval; } @@ -1045,7 +1045,7 @@ __INTRIN_INLINE unsigned char _bittest64(const __int64 * const a, const __int64 if(__builtin_constant_p(b)) __asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*(a + (b / 64))), [b] "Ir" (b % 64)); else - __asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*a), [b] "r" (b)); + __asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "m" (*a), [b] "r" (b)); return retval; } @@ -1058,7 +1058,7 @@ __INTRIN_INLINE unsigned char _bittestandcomplement(long * const a, const long b if(__builtin_constant_p(b)) __asm__("btc %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 32))), [retval] "=q" (retval) : [b] "Ir" (b % 32)); else - __asm__("btc %[b], %[a]; setb %b[retval]" : [a] "+mr" (*a), [retval] "=q" (retval) : [b] "r" (b)); + __asm__("btc %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b)); return retval; } @@ -1070,7 +1070,7 @@ __INTRIN_INLINE unsigned char _bittestandreset(long * const a, const long b) if(__builtin_constant_p(b)) __asm__("btr %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 32))), [retval] "=q" (retval) : [b] "Ir" (b % 32)); else - __asm__("btr %[b], %[a]; setb %b[retval]" : [a] "+mr" (*a), [retval] "=q" (retval) : [b] "r" (b)); + __asm__("btr %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b)); return retval; } @@ -1082,7 +1082,7 @@ __INTRIN_INLINE unsigned char _bittestandset(long * const a, const long b) if(__builtin_constant_p(b)) __asm__("bts %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 32))), [retval] "=q" (retval) : [b] "Ir" (b % 32)); else - __asm__("bts %[b], %[a]; setb %b[retval]" : [a] "+mr" (*a), [retval] "=q" (retval) : [b] "r" (b)); + __asm__("bts %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b)); return retval; } -- 2.17.1