Boost uses unoptimized subtraction because of typo in intel_intrinsics.hpp
Hi, In my program I am seeing my code use the slower (I assume) subtract_unsigned_constexpr rather than subtract_unsigned with he borrow chain handled intrinsics. This seems to be happening because of these lines in intel_intrinsics.hpp: #if defined(__clang__) && (__clang__ < 9) // We appear to crash the compiler if we try to use these intrinsics? #undef BOOST_MP_HAS_IMMINTRIN_H #endif __clang__ is not the version but just the value 1. I expect this should be the major version instead: #define __clang__ 1 #define __clang_major__ 12 #define __clang_minor__ 0 As an aside 128bit support does work in windows with clang. I have to force it on like this: #define __STRICT_ANSI__ #define BOOST_HAS_INT128 #define BOOST_MP_HAS_IMMINTRIN_H #include <boost/multiprecision/cpp_int.hpp> Thanks. Neill.
On 18/08/2021 17:23, Neill Clift via Boost-users wrote:
Hi,
In my program I am seeing my code use the slower (I assume) subtract_unsigned_constexpr rather than subtract_unsigned with he borrow chain handled intrinsics.
This seems to be happening because of these lines in intel_intrinsics.hpp:
#if defined(__clang__) && (__clang__ < 9)
// We appear to crash the compiler if we try to use these intrinsics?
#undef BOOST_MP_HAS_IMMINTRIN_H
#endif
__clang__ is not the version but just the value 1. I expect this should be the major version instead:
Good catch, see https://github.com/boostorg/multiprecision/pull/356
#define __clang__ 1
#define __clang_major__ 12
#define __clang_minor__ 0
As an aside 128bit support does work in windows with clang. I have to force it on like this:
#define __STRICT_ANSI__
#define BOOST_HAS_INT128
#define BOOST_MP_HAS_IMMINTRIN_H
#include <boost/multiprecision/cpp_int.hpp>
I'll look at that separately, thanks John. -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
participants (2)
-
John Maddock
-
Neill Clift