Skip to content
Snippets Groups Projects
Commit c0ca0a82 authored by Alberto Nidasio's avatar Alberto Nidasio Committed by Federico
Browse files

When compiling `ll2timespec` function with clang, we fallback to the non-optimized implementation


The problem is that Clang does not support assigning specific registers to variables.
This commit is a quick fix to solve this problem while adding support for Clang

Signed-off-by: default avatarTerraneo Federico <fede.tft@miosix.org>
parent 7159999e
Branches
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ inline long long timespec2ll(const struct timespec *tp)
*/
inline void ll2timespec(long long ns, struct timespec *tp)
{
#ifdef __ARM_EABI__
#if defined(__ARM_EABI__) && defined(__GNUC__) && !defined(__clang__)
// Despite there being a single intrinsic, __aeabi_ldivmod, that computes
// both the result of the / and % operator, GCC 9.2.0 isn't smart enough and
// calls the intrinsic twice. This asm implementation takes ~188 cycles
......@@ -91,11 +91,11 @@ inline void ll2timespec(long long ns, struct timespec *tp)
asm volatile("bl __aeabi_ldivmod" : "+r"(a), "+r"(b) :: "lr");
tp->tv_sec = a;
tp->tv_nsec = static_cast<long>(b);
#else //__ARM_EABI__
#else
#warning Warning POSIX time API not optimized for this platform
tp->tv_sec = ns / nsPerSec;
tp->tv_nsec = static_cast<long>(ns % nsPerSec);
#endif //__ARM_EABI__
#endif
}
} //namespace miosix
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment