Re: [eigen] Fix for ARM __builtin_prefetch fails |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
On 18.11.2013 23:54, Rick Mann wrote:
It seems that the GCC preprocessor chokes because it attempts to evaluate the entire expression.
You may want to #define HAS_BUILTIN_PREFETCH or something as a separate step, but you can't combine the __has_builtin with the defined(__GNUC__).
Ok, so the issue is that __has_builtin(__builtin_prefetch)
is syntactically incorrect if __has_builtin is not defined. That means
your patch resolves the issue only for GCC and the fix is to separate
the && expression into two preprocessor lines.
Maybe something like this:
#ifdef __has_builtin
# if __has_builtin(__builtin_prefectch)
# define EIGEN_ARM_PREFETCH(ADDR) __builtin_prefetch(ADDR)
# endif
#endif
#ifndef EIGEN_ARM_PREFETCH
# ifdef __GNUC__
# define EIGEN_ARM_PREFETCH(ADDR) __builtin_prefetch(ADDR);
# elif defined __pld
# define EIGEN_ARM_PREFETCH(ADDR) __pld(ADDR)
# elif !defined(__aarch64__)
# define EIGEN_ARM_PREFETCH(ADDR) asm volatile ( " pld [%[addr]]\n"
:: [addr] "r" (ADDR) : "cc" );
# else
// by default no explicit prefetching
# define EIGEN_ARM_PREFETCH(ADDR)
# endif
#endif
Are there ARM compilers known, which are neither LLVM nor GCC and have
the __builtin_prefetch defined?
Christoph
--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen
Tel: +49 (421) 218-64252
----------------------------------------------