Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
mac_ppc.h File Reference
#include <stdint.h>
#include <unistd.h>
Include dependency graph for mac_ppc.h:

Go to the source code of this file.

Namespaces

 tbb
 The graph class.
 
 tbb::internal
 Identifiers declared inside namespace internal should never be used directly by client code.
 

Macros

#define __TBB_WORDSIZE   4
 
#define __TBB_ENDIANNESS   __TBB_ENDIAN_DETECT
 
#define __TBB_64BIT_ATOMICS   0
 
#define __TBB_MACHINE_DEFINE_LOAD_STORE(S, ldx, stx, cmpx)
 
#define __TBB_USE_GENERIC_PART_WORD_CAS   1
 
#define __TBB_USE_GENERIC_FETCH_ADD   1
 
#define __TBB_USE_GENERIC_FETCH_STORE   1
 
#define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE   1
 
#define __TBB_control_consistency_helper()   __asm__ __volatile__("isync": : :"memory")
 
#define __TBB_full_memory_fence()   __asm__ __volatile__( "sync": : :"memory")
 
#define __TBB_Log2(V)   __TBB_machine_lg(V)
 
#define __TBB_Flag   __TBB_Flag
 
#define __TBB_TryLockByte(P)   __TBB_machine_trylockbyte(P)
 

Typedefs

typedef uint32_t __TBB_Flag
 

Functions

int32_t __TBB_machine_cmpswp4 (volatile void *ptr, int32_t value, int32_t comparand)
 
static intptr_t __TBB_machine_lg (uintptr_t x)
 
bool __TBB_machine_trylockbyte (__TBB_atomic __TBB_Flag &flag)
 

Macro Definition Documentation

◆ __TBB_64BIT_ATOMICS

#define __TBB_64BIT_ATOMICS   0

Definition at line 69 of file mac_ppc.h.

◆ __TBB_control_consistency_helper

#define __TBB_control_consistency_helper ( )    __asm__ __volatile__("isync": : :"memory")

Definition at line 286 of file mac_ppc.h.

◆ __TBB_ENDIANNESS

#define __TBB_ENDIANNESS   __TBB_ENDIAN_DETECT

Definition at line 49 of file mac_ppc.h.

◆ __TBB_Flag

#define __TBB_Flag   __TBB_Flag

Definition at line 304 of file mac_ppc.h.

◆ __TBB_full_memory_fence

#define __TBB_full_memory_fence ( )    __asm__ __volatile__( "sync": : :"memory")

Definition at line 287 of file mac_ppc.h.

◆ __TBB_Log2

#define __TBB_Log2 (   V)    __TBB_machine_lg(V)

Definition at line 300 of file mac_ppc.h.

◆ __TBB_MACHINE_DEFINE_LOAD_STORE

#define __TBB_MACHINE_DEFINE_LOAD_STORE (   S,
  ldx,
  stx,
  cmpx 
)

Definition at line 156 of file mac_ppc.h.

◆ __TBB_TryLockByte

#define __TBB_TryLockByte (   P)    __TBB_machine_trylockbyte(P)

Definition at line 309 of file mac_ppc.h.

◆ __TBB_USE_GENERIC_FETCH_ADD

#define __TBB_USE_GENERIC_FETCH_ADD   1

Definition at line 282 of file mac_ppc.h.

◆ __TBB_USE_GENERIC_FETCH_STORE

#define __TBB_USE_GENERIC_FETCH_STORE   1

Definition at line 283 of file mac_ppc.h.

◆ __TBB_USE_GENERIC_PART_WORD_CAS

#define __TBB_USE_GENERIC_PART_WORD_CAS   1

Definition at line 281 of file mac_ppc.h.

◆ __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE

#define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE   1

Definition at line 284 of file mac_ppc.h.

◆ __TBB_WORDSIZE

#define __TBB_WORDSIZE   4

Definition at line 35 of file mac_ppc.h.

Typedef Documentation

◆ __TBB_Flag

typedef uint32_t __TBB_Flag

Definition at line 303 of file mac_ppc.h.

Function Documentation

◆ __TBB_machine_cmpswp4()

int32_t __TBB_machine_cmpswp4 ( volatile void ptr,
int32_t  value,
int32_t  comparand 
)
inline

Definition at line 73 of file mac_ppc.h.

74 {
75  int32_t result;
76 
77  __asm__ __volatile__("sync\n"
78  "0:\n\t"
79  "lwarx %[res],0,%[ptr]\n\t" /* load w/ reservation */
80  "cmpw %[res],%[cmp]\n\t" /* compare against comparand */
81  "bne- 1f\n\t" /* exit if not same */
82  "stwcx. %[val],0,%[ptr]\n\t" /* store new value */
83  "bne- 0b\n" /* retry if reservation lost */
84  "1:\n\t" /* the exit */
85  "isync"
86  : [res]"=&r"(result)
87  , "+m"(* (int32_t*) ptr) /* redundant with "memory" */
88  : [ptr]"r"(ptr)
89  , [val]"r"(value)
90  , [cmp]"r"(comparand)
91  : "memory" /* compiler full fence */
92  , "cr0" /* clobbered by cmp and/or stwcx. */
93  );
94  return result;
95 }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value

References value.

Referenced by __TBB_machine_trylockbyte().

Here is the caller graph for this function:

◆ __TBB_machine_lg()

static intptr_t __TBB_machine_lg ( uintptr_t  x)
inlinestatic

Definition at line 289 of file mac_ppc.h.

289  {
290  __TBB_ASSERT(x, "__TBB_Log2(0) undefined");
291  // cntlzd/cntlzw starts counting at 2^63/2^31 (ignoring any higher-order bits), and does not affect cr0
292 #if __TBB_WORDSIZE==8
293  __asm__ __volatile__ ("cntlzd %0,%0" : "+r"(x));
294  return 63-static_cast<intptr_t>(x);
295 #else
296  __asm__ __volatile__ ("cntlzw %0,%0" : "+r"(x));
297  return 31-static_cast<intptr_t>(x);
298 #endif
299 }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

References __TBB_ASSERT.

◆ __TBB_machine_trylockbyte()

bool __TBB_machine_trylockbyte ( __TBB_atomic __TBB_Flag flag)
inline

Definition at line 306 of file mac_ppc.h.

306  {
307  return __TBB_machine_cmpswp4(&flag,1,0)==0;
308 }
int32_t __TBB_machine_cmpswp4(volatile void *ptr, int32_t value, int32_t comparand)
Definition: mac_ppc.h:73

References __TBB_machine_cmpswp4().

Here is the call graph for this function:

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.