mirror of
https://github.com/boostorg/atomic.git
synced 2026-02-02 08:22:08 +00:00
Simplified asm constraints to avoid comma-separated alternatives.
Alternatives are not supported by all compilers, and for the purpose we're using them we can use constraint-local alternatives (i.e. "qm" instead of "q,m"). Additionally, this reduces duplication of other constraints in the asm block.
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(__CUDACC__)
|
||||
// nvcc does not support alternatives in asm statement constraints
|
||||
// nvcc does not support alternatives ("q,m") in asm statement constraints
|
||||
#define BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES
|
||||
// nvcc does not support condition code register ("cc") clobber in asm statements
|
||||
#define BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC
|
||||
|
||||
@@ -250,13 +250,8 @@ struct gcc_dcas_x86
|
||||
(
|
||||
"lock; cmpxchg8b %[dest]\n\t"
|
||||
"sete %[success]\n\t"
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: "+A,A" (expected), [dest] "+m,m" (storage), [success] "=q,m" (success)
|
||||
: "b,b" ((uint32_t)desired), "c,c" ((uint32_t)(desired >> 32))
|
||||
#else
|
||||
: "+A" (expected), [dest] "+m" (storage), [success] "=q" (success)
|
||||
: "+A" (expected), [dest] "+m" (storage), [success] "=qm" (success)
|
||||
: "b" ((uint32_t)desired), "c" ((uint32_t)(desired >> 32))
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
#endif // defined(BOOST_ATOMIC_DETAIL_ASM_HAS_FLAG_OUTPUTS)
|
||||
@@ -476,13 +471,8 @@ struct gcc_dcas_x86_64
|
||||
(
|
||||
"lock; cmpxchg16b %[dest]\n\t"
|
||||
"sete %[success]\n\t"
|
||||
#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES)
|
||||
: "+A,A" (expected), [dest] "+m,m" (storage), [success] "=q,m" (success)
|
||||
: "b,b" (reinterpret_cast< const aliasing_uint64_t* >(&desired)[0]), "c,c" (reinterpret_cast< const aliasing_uint64_t* >(&desired)[1])
|
||||
#else
|
||||
: "+A" (expected), [dest] "+m" (storage), [success] "=q" (success)
|
||||
: "+A" (expected), [dest] "+m" (storage), [success] "=qm" (success)
|
||||
: "b" (reinterpret_cast< const aliasing_uint64_t* >(&desired)[0]), "c" (reinterpret_cast< const aliasing_uint64_t* >(&desired)[1])
|
||||
#endif
|
||||
: BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
|
||||
);
|
||||
#endif // defined(BOOST_ATOMIC_DETAIL_ASM_HAS_FLAG_OUTPUTS)
|
||||
|
||||
Reference in New Issue
Block a user