aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarat Dukhan <maratek@google.com>2020-05-07 15:57:07 -0700
committerMarat Dukhan <maratek@google.com>2020-05-07 15:57:07 -0700
commitada4eedd7113b82e7d1ab35394b78eaf03a60906 (patch)
treee09bf16e229a94aa1a52da5d854df6228b01aeb6 /src
parent6525d8bb736b323eb4df9e4f3afdd3a8458d1a20 (diff)
downloadpthreadpool-ada4eedd7113b82e7d1ab35394b78eaf03a60906.tar.gz
Thumb-1 compatible assembly for disable_fpu_denormals
Diffstat (limited to 'src')
-rw-r--r--src/threadpool-utils.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/threadpool-utils.h b/src/threadpool-utils.h
index 24fee43..5443c6e 100644
--- a/src/threadpool-utils.h
+++ b/src/threadpool-utils.h
@@ -55,12 +55,21 @@ static inline void disable_fpu_denormals() {
#if defined(__SSE__) || defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1)
_mm_setcsr(_mm_getcsr() | 0x8040);
#elif defined(__arm__) && defined(__ARM_FP) && (__ARM_FP != 0)
- uint32_t fpscr;
- __asm__ __volatile__(
- "VMRS %[fpscr], fpscr\n"
- "ORR %[fpscr], #0x1000000\n"
- "VMSR fpscr, %[fpscr]\n"
- : [fpscr] "=r" (fpscr));
+ #if defined(__thumb__) && !defined(__thumb2__)
+ __asm__ __volatile__(
+ "VMRS %[fpscr], fpscr\n"
+ "ORRS %[fpscr], %[bitmask]\n"
+ "VMSR fpscr, %[fpscr]\n"
+ : [fpscr] "=l" (fpscr)
+ : [bitmask] "l" (0x1000000)
+ : "cc");
+ #else
+ __asm__ __volatile__(
+ "VMRS %[fpscr], fpscr\n"
+ "ORR %[fpscr], #0x1000000\n"
+ "VMSR fpscr, %[fpscr]\n"
+ : [fpscr] "=r" (fpscr));
+ #endif
#elif defined(__aarch64__)
uint64_t fpcr;
__asm__ __volatile__(