mirror of
https://github.com/boostorg/atomic.git
synced 2026-02-02 08:22:08 +00:00
Added specialized negate_and_test and complement_and_test for MSVC 32-bit x86 target.
This commit is contained in:
@@ -136,6 +136,27 @@ struct extra_operations< Base, 1u, Signed > :
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool negate_and_test(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
bool result;
|
||||
__asm
|
||||
{
|
||||
mov ecx, storage
|
||||
movzx eax, byte ptr [ecx]
|
||||
align 16
|
||||
again:
|
||||
mov edx, eax
|
||||
neg dl
|
||||
lock cmpxchg byte ptr [ecx], dl
|
||||
jne again
|
||||
test dl, dl
|
||||
setnz result
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void opaque_negate(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
@@ -173,6 +194,27 @@ struct extra_operations< Base, 1u, Signed > :
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool complement_and_test(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
bool result;
|
||||
__asm
|
||||
{
|
||||
mov ecx, storage
|
||||
movzx eax, byte ptr [ecx]
|
||||
align 16
|
||||
again:
|
||||
mov edx, eax
|
||||
not dl
|
||||
lock cmpxchg byte ptr [ecx], dl
|
||||
jne again
|
||||
test dl, dl
|
||||
setnz result
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void opaque_complement(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
@@ -377,6 +419,27 @@ struct extra_operations< Base, 2u, Signed > :
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool negate_and_test(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
bool result;
|
||||
__asm
|
||||
{
|
||||
mov ecx, storage
|
||||
movzx eax, word ptr [ecx]
|
||||
align 16
|
||||
again:
|
||||
mov edx, eax
|
||||
neg dx
|
||||
lock cmpxchg word ptr [ecx], dx
|
||||
jne again
|
||||
test dx, dx
|
||||
setnz result
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void opaque_negate(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
@@ -414,6 +477,27 @@ struct extra_operations< Base, 2u, Signed > :
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool complement_and_test(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
bool result;
|
||||
__asm
|
||||
{
|
||||
mov ecx, storage
|
||||
movzx eax, word ptr [ecx]
|
||||
align 16
|
||||
again:
|
||||
mov edx, eax
|
||||
not dx
|
||||
lock cmpxchg word ptr [ecx], dx
|
||||
jne again
|
||||
test dx, dx
|
||||
setnz result
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void opaque_complement(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
@@ -618,6 +702,27 @@ struct extra_operations< Base, 4u, Signed > :
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool negate_and_test(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
bool result;
|
||||
__asm
|
||||
{
|
||||
mov ecx, storage
|
||||
mov eax, dword ptr [ecx]
|
||||
align 16
|
||||
again:
|
||||
mov edx, eax
|
||||
neg edx
|
||||
lock cmpxchg dword ptr [ecx], edx
|
||||
jne again
|
||||
test edx, edx
|
||||
setnz result
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void opaque_negate(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
@@ -655,6 +760,27 @@ struct extra_operations< Base, 4u, Signed > :
|
||||
return old_val;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE bool complement_and_test(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
bool result;
|
||||
__asm
|
||||
{
|
||||
mov ecx, storage
|
||||
mov eax, dword ptr [ecx]
|
||||
align 16
|
||||
again:
|
||||
mov edx, eax
|
||||
not edx
|
||||
lock cmpxchg dword ptr [ecx], edx
|
||||
jne again
|
||||
test edx, edx
|
||||
setnz result
|
||||
};
|
||||
base_type::fence_after(order);
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE void opaque_complement(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
|
||||
{
|
||||
base_type::fence_before(order);
|
||||
|
||||
Reference in New Issue
Block a user