Skip to content

Commit b20a6ea

Browse files
Prevent reordering of some floating point op under fast-math
1 parent ffaec96 commit b20a6ea

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
@@ -1722,8 +1722,8 @@ namespace xsimd {
17221722
// to v. That's not what we want, so prevent compiler optimization here.
17231723
// FIXME: it may be better to emit a memory barrier here (?).
17241724
#ifdef __FAST_MATH__
1725-
volatile batch_type d0 = v + t2n;
1726-
batch_type d = *(batch_type*)(void*)(&d0) - t2n;
1725+
volatile auto d0 = (v + t2n).data;
1726+
batch_type d = batch_type(d0) - t2n;
17271727
#else
17281728
batch_type d0 = v + t2n;
17291729
batch_type d = d0 - t2n;

0 commit comments

Comments
 (0)