equal
deleted
inserted
replaced
21 # define INLINE_KEYWORD inline |
21 # define INLINE_KEYWORD inline |
22 #else |
22 #else |
23 # define INLINE_KEYWORD |
23 # define INLINE_KEYWORD |
24 #endif |
24 #endif |
25 |
25 |
26 #if defined(__GNUC__) |
26 #if defined(__GNUC__) || defined(__ICCARM__) |
27 # define FORCE_INLINE_ATTR __attribute__((always_inline)) |
27 # define FORCE_INLINE_ATTR __attribute__((always_inline)) |
28 #elif defined(_MSC_VER) |
28 #elif defined(_MSC_VER) |
29 # define FORCE_INLINE_ATTR __forceinline |
29 # define FORCE_INLINE_ATTR __forceinline |
30 #else |
30 #else |
31 # define FORCE_INLINE_ATTR |
31 # define FORCE_INLINE_ATTR |
38 |
38 |
39 #endif |
39 #endif |
40 |
40 |
41 /** |
41 /** |
42 * FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant |
42 * FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant |
43 * parameters. They must be inlined for the compiler to elimininate the constant |
43 * parameters. They must be inlined for the compiler to eliminate the constant |
44 * branches. |
44 * branches. |
45 */ |
45 */ |
46 #define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR |
46 #define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR |
47 /** |
47 /** |
48 * HINT_INLINE is used to help the compiler generate better code. It is *not* |
48 * HINT_INLINE is used to help the compiler generate better code. It is *not* |
63 |
63 |
64 /* force no inlining */ |
64 /* force no inlining */ |
65 #ifdef _MSC_VER |
65 #ifdef _MSC_VER |
66 # define FORCE_NOINLINE static __declspec(noinline) |
66 # define FORCE_NOINLINE static __declspec(noinline) |
67 #else |
67 #else |
68 # ifdef __GNUC__ |
68 # if defined(__GNUC__) || defined(__ICCARM__) |
69 # define FORCE_NOINLINE static __attribute__((__noinline__)) |
69 # define FORCE_NOINLINE static __attribute__((__noinline__)) |
70 # else |
70 # else |
71 # define FORCE_NOINLINE static |
71 # define FORCE_NOINLINE static |
72 # endif |
72 # endif |
73 #endif |
73 #endif |
74 |
74 |
75 /* target attribute */ |
75 /* target attribute */ |
76 #ifndef __has_attribute |
76 #ifndef __has_attribute |
77 #define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ |
77 #define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ |
78 #endif |
78 #endif |
79 #if defined(__GNUC__) |
79 #if defined(__GNUC__) || defined(__ICCARM__) |
80 # define TARGET_ATTRIBUTE(target) __attribute__((__target__(target))) |
80 # define TARGET_ATTRIBUTE(target) __attribute__((__target__(target))) |
81 #else |
81 #else |
82 # define TARGET_ATTRIBUTE(target) |
82 # define TARGET_ATTRIBUTE(target) |
83 #endif |
83 #endif |
84 |
84 |
125 for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \ |
125 for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \ |
126 PREFETCH_L2(_ptr + _pos); \ |
126 PREFETCH_L2(_ptr + _pos); \ |
127 } \ |
127 } \ |
128 } |
128 } |
129 |
129 |
|
130 /* vectorization */ |
|
131 #if !defined(__clang__) && defined(__GNUC__) |
|
132 # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) |
|
133 #else |
|
134 # define DONT_VECTORIZE |
|
135 #endif |
|
136 |
130 /* disable warnings */ |
137 /* disable warnings */ |
131 #ifdef _MSC_VER /* Visual Studio */ |
138 #ifdef _MSC_VER /* Visual Studio */ |
132 # include <intrin.h> /* For Visual 2005 */ |
139 # include <intrin.h> /* For Visual 2005 */ |
133 # pragma warning(disable : 4100) /* disable: C4100: unreferenced formal parameter */ |
140 # pragma warning(disable : 4100) /* disable: C4100: unreferenced formal parameter */ |
134 # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ |
141 # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ |