Merged,
Maxim.

On 05/19/16 14:48, Bill Fischofer wrote:
We shouldn't care about optimizing performance under obsolete versions of clang as long as we don't get compile/test failures under those old versions. So this check looks reasonable.

On Thu, May 19, 2016 at 2:20 AM, Maxim Uvarov <[email protected] <mailto:[email protected]>> wrote:

    Fix compilation error for clang:
    In function `_odp_atomic_u128_xchg_mm':
    undefined reference to `__atomic_exchange'
    Clang less than 3.6 has issue with defined _SIZEOF_INT128_ and
     __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16  but not supported
    __atomic_exchange().  This patch adds additional check for clang
    version.

    Signed-off-by: Maxim Uvarov <[email protected]
    <mailto:[email protected]>>


Reviewed-by: Bill Fischofer <[email protected] <mailto:[email protected]>>

    ---
     v2: add check for clang version

     platform/linux-generic/include/odp_atomic_internal.h | 13
    +++++++++++--
     1 file changed, 11 insertions(+), 2 deletions(-)

    diff --git a/platform/linux-generic/include/odp_atomic_internal.h
    b/platform/linux-generic/include/odp_atomic_internal.h
    index 3c5606c..67e8f82 100644
    --- a/platform/linux-generic/include/odp_atomic_internal.h
    +++ b/platform/linux-generic/include/odp_atomic_internal.h
    @@ -589,12 +589,21 @@ static inline void
    _odp_atomic_flag_clear(_odp_atomic_flag_t *flag)

     /* Check if target and compiler supports 128-bit scalars and
    corresponding
      * exchange and CAS operations */
    -/* GCC on x86-64 needs -mcx16 compiler option */
    +/* GCC/clang on x86-64 needs -mcx16 compiler option */
     #if defined __SIZEOF_INT128__ && defined
    __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16

    -/** Preprocessor symbol that indicates support for 128-bit atomics */
    +#if defined(__clang__)
    +
    +#if ((__clang_major__ * 100 +  __clang_minor__) >= 306)
    +#define ODP_ATOMIC_U128
    +#endif
    +
    +#else /* gcc */
     #define ODP_ATOMIC_U128
    +#endif
    +#endif

    +#ifdef ODP_ATOMIC_U128
     /** An unsigned 128-bit (16-byte) scalar type */
     typedef __int128 _uint128_t;

    --
    2.7.1.250.gff4ea60

    _______________________________________________
    lng-odp mailing list
    [email protected] <mailto:[email protected]>
    https://lists.linaro.org/mailman/listinfo/lng-odp



_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to