From cc86a31e20b48b0f03d714b4d1b1f50d52848d36 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Tue, 19 May 2020 16:21:56 -0700 Subject: Add guard around specialization for bool, which is only currently implemented for SSE. --- test/packetmath.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/packetmath.cpp') diff --git a/test/packetmath.cpp b/test/packetmath.cpp index e59e9df21..7f2e69a50 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -21,7 +21,7 @@ inline T REF_DIV(const T& a, const T& b) { return a / b;} template inline T REF_ABS_DIFF(const T& a, const T& b) { return a>b ? a - b : b-a;} -// Specializations for bool +// Specializations for bool. template <> inline bool REF_ADD(const bool& a, const bool& b) { return a || b;} template <> @@ -29,7 +29,6 @@ inline bool REF_SUB(const bool& a, const bool& b) { return a ^ b;} template <> inline bool REF_MUL(const bool& a, const bool& b) { return a && b;} - template struct test_cast_helper; @@ -106,10 +105,14 @@ void packetmath_boolean_mask_ops() CHECK_CWISE2_IF(true, internal::pcmp_eq, internal::pcmp_eq); } +// Packet16b representing bool does not support ptrue, pandnot or pcmp_eq, since the scalar path +// (for some compilers) compute the bitwise and with 0x1 of the results to keep the value in [0,1]. +#ifdef EIGEN_PACKET_MATH_SSE_H template<> void packetmath_boolean_mask_ops() { } +#endif template void packetmath() { -- cgit v1.2.3