aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/packetmath.cpp
diff options
context:
space:
mode:
authorGravatar Eugene Zhulenev <ezhulenev@google.com>2019-05-02 13:14:18 -0700
committerGravatar Eugene Zhulenev <ezhulenev@google.com>2019-05-02 13:14:18 -0700
commitb4010f02f9fc78504586f6eac13066686877e5e8 (patch)
tree522d7fd885a4d8766d670e68e16d2b44e12628ff /test/packetmath.cpp
parent578407f42f2598e8a1b5d8caeccf8968a326335b (diff)
Add masked pstoreu to AVX and AVX512 PacketMath
Diffstat (limited to 'test/packetmath.cpp')
-rw-r--r--test/packetmath.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/packetmath.cpp b/test/packetmath.cpp
index 200670b8c..e704a53ea 100644
--- a/test/packetmath.cpp
+++ b/test/packetmath.cpp
@@ -119,10 +119,16 @@ struct packet_helper
inline Packet load(const T* from) const { return internal::pload<Packet>(from); }
template<typename T>
+ inline Packet loadu(const T* from) const { return internal::ploadu<Packet>(from); }
+
+ template<typename T>
inline Packet load(const T* from, unsigned long long umask) const { return internal::ploadu<Packet>(from, umask); }
template<typename T>
inline void store(T* to, const Packet& x) const { internal::pstore(to,x); }
+
+ template<typename T>
+ inline void store(T* to, const Packet& x, unsigned long long umask) const { internal::pstoreu(to, x, umask); }
};
template<typename Packet>
@@ -132,10 +138,16 @@ struct packet_helper<false,Packet>
inline T load(const T* from) const { return *from; }
template<typename T>
+ inline T loadu(const T* from) const { return *from; }
+
+ template<typename T>
inline T load(const T* from, unsigned long long) const { return *from; }
template<typename T>
inline void store(T* to, const T& x) const { *to = x; }
+
+ template<typename T>
+ inline void store(T* to, const T& x, unsigned long long) const { *to = x; }
};
#define CHECK_CWISE1_IF(COND, REFOP, POP) if(COND) { \
@@ -203,18 +215,31 @@ template<typename Scalar,typename Packet> void packetmath()
if (internal::unpacket_traits<Packet>::masked_load_available)
{
+ packet_helper<internal::unpacket_traits<Packet>::masked_load_available, Packet> h;
unsigned long long max_umask = (0x1ull << PacketSize);
+
for (int offset=0; offset<PacketSize; ++offset)
{
for (unsigned long long umask=0; umask<max_umask; ++umask)
{
- packet_helper<internal::unpacket_traits<Packet>::masked_load_available, Packet> h;
h.store(data2, h.load(data1+offset, umask));
for (int k=0; k<PacketSize; ++k)
data3[k] = ((umask & ( 0x1ull << k )) >> k) ? data1[k+offset] : Scalar(0);
VERIFY(areApprox(data3, data2, PacketSize) && "internal::ploadu masked");
}
}
+
+ for (int offset=0; offset<PacketSize; ++offset)
+ {
+ for (unsigned long long umask=0; umask<max_umask; ++umask)
+ {
+ internal::pstore(data2, internal::pset1<Packet>(Scalar(0)));
+ h.store(data2, h.loadu(data1+offset), umask);
+ for (int k=0; k<PacketSize; ++k)
+ data3[k] = ((umask & ( 0x1ull << k )) >> k) ? data1[k+offset] : Scalar(0);
+ VERIFY(areApprox(data3, data2, PacketSize) && "internal::pstoreu masked");
+ }
+ }
}
for (int offset=0; offset<PacketSize; ++offset)