Skip to content

Commit b49e9d2

Browse files
WIP
1 parent 3f70ba0 commit b49e9d2

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

.github/workflows/sanitizer.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ defaults:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12-
name: 'sanitizer - ${{ matrix.sanitizer }} ${{ matrix.fastmath }}'
12+
name: 'sanitizer - ${{ matrix.flags }}'
1313
strategy:
1414
matrix:
15-
sanitizer:
16-
- address
17-
- undefined
18-
fastmath:
19-
- "no-fast-math"
20-
- "fast-math"
15+
flags:
16+
- sanitize=address
17+
- sanitize=undefined
18+
- fast-math -fsanitize=undefined
2119
llvm-version: [20]
2220
env:
2321
CC: clang-${{ matrix.llvm-version }}
@@ -39,7 +37,7 @@ jobs:
3937
-DBUILD_EXAMPLES=ON \
4038
-DDOWNLOAD_DOCTEST=ON \
4139
-DCMAKE_BUILD_TYPE=Debug \
42-
-DCMAKE_CXX_FLAGS='-fsanitize=${{ matrix.sanitizer }} -f${{ matrix.fastmath }} -O0 -g -fno-inline' \
40+
-DCMAKE_CXX_FLAGS='-f${{ matrix.flags }} -O0 -g -fno-inline' \
4341
-G Ninja
4442
- name: Build
4543
run: ninja -C _build

include/xsimd/arch/xsimd_scalar.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,11 @@ namespace xsimd
510510
template <class T, class = typename std::enable_if<std::is_scalar<T>::value>::type>
511511
XSIMD_INLINE bool is_flint(const T& x) noexcept
512512
{
513+
#ifdef __FAST_MATH__
514+
return (x - std::trunc(x)) == T(0);
515+
#else
513516
return std::isnan(x - x) ? false : (x - std::trunc(x)) == T(0);
517+
#endif
514518
}
515519

516520
template <class T, class = typename std::enable_if<std::is_scalar<T>::value>::type>

test/test_batch_complex.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ struct batch_complex_test
628628
}
629629
}
630630

631+
#ifndef __FAST_MATH__
631632
void test_isnan() const
632633
{
633634
{
@@ -639,6 +640,7 @@ struct batch_complex_test
639640
CHECK_BATCH_EQ(res, expected);
640641
}
641642
}
643+
#endif
642644

643645
private:
644646
batch_type batch_lhs() const
@@ -689,6 +691,8 @@ TEST_CASE_TEMPLATE("[xsimd complex batches]", B, BATCH_COMPLEX_TYPES)
689691

690692
SUBCASE("boolean_conversion") { Test.test_boolean_conversion(); }
691693

694+
#ifndef __FAST_MATH__
692695
SUBCASE("isnan") { Test.test_isnan(); }
696+
#endif
693697
}
694698
#endif

test/test_xsimd_api.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include "xsimd/types/xsimd_utils.hpp"
1313
#include "xsimd/xsimd.hpp"
1414

15-
#include "doctest/doctest.h"
16-
1715
template <class T>
1816
struct scalar_type
1917
{
@@ -1203,7 +1201,7 @@ struct xsimd_api_all_types_functions
12031201
void test_div()
12041202
{
12051203
value_type val0(1);
1206-
value_type val1(3);
1204+
value_type val1(2);
12071205
CHECK_EQ(extract(xsimd::div(T(val0), T(val1))), val0 / val1);
12081206
}
12091207

0 commit comments

Comments
 (0)