[eigen] Replacing AVX code with Eigen PacketMath ?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

I have a project where I'm already using Eigen for computations. I was 
wondering if I can rewrite some hand-written AVX2 code using Eigen types 
(I'm looking at Packets in particular):

         constexpr int shift_one { _MM_SHUFFLE(0, 3, 2, 1) };
         constexpr int shift_two { _MM_SHUFFLE(1, 0, 3, 2) };
         constexpr int shift_thr { _MM_SHUFFLE(2, 1, 0, 3) };

         static inline bool _mm256_is_zero(__m256i m) noexcept { return 
_mm256_testz_si256(m, m); }

         static inline bool NullIntersectProbe(uint64_t const* lhs, 
uint64_t const* rhs) noexcept
         {
             __m256i a { _mm256_load_si256((__m256i*)lhs) };
             __m256i b { _mm256_load_si256((__m256i*)rhs) };

             __m256i r0 { _mm256_cmpeq_epi64(a, b) };
             if (!_mm256_is_zero(r0))
                 return false;

             __m256i r1 { _mm256_cmpeq_epi64(a, 
_mm256_permute4x64_epi64(b, shift_one)) };
             if (!_mm256_is_zero(r1))
                 return false;

             __m256i r2 { _mm256_cmpeq_epi64(a, 
_mm256_permute4x64_epi64(b, shift_two)) };
             if (!_mm256_is_zero(r2))
                 return false;

             __m256i r3 { _mm256_cmpeq_epi64(a, 
_mm256_permute4x64_epi64(b, shift_thr)) };
             return _mm256_is_zero(r3);
         }

I would like to make the code more generic so that it would work on 
other x86_64 CPU flavors.
Is there any documentation for this low-level stuff or should I just 
look at eg PacketMath.h?

Best,
Bogdan





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/