aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/packetmath.cpp
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2020-05-19 16:21:56 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2020-05-19 16:21:56 -0700
commitcc86a31e20b48b0f03d714b4d1b1f50d52848d36 (patch)
treeb3c71f97400bf675c19b1112a846992b0d6f39dd /test/packetmath.cpp
parent8a7f360ec3160acdb545d05712435d8ca0334357 (diff)
Add guard around specialization for bool, which is only currently implemented for SSE.
Diffstat (limited to 'test/packetmath.cpp')
-rw-r--r--test/packetmath.cpp7
1 files changed, 5 insertions, 2 deletions
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 <typename T>
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<typename FromScalar, typename FromPacket, typename ToScalar, typename ToPacket, bool CanCast = false>
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<bool, internal::Packet16b>()
{
}
+#endif
template<typename Scalar,typename Packet> void packetmath()
{