mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Created the pblend packet primitive and implemented it using SSE and AVX instructions.
This commit is contained in:
@@ -261,6 +261,22 @@ template<typename Scalar> void packetmath()
|
||||
VERIFY(isApproxAbs(data2[j], data1[i+j*PacketSize], refvalue) && "ptranspose");
|
||||
}
|
||||
}
|
||||
|
||||
if (internal::packet_traits<Scalar>::HasBlend) {
|
||||
Packet thenPacket = internal::pload<Packet>(data1);
|
||||
Packet elsePacket = internal::pload<Packet>(data2);
|
||||
EIGEN_ALIGN_DEFAULT internal::Selector<PacketSize> selector;
|
||||
for (int i = 0; i < PacketSize; ++i) {
|
||||
selector.select[i] = i;
|
||||
}
|
||||
|
||||
Packet blend = internal::pblend(selector, thenPacket, elsePacket);
|
||||
EIGEN_ALIGN_DEFAULT Scalar result[size];
|
||||
internal::pstore(result, blend);
|
||||
for (int i = 0; i < PacketSize; ++i) {
|
||||
VERIFY(isApproxAbs(result[i], (selector.select[i] ? data1[i] : data2[i]), refvalue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Scalar> void packetmath_real()
|
||||
|
||||
Reference in New Issue
Block a user