Skip to content

Commit 66e950d

Browse files
Prevent reordering of some floating point op under fast-math
1 parent f212f3c commit 66e950d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/xsimd/arch/generic/xsimd_generic_math.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,8 +1733,8 @@ namespace xsimd {
17331733
// to v. That's not what we want, so prevent compiler optimization here.
17341734
// FIXME: it may be better to emit a memory barrier here (?).
17351735
#ifdef __FAST_MATH__
1736-
volatile batch_type d0 = v + t2n;
1737-
batch_type d = *(batch_type*)(void*)(&d0) - t2n;
1736+
volatile auto d0 = (v + t2n).data;
1737+
batch_type d = batch_type(d0) - t2n;
17381738
#else
17391739
batch_type d0 = v + t2n;
17401740
batch_type d = d0 - t2n;

0 commit comments

Comments
 (0)