sunos_sparc.h File Reference
`#include <stdint.h>`
`#include <unistd.h>`
Include dependency graph for sunos_sparc.h:

Go to the source code of this file.

## Macros

#define | __TBB_WORDSIZE 8
#define | __TBB_ENDIANNESS __TBB_ENDIAN_BIG
#define | __TBB_compiler_fence() __asm__ __volatile__ ("": : :"memory")
#define | __TBB_control_consistency_helper() __TBB_compiler_fence()
#define | __TBB_acquire_consistency_helper() __TBB_compiler_fence()
#define | __TBB_release_consistency_helper() __TBB_compiler_fence()
#define | __TBB_full_memory_fence() __asm__ __volatile__("membar #LoadLoad|#LoadStore|#StoreStore|#StoreLoad": : : "memory")
#define | __TBB_USE_GENERIC_PART_WORD_CAS 1
#define | __TBB_USE_GENERIC_PART_WORD_FETCH_ADD 1
#define | __TBB_USE_GENERIC_FETCH_STORE 1
#define | __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE 1
#define | __TBB_USE_GENERIC_RELAXED_LOAD_STORE 1
#define | __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE 1
#define | __TBB_AtomicOR(P, V) __TBB_machine_or(P,V)
#define | __TBB_AtomicAND(P, V) __TBB_machine_and(P,V)
#define | __TBB_Pause(V) __TBB_machine_pause(V)
#define | __TBB_Log2(V) __TBB_machine_lg(V)
#define | __TBB_TryLockByte(P) __TBB_machine_trylockbyte(P)

## Functions

static int32_t | __TBB_machine_cmpswp4 (volatile void *ptr, int32_t value, int32_t comparand)
static int64_t | __TBB_machine_cmpswp8 (volatile void *ptr, int64_t value, int64_t comparand)
static int32_t | __TBB_machine_fetchadd4 (volatile void *ptr, int32_t addend)
static int64_t | __TBB_machine_fetchadd8 (volatile void *ptr, int64_t addend)
static int64_t | __TBB_machine_lg (uint64_t x)
static void | __TBB_machine_or (volatile void *ptr, uint64_t value)
static void | __TBB_machine_and (volatile void *ptr, uint64_t value)
static void | __TBB_machine_pause (int32_t delay)
static bool | __TBB_machine_trylockbyte (unsigned char &flag)

## Macro Definition Documentation

## __TBB_acquire_consistency_helper

#define __TBB_acquire_consistency_helper | ( |  | ) | __TBB_compiler_fence()

Definition at line 36 of file sunos_sparc.h.

## __TBB_AtomicAND

#define __TBB_AtomicAND | ( |  | P,
|  |  | V
| ) |  | __TBB_machine_and(P,V)

Definition at line 193 of file sunos_sparc.h.

## __TBB_AtomicOR

#define __TBB_AtomicOR | ( |  | P,
|  |  | V
| ) |  | __TBB_machine_or(P,V)

Definition at line 192 of file sunos_sparc.h.

## __TBB_compiler_fence

#define __TBB_compiler_fence | ( |  | ) | __asm__ __volatile__ ("": : :"memory")

To those working on SPARC hardware. Consider relaxing acquire and release consistency helpers to no-op (as this port covers TSO mode only).

Definition at line 34 of file sunos_sparc.h.

## __TBB_control_consistency_helper

#define __TBB_control_consistency_helper | ( |  | ) | __TBB_compiler_fence()

Definition at line 35 of file sunos_sparc.h.

## __TBB_ENDIANNESS

#define __TBB_ENDIANNESS __TBB_ENDIAN_BIG

Definition at line 30 of file sunos_sparc.h.

## __TBB_full_memory_fence

#define __TBB_full_memory_fence | ( |  | ) | __asm__ __volatile__("membar #LoadLoad|#LoadStore|#StoreStore|#StoreLoad": : : "memory")

Definition at line 38 of file sunos_sparc.h.

## __TBB_Log2

#define __TBB_Log2 | ( |  | V | ) | __TBB_machine_lg(V)

Definition at line 197 of file sunos_sparc.h.

## __TBB_Pause

#define __TBB_Pause | ( |  | V | ) | __TBB_machine_pause(V)

Definition at line 196 of file sunos_sparc.h.

