include/SDL_atomic.h
changeset 8979 1e283b7a1580
parent 8149 681eb46b8ac4
child 9278 8900afb78a19
     1.1 --- a/include/SDL_atomic.h	Mon Jul 07 10:33:32 2014 -0700
     1.2 +++ b/include/SDL_atomic.h	Sat Jul 05 16:11:23 2014 -0700
     1.3 @@ -122,7 +122,8 @@
     1.4  void _ReadWriteBarrier(void);
     1.5  #pragma intrinsic(_ReadWriteBarrier)
     1.6  #define SDL_CompilerBarrier()   _ReadWriteBarrier()
     1.7 -#elif defined(__GNUC__)
     1.8 +#elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
     1.9 +/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
    1.10  #define SDL_CompilerBarrier()   __asm__ __volatile__ ("" : : : "memory")
    1.11  #else
    1.12  #define SDL_CompilerBarrier()   \
    1.13 @@ -169,10 +170,17 @@
    1.14  #define SDL_MemoryBarrierAcquire()   __asm__ __volatile__ ("" : : : "memory")
    1.15  #endif /* __GNUC__ && __arm__ */
    1.16  #else
    1.17 +#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
    1.18 +/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
    1.19 +#include <mbarrier.h>
    1.20 +#define SDL_MemoryBarrierRelease()  __machine_rel_barrier()
    1.21 +#define SDL_MemoryBarrierAcquire()  __machine_acq_barrier()
    1.22 +#else
    1.23  /* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
    1.24  #define SDL_MemoryBarrierRelease()  SDL_CompilerBarrier()
    1.25  #define SDL_MemoryBarrierAcquire()  SDL_CompilerBarrier()
    1.26  #endif
    1.27 +#endif
    1.28  
    1.29  /**
    1.30   * \brief A type representing an atomic integer value.  It is a struct