23 #if !defined(__TBB_machine_H) || defined(__TBB_machine_xbox360_ppc_H) 24 #error Do not #include this internal file directly; use public TBB headers instead. 27 #define __TBB_machine_xbox360_ppc_H 32 #include "ppcintrinsics.h" 35 extern "C" void _MemoryBarrier();
36 #pragma intrinsic(_MemoryBarrier) 37 #define __TBB_control_consistency_helper() __isync() 38 #define __TBB_acquire_consistency_helper() _MemoryBarrier() 39 #define __TBB_release_consistency_helper() _MemoryBarrier() 42 #define __TBB_full_memory_fence() __sync() 44 #define __TBB_WORDSIZE 4 45 #define __TBB_ENDIANNESS __TBB_ENDIAN_BIG 49 inline __int32 __TBB_machine_cmpswp4(
volatile void *ptr, __int32 value, __int32 comparand ) {
51 __int32 result = InterlockedCompareExchange((
volatile LONG*)ptr, value, comparand);
56 inline __int64 __TBB_machine_cmpswp8(
volatile void *ptr, __int64 value, __int64 comparand )
59 __int64 result = InterlockedCompareExchange64((
volatile LONG64*)ptr, value, comparand);
64 #define __TBB_USE_GENERIC_PART_WORD_CAS 1 65 #define __TBB_USE_GENERIC_FETCH_ADD 1 66 #define __TBB_USE_GENERIC_FETCH_STORE 1 67 #define __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE 1 68 #define __TBB_USE_GENERIC_RELAXED_LOAD_STORE 1 69 #define __TBB_USE_GENERIC_DWORD_LOAD_STORE 1 70 #define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE 1 72 #pragma optimize( "", off ) 73 inline void __TBB_machine_pause (__int32 delay )
75 for (__int32 i=0; i<delay; i++) {;};
77 #pragma optimize( "", on ) 79 #define __TBB_Yield() Sleep(0) 80 #define __TBB_Pause(V) __TBB_machine_pause(V) 85 static const int __TBB_XBOX360_HARDWARE_THREAD_MASK = 0x0C;
87 static inline int __TBB_XBOX360_DetectNumberOfWorkers()
89 char a[__TBB_XBOX360_HARDWARE_THREAD_MASK];
92 return ((__TBB_XBOX360_HARDWARE_THREAD_MASK >> 0) & 1) +
93 ((__TBB_XBOX360_HARDWARE_THREAD_MASK >> 1) & 1) +
94 ((__TBB_XBOX360_HARDWARE_THREAD_MASK >> 2) & 1) +
95 ((__TBB_XBOX360_HARDWARE_THREAD_MASK >> 3) & 1) +
96 ((__TBB_XBOX360_HARDWARE_THREAD_MASK >> 4) & 1) +
97 ((__TBB_XBOX360_HARDWARE_THREAD_MASK >> 5) & 1) + 1;
100 static inline int __TBB_XBOX360_GetHardwareThreadIndex(
int workerThreadIndex)
102 workerThreadIndex %= __TBB_XBOX360_DetectNumberOfWorkers()-1;
103 int m = __TBB_XBOX360_HARDWARE_THREAD_MASK;
105 int skipcount = workerThreadIndex;
110 if (skipcount==0)
break;
119 #define __TBB_HardwareConcurrency() __TBB_XBOX360_DetectNumberOfWorkers()