Skip to content

Commit

Permalink
Prevent reordering of some floating point op under fast-math
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-sans-paille committed Oct 12, 2021
1 parent f212f3c commit 66e950d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/xsimd/arch/generic/xsimd_generic_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1733,8 +1733,8 @@ namespace xsimd {
// to v. That's not what we want, so prevent compiler optimization here.
// FIXME: it may be better to emit a memory barrier here (?).
#ifdef __FAST_MATH__
volatile batch_type d0 = v + t2n;
batch_type d = *(batch_type*)(void*)(&d0) - t2n;
volatile auto d0 = (v + t2n).data;
batch_type d = batch_type(d0) - t2n;
#else
batch_type d0 = v + t2n;
batch_type d = d0 - t2n;
Expand Down

0 comments on commit 66e950d

Please sign in to comment.