Shadowrun: Awakened 29 September 2011 - Build 871
linux_ia64.h
Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2010 Intel Corporation.  All Rights Reserved.
00003 
00004     This file is part of Threading Building Blocks.
00005 
00006     Threading Building Blocks is free software; you can redistribute it
00007     and/or modify it under the terms of the GNU General Public License
00008     version 2 as published by the Free Software Foundation.
00009 
00010     Threading Building Blocks is distributed in the hope that it will be
00011     useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00012     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with Threading Building Blocks; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019     As a special exception, you may use this file as part of a free software
00020     library without restriction.  Specifically, if other files instantiate
00021     templates or use macros or inline functions from this file, or you compile
00022     this file and link it with other files to produce an executable, this
00023     file does not by itself cause the resulting executable to be covered by
00024     the GNU General Public License.  This exception does not however
00025     invalidate any other reasons why the executable file might be covered by
00026     the GNU General Public License.
00027 */
00028 
00029 #ifndef __TBB_machine_H
00030 #error Do not include this file directly; include tbb_machine.h instead
00031 #endif
00032 
00033 #include "linux_common.h"
00034 #include <ia64intrin.h>
00035 
00036 #define __TBB_WORDSIZE 8
00037 #define __TBB_BIG_ENDIAN 0
00038 #define __TBB_DECL_FENCED_ATOMICS 1
00039 
00040 // Most of the functions will be in a .s file
00041 
00042 extern "C" {
00043     int8_t __TBB_machine_cmpswp1__TBB_full_fence (volatile void *ptr, int8_t value, int8_t comparand); 
00044     int8_t __TBB_machine_fetchadd1__TBB_full_fence (volatile void *ptr, int8_t addend);
00045     int8_t __TBB_machine_fetchadd1acquire(volatile void *ptr, int8_t addend);
00046     int8_t __TBB_machine_fetchadd1release(volatile void *ptr, int8_t addend);
00047     int8_t __TBB_machine_fetchstore1acquire(volatile void *ptr, int8_t value);
00048     int8_t __TBB_machine_fetchstore1release(volatile void *ptr, int8_t value);
00049 
00050     int16_t __TBB_machine_cmpswp2__TBB_full_fence (volatile void *ptr, int16_t value, int16_t comparand);
00051     int16_t __TBB_machine_fetchadd2__TBB_full_fence (volatile void *ptr, int16_t addend);
00052     int16_t __TBB_machine_fetchadd2acquire(volatile void *ptr, int16_t addend);
00053     int16_t __TBB_machine_fetchadd2release(volatile void *ptr, int16_t addend);
00054     int16_t __TBB_machine_fetchstore2acquire(volatile void *ptr, int16_t value);
00055     int16_t __TBB_machine_fetchstore2release(volatile void *ptr, int16_t value);
00056 
00057     int32_t __TBB_machine_fetchstore4__TBB_full_fence (volatile void *ptr, int32_t value);
00058     int32_t __TBB_machine_fetchstore4acquire(volatile void *ptr, int32_t value);
00059     int32_t __TBB_machine_fetchstore4release(volatile void *ptr, int32_t value);
00060     int32_t __TBB_machine_fetchadd4acquire(volatile void *ptr, int32_t addend);
00061     int32_t __TBB_machine_fetchadd4release(volatile void *ptr, int32_t addend);
00062 
00063     int64_t __TBB_machine_cmpswp8__TBB_full_fence (volatile void *ptr, int64_t value, int64_t comparand);
00064     int64_t __TBB_machine_fetchstore8__TBB_full_fence (volatile void *ptr, int64_t value);
00065     int64_t __TBB_machine_fetchstore8acquire(volatile void *ptr, int64_t value);
00066     int64_t __TBB_machine_fetchstore8release(volatile void *ptr, int64_t value);
00067     int64_t __TBB_machine_fetchadd8acquire(volatile void *ptr, int64_t addend);
00068     int64_t __TBB_machine_fetchadd8release(volatile void *ptr, int64_t addend);
00069 
00070     int8_t __TBB_machine_cmpswp1acquire(volatile void *ptr, int8_t value, int8_t comparand); 
00071     int8_t __TBB_machine_cmpswp1release(volatile void *ptr, int8_t value, int8_t comparand); 
00072     int8_t __TBB_machine_fetchstore1__TBB_full_fence (volatile void *ptr, int8_t value);
00073 
00074     int16_t __TBB_machine_cmpswp2acquire(volatile void *ptr, int16_t value, int16_t comparand); 
00075     int16_t __TBB_machine_cmpswp2release(volatile void *ptr, int16_t value, int16_t comparand); 
00076     int16_t __TBB_machine_fetchstore2__TBB_full_fence (volatile void *ptr, int16_t value);
00077 
00078     int32_t __TBB_machine_cmpswp4__TBB_full_fence (volatile void *ptr, int32_t value, int32_t comparand);
00079     int32_t __TBB_machine_cmpswp4acquire(volatile void *ptr, int32_t value, int32_t comparand); 
00080     int32_t __TBB_machine_cmpswp4release(volatile void *ptr, int32_t value, int32_t comparand); 
00081     int32_t __TBB_machine_fetchadd4__TBB_full_fence (volatile void *ptr, int32_t value);
00082 
00083     int64_t __TBB_machine_cmpswp8acquire(volatile void *ptr, int64_t value, int64_t comparand); 
00084     int64_t __TBB_machine_cmpswp8release(volatile void *ptr, int64_t value, int64_t comparand); 
00085     int64_t __TBB_machine_fetchadd8__TBB_full_fence (volatile void *ptr, int64_t value);
00086 
00087     int64_t __TBB_machine_lg(uint64_t value);
00088     void __TBB_machine_pause(int32_t delay);
00089     bool __TBB_machine_trylockbyte( volatile unsigned char &ptr );
00090     int64_t __TBB_machine_lockbyte( volatile unsigned char &ptr );
00091 
00093     void* __TBB_get_bsp();
00094 }
00095 
00096 #define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1__TBB_full_fence(P,V,C)
00097 #define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2__TBB_full_fence(P,V,C) 
00098 
00099 #define __TBB_FetchAndAdd1(P,V)        __TBB_machine_fetchadd1__TBB_full_fence(P,V)
00100 #define __TBB_FetchAndAdd1acquire(P,V) __TBB_machine_fetchadd1acquire(P,V)
00101 #define __TBB_FetchAndAdd1release(P,V) __TBB_machine_fetchadd1release(P,V)
00102 #define __TBB_FetchAndAdd2(P,V)        __TBB_machine_fetchadd2__TBB_full_fence(P,V)
00103 #define __TBB_FetchAndAdd2acquire(P,V) __TBB_machine_fetchadd2acquire(P,V)
00104 #define __TBB_FetchAndAdd2release(P,V) __TBB_machine_fetchadd2release(P,V)
00105 #define __TBB_FetchAndAdd4acquire(P,V) __TBB_machine_fetchadd4acquire(P,V)
00106 #define __TBB_FetchAndAdd4release(P,V) __TBB_machine_fetchadd4release(P,V)
00107 #define __TBB_FetchAndAdd8acquire(P,V) __TBB_machine_fetchadd8acquire(P,V)
00108 #define __TBB_FetchAndAdd8release(P,V) __TBB_machine_fetchadd8release(P,V)
00109 
00110 #define __TBB_FetchAndStore1acquire(P,V) __TBB_machine_fetchstore1acquire(P,V)
00111 #define __TBB_FetchAndStore1release(P,V) __TBB_machine_fetchstore1release(P,V)
00112 #define __TBB_FetchAndStore2acquire(P,V) __TBB_machine_fetchstore2acquire(P,V)
00113 #define __TBB_FetchAndStore2release(P,V) __TBB_machine_fetchstore2release(P,V)
00114 #define __TBB_FetchAndStore4acquire(P,V) __TBB_machine_fetchstore4acquire(P,V)
00115 #define __TBB_FetchAndStore4release(P,V) __TBB_machine_fetchstore4release(P,V)
00116 #define __TBB_FetchAndStore8acquire(P,V) __TBB_machine_fetchstore8acquire(P,V)
00117 #define __TBB_FetchAndStore8release(P,V) __TBB_machine_fetchstore8release(P,V)
00118 
00119 #define __TBB_CompareAndSwap1acquire(P,V,C) __TBB_machine_cmpswp1acquire(P,V,C)
00120 #define __TBB_CompareAndSwap1release(P,V,C) __TBB_machine_cmpswp1release(P,V,C)
00121 #define __TBB_CompareAndSwap2acquire(P,V,C) __TBB_machine_cmpswp2acquire(P,V,C)
00122 #define __TBB_CompareAndSwap2release(P,V,C) __TBB_machine_cmpswp2release(P,V,C)
00123 #define __TBB_CompareAndSwap4(P,V,C)        __TBB_machine_cmpswp4__TBB_full_fence(P,V,C)
00124 #define __TBB_CompareAndSwap4acquire(P,V,C) __TBB_machine_cmpswp4acquire(P,V,C)
00125 #define __TBB_CompareAndSwap4release(P,V,C) __TBB_machine_cmpswp4release(P,V,C)
00126 #define __TBB_CompareAndSwap8(P,V,C)        __TBB_machine_cmpswp8__TBB_full_fence(P,V,C)
00127 #define __TBB_CompareAndSwap8acquire(P,V,C) __TBB_machine_cmpswp8acquire(P,V,C)
00128 #define __TBB_CompareAndSwap8release(P,V,C) __TBB_machine_cmpswp8release(P,V,C)
00129 
00130 #define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4__TBB_full_fence(P,V)
00131 #define __TBB_FetchAndAdd8(P,V) __TBB_machine_fetchadd8__TBB_full_fence(P,V)
00132 
00133 #define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1__TBB_full_fence(P,V)
00134 #define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2__TBB_full_fence(P,V)
00135 #define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4__TBB_full_fence(P,V)
00136 #define __TBB_FetchAndStore8(P,V) __TBB_machine_fetchstore8__TBB_full_fence(P,V)
00137 
00138 #define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAdd8acquire(P,1)
00139 #define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAdd8release(P,-1)
00140 
00141 #ifndef __INTEL_COMPILER
00142 /* Even though GCC imbues volatile loads with acquire semantics, 
00143    it sometimes moves loads over the acquire fence.  The
00144    fences defined here stop such incorrect code motion. */
00145 #define __TBB_release_consistency_helper() __asm__ __volatile__("": : :"memory")
00146 #define __TBB_rel_acq_fence() __asm__ __volatile__("mf": : :"memory")
00147 #else
00148 #define __TBB_release_consistency_helper()
00149 #define __TBB_rel_acq_fence() __mf()
00150 #endif /* __INTEL_COMPILER */
00151 
00152 // Special atomic functions
00153 #define __TBB_CompareAndSwapW(P,V,C)   __TBB_CompareAndSwap8(P,V,C)
00154 #define __TBB_FetchAndStoreW(P,V)      __TBB_FetchAndStore8(P,V)
00155 #define __TBB_FetchAndAddW(P,V)        __TBB_FetchAndAdd8(P,V)
00156 #define __TBB_FetchAndAddWrelease(P,V) __TBB_FetchAndAdd8release(P,V)
00157 
00158 // Not needed
00159 #undef __TBB_Store8
00160 #undef __TBB_Load8
00161 
00162 // Definition of Lock functions
00163 #define __TBB_TryLockByte(P) __TBB_machine_trylockbyte(P)
00164 #define __TBB_LockByte(P)    __TBB_machine_lockbyte(P)
00165 
00166 // Definition of other utility functions
00167 #define __TBB_Pause(V) __TBB_machine_pause(V)
00168 #define __TBB_Log2(V)  __TBB_machine_lg(V)
00169 

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