## __TBB_release_consistency_helper

#define __TBB_release_consistency_helper | ( |  | ) | __TBB_compiler_fence()

Definition at line 37 of file sunos_sparc.h.

## __TBB_TryLockByte

#define __TBB_TryLockByte | ( |  | P | ) | __TBB_machine_trylockbyte(P)

Definition at line 199 of file sunos_sparc.h.

## __TBB_USE_GENERIC_FETCH_STORE

#define __TBB_USE_GENERIC_FETCH_STORE 1

Definition at line 187 of file sunos_sparc.h.

## __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE

#define __TBB_USE_GENERIC_HALF_FENCED_LOAD_STORE 1

Definition at line 188 of file sunos_sparc.h.

## __TBB_USE_GENERIC_PART_WORD_CAS

#define __TBB_USE_GENERIC_PART_WORD_CAS 1

Definition at line 185 of file sunos_sparc.h.

## __TBB_USE_GENERIC_PART_WORD_FETCH_ADD

#define __TBB_USE_GENERIC_PART_WORD_FETCH_ADD 1

Definition at line 186 of file sunos_sparc.h.

## __TBB_USE_GENERIC_RELAXED_LOAD_STORE

#define __TBB_USE_GENERIC_RELAXED_LOAD_STORE 1

Definition at line 189 of file sunos_sparc.h.

## __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE

#define __TBB_USE_GENERIC_SEQUENTIAL_CONSISTENCY_LOAD_STORE 1

Definition at line 190 of file sunos_sparc.h.

## __TBB_WORDSIZE

#define __TBB_WORDSIZE 8

Definition at line 27 of file sunos_sparc.h.

## Function Documentation

## __TBB_machine_and()

static void __TBB_machine_and | ( | volatile void * | ptr,
|  | uint64_t | value
| ) |  |

inline static

Definition at line 155 of file sunos_sparc.h.

{
__asm__ __volatile__ (
"0:\t and\t %2, %3, %%g1\n" // do operation
"\t casx\t [%1], %2, %%g1\n" // cas to store result in memory
"\t cmp\t %2, %%g1\n" // check if value from memory is original
"\t bne,a,pn\t %%xcc, 0b\n" // if not try again
"\t mov %%g1, %2\n" // use branch delay slot to move new value in memory to be added
: "=m"(*(int64_t *)ptr)
: "r"(ptr), "r"(*(int64_t *)ptr), "r"(value), "m"(*(int64_t *)ptr)
: "ccr", "g1", "memory");
}

References value.

## __TBB_machine_cmpswp4()

static int32_t __TBB_machine_cmpswp4 | ( | volatile void * | ptr,
|  | int32_t | value,
|  | int32_t | comparand
| ) |  |

inline static

Atomic CAS for 32 bit values, if *ptr==comparand, then *ptr=value, returns *ptr

