23 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 |
* |
* |
26 |
* $Id: portab.h,v 1.44 2003-02-16 01:41:24 edgomez Exp $ |
* $Id: portab.h,v 1.45 2003-02-16 05:11:39 suxen_drol Exp $ |
27 |
* |
* |
28 |
****************************************************************************/ |
****************************************************************************/ |
29 |
|
|
139 |
} |
} |
140 |
} |
} |
141 |
# else |
# else |
142 |
static __inline void DPRINTF(int level, char *fmt, ...) |
static __inline void DPRINTF(int level, char *fmt, ...) {} |
|
{ |
|
|
} |
|
143 |
# endif |
# endif |
144 |
|
|
145 |
# if _MSC_VER <= 1200 |
# if _MSC_VER <= 1200 |
158 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) |
159 |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
160 |
|
|
|
# ifdef _PROFILING_ |
|
161 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
162 |
{ |
{ |
163 |
int64_t ts; |
int64_t ts; |
170 |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
171 |
return ts; |
return ts; |
172 |
} |
} |
|
# endif |
|
173 |
|
|
174 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
175 |
| msvc GENERIC (plain C only) - Probably alpha or some embedded device |
| msvc GENERIC (plain C only) - Probably alpha or some embedded device |
179 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
180 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
181 |
|
|
|
# ifdef _PROFILING_ |
|
182 |
# include <time.h> |
# include <time.h> |
183 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
184 |
{ |
{ |
185 |
return (int64_t)clock(); |
return (int64_t)clock(); |
186 |
} |
} |
|
# endif |
|
187 |
|
|
188 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
189 |
| msvc Not given architecture - This is probably an user who tries to build |
| msvc Not given architecture - This is probably an user who tries to build |
241 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) |
242 |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
243 |
|
|
|
# ifdef _PROFILING_ |
|
244 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
245 |
{ |
{ |
246 |
int64_t ts; |
int64_t ts; |
249 |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
250 |
return ts; |
return ts; |
251 |
} |
} |
|
# endif |
|
252 |
|
|
253 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
254 |
| gcc PPC and PPC Altivec specific macros/functions |
| gcc PPC and PPC Altivec specific macros/functions |
257 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
258 |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
259 |
|
|
|
# ifdef _PROFILING_ |
|
260 |
static __inline unsigned long get_tbl(void) |
static __inline unsigned long get_tbl(void) |
261 |
{ |
{ |
262 |
unsigned long tbl; |
unsigned long tbl; |
280 |
}while (tb != get_tbl()); |
}while (tb != get_tbl()); |
281 |
return (((int64_t) tu) << 32) | (int64_t) tb; |
return (((int64_t) tu) << 32) | (int64_t) tb; |
282 |
} |
} |
|
# endif |
|
283 |
|
|
284 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
285 |
| gcc IA64 specific macros/functions |
| gcc IA64 specific macros/functions |
289 |
("mux1 %1 = %0, @rev" ";;" \ |
("mux1 %1 = %0, @rev" ";;" \ |
290 |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
291 |
|
|
|
# ifdef _PROFILING_ |
|
292 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
293 |
{ |
{ |
294 |
unsigned long result; |
unsigned long result; |
295 |
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); |
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); |
296 |
return result; |
return result; |
297 |
} |
} |
|
# endif |
|
298 |
|
|
299 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
300 |
| gcc GENERIC (plain C only) specific macros/functions |
| gcc GENERIC (plain C only) specific macros/functions |
304 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
305 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
306 |
|
|
|
# ifdef _PROFILING_ |
|
307 |
# include <time.h> |
# include <time.h> |
308 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
309 |
{ |
{ |
310 |
return (int64_t)clock(); |
return (int64_t)clock(); |
311 |
} |
} |
|
# endif |
|
312 |
|
|
313 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
314 |
| gcc Not given architecture - This is probably an user who tries to build |
| gcc Not given architecture - This is probably an user who tries to build |
356 |
|
|
357 |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
358 |
|
|
|
# ifdef _PROFILING_ |
|
359 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
360 |
{ |
{ |
361 |
uint64_t ts; |
uint64_t ts; |
368 |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
369 |
return ts; |
return ts; |
370 |
} |
} |
|
# endif |
|
371 |
|
|
372 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
373 |
| watcom GENERIC (plain C only) specific macros/functions. |
| watcom GENERIC (plain C only) specific macros/functions. |
380 |
(((x) & 0x0000ff00) << 8) | \ |
(((x) & 0x0000ff00) << 8) | \ |
381 |
(((x) & 0x000000ff) << 24)) |
(((x) & 0x000000ff) << 24)) |
382 |
|
|
|
# ifdef _PROFILING_ |
|
383 |
static int64_t read_counter() { return 0; } |
static int64_t read_counter() { return 0; } |
|
# endif |
|
384 |
|
|
385 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
386 |
| watcom Not given architecture - This is probably an user who tries to build |
| watcom Not given architecture - This is probably an user who tries to build |
427 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
428 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
429 |
|
|
|
# ifdef _PROFILING_ |
|
430 |
# include <time.h> |
# include <time.h> |
431 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
432 |
{ |
{ |
433 |
return (int64_t)clock(); |
return (int64_t)clock(); |
434 |
} |
} |
|
# endif |
|
435 |
|
|
436 |
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
437 |
type name[(sizex)*(sizey)] |
type name[(sizex)*(sizey)] |