Shadowrun: Awakened 29 September 2011 - Build 871
Defines | Functions
mac_ppc.h File Reference
#include <stdint.h>
#include <unistd.h>
#include <sched.h>
Include dependency graph for Third Party Tech/TBB/tbb30_20100406oss_win/tbb30_20100406oss/include/tbb/machine/mac_ppc.h:

Go to the source code of this file.

Defines

#define __TBB_BIG_ENDIAN   1
#define __TBB_CompareAndSwap4(P, V, C)   __TBB_machine_cmpswp4(P,V,C)
#define __TBB_CompareAndSwap8(P, V, C)   __TBB_machine_cmpswp8(P,V,C)
#define __TBB_CompareAndSwapW(P, V, C)   __TBB_machine_cmpswp4(P,V,C)
#define __TBB_rel_acq_fence()   __asm__ __volatile__("lwsync": : :"memory")
#define __TBB_release_consistency_helper()   __TBB_rel_acq_fence()
#define __TBB_WORDSIZE   4
#define __TBB_Yield()   sched_yield()

Functions

int32_t __TBB_machine_cmpswp4 (volatile void *ptr, int32_t value, int32_t comparand)
int64_t __TBB_machine_cmpswp8 (volatile void *ptr, int64_t value, int64_t comparand)

Define Documentation

#define __TBB_BIG_ENDIAN   1
#define __TBB_CompareAndSwap4 (   P,
  V,
 
)    __TBB_machine_cmpswp4(P,V,C)
#define __TBB_CompareAndSwap8 (   P,
  V,
 
)    __TBB_machine_cmpswp8(P,V,C)
#define __TBB_CompareAndSwapW (   P,
  V,
 
)    __TBB_machine_cmpswp4(P,V,C)
#define __TBB_rel_acq_fence ( )    __asm__ __volatile__("lwsync": : :"memory")
#define __TBB_release_consistency_helper ( )    __TBB_rel_acq_fence()
#define __TBB_WORDSIZE   4
#define __TBB_Yield ( )    sched_yield()

Function Documentation

int32_t __TBB_machine_cmpswp4 ( volatile void *  ptr,
int32_t  value,
int32_t  comparand 
) [inline]

Definition at line 38 of file Third Party Tech/TBB/tbb30_20100406oss_win/tbb30_20100406oss/include/tbb/machine/mac_ppc.h.

{
    int32_t result;

    __asm__ __volatile__("sync\n"
                         "0: lwarx %0,0,%2\n\t"  /* load w/ reservation */
                         "cmpw %0,%4\n\t"        /* compare against comparand */
                         "bne- 1f\n\t"           /* exit if not same */
                         "stwcx. %3,0,%2\n\t"    /* store new_value */
                         "bne- 0b\n"             /* retry if reservation lost */
                         "1: sync"               /* the exit */
                          : "=&r"(result), "=m"(* (int32_t*) ptr)
                          : "r"(ptr), "r"(value), "r"(comparand), "m"(* (int32_t*) ptr)
                          : "cr0");
    return result;
}
int64_t __TBB_machine_cmpswp8 ( volatile void *  ptr,
int64_t  value,
int64_t  comparand 
) [inline]

Definition at line 55 of file Third Party Tech/TBB/tbb30_20100406oss_win/tbb30_20100406oss/include/tbb/machine/mac_ppc.h.

{
    int64_t result;
    __asm__ __volatile__("sync\n"
                         "0: ldarx %0,0,%2\n\t"  /* load w/ reservation */
                         "cmpd %0,%4\n\t"        /* compare against comparand */
                         "bne- 1f\n\t"           /* exit if not same */
                         "stdcx. %3,0,%2\n\t"    /* store new_value */
                         "bne- 0b\n"             /* retry if reservation lost */
                         "1: sync"               /* the exit */
                          : "=&b"(result), "=m"(* (int64_t*) ptr)
                          : "r"(ptr), "r"(value), "r"(comparand), "m"(* (int64_t*) ptr)
                          : "cr0");
    return result;
}

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net