Parameters

  ptr | pointer to value in memory to be swapped with value if *ptr==comparand
  value | value to assign *ptr to if *ptr==comparand
  comparand | value to compare with *ptr (

Returns
  value originally in memory at ptr, regardless of success

Definition at line 51 of file sunos_sparc.h.

{
int32_t result;
__asm__ __volatile__(
"cas\t[%5],%4,%1"
: "=m"(*(int32_t *)ptr), "=r"(result)
: "m"(*(int32_t *)ptr), "1"(value), "r"(comparand), "r"(ptr)
: "memory");
return result;
}

References value.

## __TBB_machine_cmpswp8()

static int64_t __TBB_machine_cmpswp8 | ( | volatile void * | ptr,
|  | int64_t | value,
|  | int64_t | comparand
| ) |  |

inline static

Atomic CAS for 64 bit values, if *ptr==comparand, then *ptr=value, returns *ptr

Parameters

  ptr | pointer to value in memory to be swapped with value if *ptr==comparand
  value | value to assign *ptr to if *ptr==comparand
  comparand | value to compare with *ptr (

Returns
  value originally in memory at ptr, regardless of success

Definition at line 68 of file sunos_sparc.h.

{
int64_t result;
__asm__ __volatile__(
"casx\t[%5],%4,%1"
: "=m"(*(int64_t *)ptr), "=r"(result)
: "m"(*(int64_t *)ptr), "1"(value), "r"(comparand), "r"(ptr)
: "memory");
return result;
}

References value.

## __TBB_machine_fetchadd4()

static int32_t __TBB_machine_fetchadd4 | ( | volatile void * | ptr,
|  | int32_t | addend
| ) |  |

inline static

Atomic fetch and add for 32 bit values, in this case implemented by continuously checking success of atomicity

Parameters

  ptr | pointer to value to add addend to
  addened | value to add to *ptr

Returns
  value at ptr before addened was added

Definition at line 88 of file sunos_sparc.h.

{
int32_t result;
__asm__ __volatile__ (
"0:\t add\t %3, %4, %0\n" // do addition
"\t cas\t [%2], %3, %0\n" // cas to store result in memory
"\t cmp\t %3, %0\n" // check if value from memory is original
"\t bne,a,pn\t %%icc, 0b\n" // if not try again
"\t mov %0, %3\n" // use branch delay slot to move new value in memory to be added
: "=&r"(result), "=m"(*(int32_t *)ptr)
: "r"(ptr), "r"(*(int32_t *)ptr), "r"(addend), "m"(*(int32_t *)ptr)
: "ccr", "memory");
return result;
}

## __TBB_machine_fetchadd8()

static int64_t __TBB_machine_fetchadd8 | ( | volatile void * | ptr,
|  | int64_t | addend
| ) |  |

inline static

Atomic fetch and add for 64 bit values, in this case implemented by continuously checking success of atomicity

Parameters

  ptr | pointer to value to add addend to
  addened | value to add to *ptr

Returns
  value at ptr before addened was added

Definition at line 108 of file sunos_sparc.h.

{
int64_t result;
__asm__ __volatile__ (
"0:\t add\t %3, %4, %0\n" // do addition
"\t casx\t [%2], %3, %0\n" // cas to store result in memory
"\t cmp\t %3, %0\n" // check if value from memory is original
"\t bne,a,pn\t %%xcc, 0b\n" // if not try again
"\t mov %0, %3\n" // use branch delay slot to move new value in memory to be added
: "=&r"(result), "=m"(*(int64_t *)ptr)
: "r"(ptr), "r"(*(int64_t *)ptr), "r"(addend), "m"(*(int64_t *)ptr)
: "ccr", "memory");
return result;
}

## __TBB_machine_lg()

static int64_t __TBB_machine_lg | ( | uint64_t | x | ) |

inline static

Definition at line 126 of file sunos_sparc.h.

{
__TBB_ASSERT(x, "__TBB_Log2(0) undefined");
uint64_t count;
// one hot encode
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
x |= (x >> 32);
// count 1's
__asm__ ("popc %1, %0" : "=r"(count) : "r"(x) );
return count-1;
}

References __TBB_ASSERT, and count.

## __TBB_machine_or()

static void __TBB_machine_or | ( | volatile void * | ptr,
|  | uint64_t | value
| ) |  |

inline static

Definition at line 143 of file sunos_sparc.h.

{
__asm__ __volatile__ (
"0:\t or\t %2, %3, %%g1\n" // do operation
"\t casx\t [%1], %2, %%g1\n" // cas to store result in memory
"\t cmp\t %2, %%g1\n" // check if value from memory is original
"\t bne,a,pn\t %%xcc, 0b\n" // if not try again
"\t mov %%g1, %2\n" // use branch delay slot to move new value in memory to be added
: "=m"(*(int64_t *)ptr)
: "r"(ptr), "r"(*(int64_t *)ptr), "r"(value), "m"(*(int64_t *)ptr)
: "ccr", "g1", "memory");
}

References value.

## __TBB_machine_pause()

static void __TBB_machine_pause | ( | int32_t | delay | ) |

inline static

Definition at line 168 of file sunos_sparc.h.

{
// do nothing, inlined, doesn't matter
}

## __TBB_machine_trylockbyte()

static bool __TBB_machine_trylockbyte | ( | unsigned char & | flag | ) |

inline static

Definition at line 175 of file sunos_sparc.h.

{
unsigned char result;
__asm__ __volatile__ (
"ldstub\t [%2], %0\n"
: "=r"(result), "=m"(flag)
: "r"(&flag), "m"(flag)
: "memory");
return result == 0;
}
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
count
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 count
Definition: ittnotify_static.h:145
value
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
Definition: ittnotify_static.h:192

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.