From 87c16bb0938acbe7607569ce905d82a041c874d8 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 7 Jun 2021 08:59:23 -0400 Subject: [PATCH 1/7] Adding a build test for Windows ARM. --- .github/workflows/vs16-arm-ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/vs16-arm-ci.yml diff --git a/.github/workflows/vs16-arm-ci.yml b/.github/workflows/vs16-arm-ci.yml new file mode 100644 index 0000000..d7c7207 --- /dev/null +++ b/.github/workflows/vs16-arm-ci.yml @@ -0,0 +1,15 @@ +name: VS16-ARM-CI + +on: [push, pull_request] + +jobs: + ci: + name: windows-vs16 + runs-on: windows-latest + steps: + - name: checkout + uses: actions/checkout@v2 + - name: Use cmake + run: | + cmake -A ARM64 -DCMAKE_CROSSCOMPILING=1 -DFASTFLOAT_TEST=ON -B build && + cmake --build build --verbose \ No newline at end of file From 496fd4cf4978b7fae23ba4adfb13df3a54003abf Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 7 Jun 2021 09:08:01 -0400 Subject: [PATCH 2/7] Trying both ARM and ARM64 --- .github/workflows/vs16-arm-ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vs16-arm-ci.yml b/.github/workflows/vs16-arm-ci.yml index d7c7207..7c69e38 100644 --- a/.github/workflows/vs16-arm-ci.yml +++ b/.github/workflows/vs16-arm-ci.yml @@ -6,10 +6,16 @@ jobs: ci: name: windows-vs16 runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - {arch: ARM} + - {arch: ARM64} steps: - name: checkout uses: actions/checkout@v2 - name: Use cmake run: | - cmake -A ARM64 -DCMAKE_CROSSCOMPILING=1 -DFASTFLOAT_TEST=ON -B build && - cmake --build build --verbose \ No newline at end of file + cmake -A ${{ matrix.arch }} -DCMAKE_CROSSCOMPILING=1 -DFASTFLOAT_TEST=ON -B build && + cmake --build build --verbose \ No newline at end of file From f54b41c09ef28244473f11481a6ca97c6329a6cb Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 7 Jun 2021 09:14:09 -0400 Subject: [PATCH 3/7] Tweak for 32-bit Windows --- include/fast_float/float_common.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index 22b721d..d949b6d 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -129,23 +129,21 @@ fastfloat_really_inline int leading_zeroes(uint64_t input_num) { #ifdef FASTFLOAT_32BIT -#if (!defined(_WIN32)) || defined(__MINGW32__) // slow emulation routine for 32-bit -fastfloat_really_inline uint64_t __emulu(uint32_t x, uint32_t y) { +fastfloat_really_inline uint64_t emulu(uint32_t x, uint32_t y) { return x * (uint64_t)y; } -#endif // slow emulation routine for 32-bit #if !defined(__MINGW64__) fastfloat_really_inline uint64_t _umul128(uint64_t ab, uint64_t cd, uint64_t *hi) { - uint64_t ad = __emulu((uint32_t)(ab >> 32), (uint32_t)cd); - uint64_t bd = __emulu((uint32_t)ab, (uint32_t)cd); - uint64_t adbc = ad + __emulu((uint32_t)ab, (uint32_t)(cd >> 32)); + uint64_t ad = emulu((uint32_t)(ab >> 32), (uint32_t)cd); + uint64_t bd = emulu((uint32_t)ab, (uint32_t)cd); + uint64_t adbc = ad + emulu((uint32_t)ab, (uint32_t)(cd >> 32)); uint64_t adbc_carry = !!(adbc < ad); uint64_t lo = bd + (adbc << 32); - *hi = __emulu((uint32_t)(ab >> 32), (uint32_t)(cd >> 32)) + (adbc >> 32) + + *hi = emulu((uint32_t)(ab >> 32), (uint32_t)(cd >> 32)) + (adbc >> 32) + (adbc_carry << 32) + !!(lo < bd); return lo; } From 6921c8f26482140e99ab2c1ba1b78af1fff3b6f4 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 7 Jun 2021 09:32:39 -0400 Subject: [PATCH 4/7] Upgrading doctest. --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e370559..1e9e97e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,7 +6,7 @@ include(FetchContent) FetchContent_Declare(doctest GIT_REPOSITORY https://github.com/onqtam/doctest.git - GIT_TAG 2.4.1) + GIT_TAG 2.4.6) FetchContent_Declare(supplemental_test_files GIT_REPOSITORY https://github.com/fastfloat/supplemental_test_files.git GIT_TAG origin/main) From 1457b5f15a0ba845006098d03ccecec0fa0b6b6d Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 7 Jun 2021 09:38:15 -0400 Subject: [PATCH 5/7] Workaround for doctest. --- tests/basictest.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/basictest.cpp b/tests/basictest.cpp index 5608e21..13ba167 100644 --- a/tests/basictest.cpp +++ b/tests/basictest.cpp @@ -477,9 +477,13 @@ TEST_CASE("32bit.general") { verify(append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",655), 0x1.2ced3p+0f); verify(append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",656), 0x1.2ced3p+0f); verify(append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",1000), 0x1.2ced3p+0f); - verify(append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",655) + "e-38", 0x1.fffff8p-127f); - verify(append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",656) + "e-38", 0x1.fffff8p-127f); - verify(append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",1000) + "e-38", 0x1.fffff8p-127f); + std::string test_string; + test_string = append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",655) + std::string("e-38"); + verify(test_string, 0x1.fffff8p-127f); + test_string = append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",656) + std::string("e-38"); + verify(test_string, 0x1.fffff8p-127f); + test_string = append_zeros("1.1754941406275178592461758986628081843312458647327962400313859427181746759860647699724722770042717456817626953125",1000) + std::string("e-38"); + verify(test_string, 0x1.fffff8p-127f); verify32(1.00000006e+09f); verify32(1.4012984643e-45f); verify32(1.1754942107e-38f); From a721b344b425c83f2a1b857cfa35ee1ce47a9e2b Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 7 Jun 2021 09:43:36 -0400 Subject: [PATCH 6/7] Trying. --- tests/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1e9e97e..4cf99d9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -33,7 +33,9 @@ target_compile_definitions(supplemental-data INTERFACE SUPPLEMENTAL_TEST_DATA_DI function(fast_float_add_cpp_test TEST_NAME) add_executable(${TEST_NAME} ${TEST_NAME}.cpp) add_test(${TEST_NAME} ${TEST_NAME}) - if(NOT WIN32) + if(WIN32) + target_compile_options(${TEST_NAME} PUBLIC /EHsc) + else() target_compile_options(${TEST_NAME} PUBLIC -Werror -Wall -Wextra -Weffc++) target_compile_options(${TEST_NAME} PUBLIC -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wsign-conversion) endif() From 2504268bbf3156036d1e98671c1e0b57595712b2 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 7 Jun 2021 09:59:44 -0400 Subject: [PATCH 7/7] Being more narrow. --- tests/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4cf99d9..6b703e0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -33,9 +33,10 @@ target_compile_definitions(supplemental-data INTERFACE SUPPLEMENTAL_TEST_DATA_DI function(fast_float_add_cpp_test TEST_NAME) add_executable(${TEST_NAME} ${TEST_NAME}.cpp) add_test(${TEST_NAME} ${TEST_NAME}) - if(WIN32) + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") target_compile_options(${TEST_NAME} PUBLIC /EHsc) - else() + endif() + if(NOT WIN32) target_compile_options(${TEST_NAME} PUBLIC -Werror -Wall -Wextra -Weffc++) target_compile_options(${TEST_NAME} PUBLIC -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wsign-conversion) endif()