Skip to content

Commit 90da351

Browse files
Improve code generation for nearbyhint under -ffast-math
Fix #548
1 parent 1857e72 commit 90da351

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/xsimd/arch/common/xsimd_common_math.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,8 +1904,9 @@ namespace xsimd
19041904
// to v. That's not what we want, so prevent compiler optimization here.
19051905
// FIXME: it may be better to emit a memory barrier here (?).
19061906
#ifdef __FAST_MATH__
1907-
volatile batch_type d0 = v + t2n;
1908-
batch_type d = *(batch_type*)(void*)(&d0) - t2n;
1907+
batch_type d0 = v + t2n;
1908+
asm volatile("" ::"r"(&d0) : "memory");
1909+
batch_type d = d0 - t2n;
19091910
#else
19101911
batch_type d0 = v + t2n;
19111912
batch_type d = d0 - t2n;

0 commit comments

Comments
 (0)