|
11 | 11 | */ |
12 | 12 | #ifndef @P@_CPU_DISPATCHER_CONF_H_ |
13 | 13 | #define @P@_CPU_DISPATCHER_CONF_H_ |
14 | | -/// This definition is required to provide compatibility with NumPy distutils |
15 | | -#define @P@_CPU_MESON_BUILD |
16 | 14 | /** |
17 | 15 | * @def @P@WITH_CPU_BASELINE |
18 | 16 | * Enabled baseline features names as a single string where each is separated by a single space. |
|
79 | 77 | * Defines the default behavior for the configurable macros derived from the configuration header |
80 | 78 | * that is generated by the meson function `mod_features.multi_targets()`. |
81 | 79 | * |
82 | | - * Note: Providing fallback in case of optimization disabled is no longer needed for meson |
83 | | - * since we always guarantee having configuration headers. |
84 | | - * |
85 | | - * However, it is still needed for compatibility with Numpy distutils. |
| 80 | + * These macros are replaced by disapatch config headers once its included. |
86 | 81 | */ |
87 | | -#ifndef @P@DISABLE_OPTIMIZATION |
88 | | - #define @P@MTARGETS_CONF_BASELINE(CB, ...) \ |
89 | | - &&"Expected config header that generated by mod_features.multi_targets()"; |
90 | | - #define @P@MTARGETS_CONF_DISPATCH(TEST_FEATURE_CB, CB, ...) \ |
91 | | - &&"Expected config header that generated by mod_features.multi_targets()"; |
92 | | -#else |
93 | | - #define @P@MTARGETS_CONF_BASELINE(CB, ...) @P@_CPU_EXPAND(CB(__VA_ARGS__)) |
94 | | - #define @P@MTARGETS_CONF_DISPATCH(CHK, CB, ...) |
95 | | -#endif |
| 82 | +#define @P@MTARGETS_CONF_BASELINE(CB, ...) \ |
| 83 | + &&"Expected config header that generated by mod_features.multi_targets()"; |
| 84 | +#define @P@MTARGETS_CONF_DISPATCH(TEST_FEATURE_CB, CB, ...) \ |
| 85 | + &&"Expected config header that generated by mod_features.multi_targets()"; |
96 | 86 | /** |
97 | 87 | * @def @P@CPU_DISPATCH_CURFX(NAME) |
98 | 88 | * |
|
374 | 364 | #include <x86intrin.h> |
375 | 365 | #endif |
376 | 366 |
|
| 367 | +#if (defined(@P@HAVE_VSX) || defined(@P@HAVE_VX)) && !defined(__cplusplus) && defined(bool) |
| 368 | + /* |
| 369 | + * "altivec.h" header contains the definitions(bool, vector, pixel), |
| 370 | + * usually in c++ we undefine them after including the header. |
| 371 | + * It's better anyway to take them off and use built-in types(__vector, __pixel, __bool) instead, |
| 372 | + * since c99 supports bool variables which may lead to ambiguous errors. |
| 373 | + */ |
| 374 | + // backup 'bool' before including 'npy_cpu_dispatch_config.h', since it may not defined as a compiler token. |
| 375 | + #define NPY__CPU_DISPATCH_GUARD_BOOL |
| 376 | + typedef bool npy__cpu_dispatch_guard_bool; |
| 377 | +#endif |
377 | 378 | #ifdef @P@HAVE_VSX |
378 | 379 | #include <altivec.h> |
379 | 380 | #endif |
380 | | - |
381 | 381 | #ifdef @P@HAVE_VX |
382 | 382 | #include <vecintrin.h> |
383 | 383 | #endif |
| 384 | +#if (defined(@P@HAVE_VSX) || defined(@P@HAVE_VX)) |
| 385 | + #undef bool |
| 386 | + #undef vector |
| 387 | + #undef pixel |
| 388 | + #ifdef NPY__CPU_DISPATCH_GUARD_BOOL |
| 389 | + #define bool npy__cpu_dispatch_guard_bool |
| 390 | + #undef NPY__CPU_DISPATCH_GUARD_BOOL |
| 391 | + #endif |
| 392 | +#endif |
| 393 | + |
384 | 394 |
|
385 | 395 | #ifdef @P@HAVE_NEON |
386 | 396 | #include <arm_neon.h> |
|
0 commit comments