aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/packetmath_test_shared.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/packetmath_test_shared.h')
-rw-r--r--test/packetmath_test_shared.h18
1 files changed, 18 insertions, 0 deletions
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<typename T>
inline void store(T* to, const Packet& x, unsigned long long umask) const { internal::pstoreu(to, x, umask); }
+
+ template<typename T>
+ inline Packet& forward_reference(Packet& packet, T& /*scalar*/) const { return packet; }
};
template<typename Packet>
@@ -162,6 +165,9 @@ struct packet_helper<false,Packet>
template<typename T>
inline void store(T* to, const T& x, unsigned long long) const { *to = x; }
+
+ template<typename T>
+ 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<false,Packet>
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<COND,Packet> h; \
+ for (int i=0; i<PacketSize; ++i) \
+ ref[i] = Scalar(REFOP(data1[i], ref[i+PacketSize])); \
+ Packet pout; \
+ Scalar sout; \
+ h.store(data2, POP(h.load(data1), h.forward_reference(pout, sout))); \
+ h.store(data2+PacketSize, h.forward_reference(pout, sout)); \
+ VERIFY(test::areApprox(ref, data2, 2 * PacketSize) && #POP); \
+}
+
#define CHECK_CWISE3_IF(COND, REFOP, POP) if (COND) { \
test::packet_helper<COND, Packet> h; \
for (int i = 0; i < PacketSize; ++i) \