|
|
|
@ -55,17 +55,17 @@ namespace nv {
|
|
|
|
|
nvDebugCheck((intptr_t(ptr) & 3) == 0);
|
|
|
|
|
|
|
|
|
|
#if POSH_CPU_X86 || POSH_CPU_X86_64
|
|
|
|
|
uint32 ret = *ptr; // on x86, loads are Acquire
|
|
|
|
|
uint32 ret = *ptr; // on x86, loads are Acquire
|
|
|
|
|
nvCompilerReadBarrier();
|
|
|
|
|
return ret;
|
|
|
|
|
#elif POSH_CPU_STRONGARM || POSH_CPU_AARCH64
|
|
|
|
|
// need more specific cpu type for armv7?
|
|
|
|
|
// also utilizes a full barrier
|
|
|
|
|
// currently treating laod like x86 - this could be wrong
|
|
|
|
|
// currently treating load like x86 - this could be wrong
|
|
|
|
|
|
|
|
|
|
// this is the easiest but slowest way to do this
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
uint32 ret = *ptr; // replace with ldrex?
|
|
|
|
|
uint32 ret = *ptr; // replace with ldrex?
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
return ret;
|
|
|
|
|
#elif POSH_CPU_PPC64
|
|
|
|
@ -75,7 +75,17 @@ namespace nv {
|
|
|
|
|
|
|
|
|
|
// this is the easiest but slowest way to do this
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
uint32 ret = *ptr; // replace with ldrex?
|
|
|
|
|
uint32 ret = *ptr; // replace with ldrex?
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
return ret;
|
|
|
|
|
#elif POSH_CPU_E2K
|
|
|
|
|
// need more specific cpu type for e2k?
|
|
|
|
|
// also utilizes a full barrier
|
|
|
|
|
// currently treating load like x86 - this could be wrong
|
|
|
|
|
|
|
|
|
|
// this is the easiest but slowest way to do this
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
uint32 ret = *ptr; // replace with ldrex?
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
return ret;
|
|
|
|
|
#else
|
|
|
|
@ -90,18 +100,23 @@ namespace nv {
|
|
|
|
|
|
|
|
|
|
#if POSH_CPU_X86 || POSH_CPU_X86_64
|
|
|
|
|
nvCompilerWriteBarrier();
|
|
|
|
|
*ptr = value; // on x86, stores are Release
|
|
|
|
|
*ptr = value; // on x86, stores are Release
|
|
|
|
|
//nvCompilerWriteBarrier(); // @@ IC: Where does this barrier go? In nvtt it was after, in Witness before. Not sure which one is right.
|
|
|
|
|
#elif POSH_CPU_STRONGARM || POSH_CPU_AARCH64
|
|
|
|
|
// this is the easiest but slowest way to do this
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
*ptr = value; //strex?
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
*ptr = value; //strex?
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
#elif POSH_CPU_PPC64
|
|
|
|
|
// this is the easiest but slowest way to do this
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
*ptr = value; //strex?
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
*ptr = value; //strex?
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
#elif POSH_CPU_E2K
|
|
|
|
|
// this is the easiest but slowest way to do this
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
*ptr = value; //strex?
|
|
|
|
|
nvCompilerReadWriteBarrier();
|
|
|
|
|
#else
|
|
|
|
|
#error "Atomics not implemented."
|
|
|
|
|
#endif
|
|
|
|
@ -120,7 +135,7 @@ namespace nv {
|
|
|
|
|
nvDebugCheck((((intptr_t)pTo) % sizeof(intptr_t)) == 0);
|
|
|
|
|
nvDebugCheck((((intptr_t)&from) % sizeof(intptr_t)) == 0);
|
|
|
|
|
nvCompilerWriteBarrier();
|
|
|
|
|
*pTo = from; // on x86, stores are Release
|
|
|
|
|
*pTo = from; // on x86, stores are Release
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
@ -128,7 +143,7 @@ namespace nv {
|
|
|
|
|
{
|
|
|
|
|
NV_COMPILER_CHECK(sizeof(T) == sizeof(intptr_t));
|
|
|
|
|
nvDebugCheck((((intptr_t)ptr) % sizeof(intptr_t)) == 0);
|
|
|
|
|
T ret = *ptr; // on x86, loads are Acquire
|
|
|
|
|
T ret = *ptr; // on x86, loads are Acquire
|
|
|
|
|
nvCompilerReadBarrier();
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|