Skip to content

Commit a70809b

Browse files
committed
Add additional path for x64 MSVC intrinsics
1 parent fe80ab2 commit a70809b

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

include/boost/decimal/detail/u128.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,13 @@ BOOST_DECIMAL_FORCE_INLINE constexpr void div_mod_impl(const u128& lhs, const u1
19561956

19571957
remainder.high = UINT64_C(0);
19581958
}
1959+
#ifdef BOOST_DECIMAL_HAS_MSVC_X64_INTRINSICS
1960+
else if (rhs.high == UINT64_C(0))
1961+
{
1962+
// Since low is at least 2^32 the quotient will be less than 2^64
1963+
quotient.low = _udiv128(lhs.high, lhs.low, rhs.low, &remainder.low);
1964+
}
1965+
#endif
19591966
else
19601967
{
19611968
auto lhs_wide = u128_to_wide_integer(lhs);

test/benchmark_uints.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,11 @@ int main()
389389
std::cout << std::endl;
390390

391391
#if defined(BOOST_DECIMAL_HAS_INT128) || defined(BOOST_DECIMAL_HAS_MSVC_INTERNAL_U128)
392-
test_digit_counting(builtin_vector, "builtin");
392+
// test_digit_counting(builtin_vector, "builtin");
393393
#endif
394394

395-
test_digit_counting(old_vector, "old");
396-
test_digit_counting(new_vector, "new");
395+
// test_digit_counting(old_vector, "old");
396+
// test_digit_counting(new_vector, "new");
397397
}
398398
// Single word operations
399399
{
@@ -451,11 +451,11 @@ int main()
451451
std::cout << std::endl;
452452

453453
#if defined(BOOST_DECIMAL_HAS_INT128) || defined(BOOST_DECIMAL_HAS_MSVC_INTERNAL_U128)
454-
test_digit_counting(builtin_vector, "builtin");
454+
// test_digit_counting(builtin_vector, "builtin");
455455
#endif
456456

457-
test_digit_counting(old_vector, "old");
458-
test_digit_counting(new_vector, "new");
457+
// test_digit_counting(old_vector, "old");
458+
// test_digit_counting(new_vector, "new");
459459
}
460460
{
461461
// Two word and one word operations Even = 2, odd = 1
@@ -514,11 +514,11 @@ int main()
514514
std::cout << std::endl;
515515

516516
#if defined(BOOST_DECIMAL_HAS_INT128) || defined(BOOST_DECIMAL_HAS_MSVC_INTERNAL_U128)
517-
test_digit_counting(builtin_vector, "builtin");
517+
// test_digit_counting(builtin_vector, "builtin");
518518
#endif
519519

520-
test_digit_counting(old_vector, "old");
521-
test_digit_counting(new_vector, "new");
520+
// test_digit_counting(old_vector, "old");
521+
// test_digit_counting(new_vector, "new");
522522
}
523523
{
524524
// Two word and one word operations Even = 1, odd = 2
@@ -577,11 +577,11 @@ int main()
577577
std::cout << std::endl;
578578

579579
#if defined(BOOST_DECIMAL_HAS_INT128) || defined(BOOST_DECIMAL_HAS_MSVC_INTERNAL_U128)
580-
test_digit_counting(builtin_vector, "builtin");
580+
// test_digit_counting(builtin_vector, "builtin");
581581
#endif
582582

583-
test_digit_counting(old_vector, "old");
584-
test_digit_counting(new_vector, "new");
583+
// test_digit_counting(old_vector, "old");
584+
// test_digit_counting(new_vector, "new");
585585
}
586586
{
587587
// Two word and one word operations Even = 1, odd = 2
@@ -649,11 +649,11 @@ int main()
649649
std::cout << std::endl;
650650

651651
#if defined(BOOST_DECIMAL_HAS_INT128) || defined(BOOST_DECIMAL_HAS_MSVC_INTERNAL_U128)
652-
test_digit_counting(builtin_vector, "builtin");
652+
// test_digit_counting(builtin_vector, "builtin");
653653
#endif
654654

655-
test_digit_counting(old_vector, "old");
656-
test_digit_counting(new_vector, "new");
655+
// test_digit_counting(old_vector, "old");
656+
// test_digit_counting(new_vector, "new");
657657
}
658658

659659
return 1;

0 commit comments

Comments
 (0)