diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-11-03 03:55:11 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-11-03 03:55:11 -0700 |
commit | c80587c92b019de2bd31572aea95e5e6144f4207 (patch) | |
tree | db8f34b522ab216863ee276373a2cea335801a76 /test/packetmath.cpp | |
parent | 38b6048e1443d36d74760176ebe048bd8cd59446 (diff) | |
parent | 3f1d0cdc2270f13fbc72d6b7080012e22329aabd (diff) |
Merged eigen/eigen into default
Diffstat (limited to 'test/packetmath.cpp')
-rw-r--r-- | test/packetmath.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/packetmath.cpp b/test/packetmath.cpp index d6854c8c3..c18d73496 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -16,6 +16,12 @@ #endif // using namespace Eigen; +#ifdef EIGEN_VECTORIZE_SSE +const bool g_vectorize_sse = true; +#else +const bool g_vectorize_sse = false; +#endif + namespace Eigen { namespace internal { template<typename T> T negate(const T& x) { return -x; } @@ -297,6 +303,26 @@ template<typename Scalar> void packetmath() VERIFY(isApproxAbs(result[i], (selector.select[i] ? data1[i] : data2[i]), refvalue)); } } + + if (PacketTraits::HasBlend || g_vectorize_sse) { + // pinsertfirst + for (int i=0; i<PacketSize; ++i) + ref[i] = data1[i]; + Scalar s = internal::random<Scalar>(); + ref[0] = s; + internal::pstore(data2, internal::pinsertfirst(internal::pload<Packet>(data1),s)); + VERIFY(areApprox(ref, data2, PacketSize) && "internal::pinsertfirst"); + } + + if (PacketTraits::HasBlend || g_vectorize_sse) { + // pinsertlast + for (int i=0; i<PacketSize; ++i) + ref[i] = data1[i]; + Scalar s = internal::random<Scalar>(); + ref[PacketSize-1] = s; + internal::pstore(data2, internal::pinsertlast(internal::pload<Packet>(data1),s)); + VERIFY(areApprox(ref, data2, PacketSize) && "internal::pinsertlast"); + } } template<typename Scalar> void packetmath_real() |