From b2126fd6b5e232d072ceadb1abb6695ae3352e2e Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Wed, 20 Jan 2021 19:00:09 -0800 Subject: Fix pfrexp/pldexp for half. The recent addition of vectorized pow (!330) relies on `pfrexp` and `pldexp`. This was missing for `Eigen::half` and `Eigen::bfloat16`. Adding tests for these packet ops also exposed an issue with handling negative values in `pfrexp`, returning an incorrect exponent. Added the missing implementations, corrected the exponent in `pfrexp1`, and added `packetmath` tests. --- test/packetmath_test_shared.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/packetmath_test_shared.h') diff --git a/test/packetmath_test_shared.h b/test/packetmath_test_shared.h index 46a42604b..027715a89 100644 --- a/test/packetmath_test_shared.h +++ b/test/packetmath_test_shared.h @@ -143,6 +143,9 @@ struct packet_helper template inline void store(T* to, const Packet& x, unsigned long long umask) const { internal::pstoreu(to, x, umask); } + + template + inline Packet& forward_reference(Packet& packet, T& /*scalar*/) const { return packet; } }; template @@ -162,6 +165,9 @@ struct packet_helper template inline void store(T* to, const T& x, unsigned long long) const { *to = x; } + + template + inline T& forward_reference(Packet& /*packet*/, T& scalar) const { return scalar; } }; #define CHECK_CWISE1_IF(COND, REFOP, POP) if(COND) { \ @@ -180,6 +186,18 @@ struct packet_helper VERIFY(test::areApprox(ref, data2, PacketSize) && #POP); \ } +// One input, one output by reference. +#define CHECK_CWISE1_BYREF1_IF(COND, REFOP, POP) if(COND) { \ + test::packet_helper h; \ + for (int i=0; i h; \ for (int i = 0; i < PacketSize; ++i) \ -- cgit v1.2.3