Re: [eigen] State of eigen support for small integers(16 bit, signed/unsigned)

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


2009/8/20 Rohit Garg <rpg.314@xxxxxxxxx>:
>> First, read this,
>> http://eigen.tuxfamily.org/dox/CustomizingEigen.html#CustomScalarType
>> The two most important things are to edit the files NumTraits.h and
>> MathFunctions.h in Core/.
>
> So one adds all types to eigen by following that method on that page then.

yes!

>
>>
>> For vectorization, you'll have to edit the files in Core/arch/... at
>> least Core/arch/SSE/PacketMath.h. Not sure about how it works for
>> small ints (are there specific SSE instructions for e.g. adding two
>> packets of 8 int16's ? you know better than me)
>
>
>> For the bitwise ops, in the non-vector case i don't think you need to
>> do anything special since operators & |... work natively; you can
>> always check the Functors.h either in Core/ or in Array/ ; for
>> vectorization I'm very optimistic too -- we already have ei_pand(),
>> ei_por() etc in PacketMath.h and since for bitwise ops the integer
>> size is irrelevant, you should be able to use that.
>
> What about shifts?

I can't see that in PacketMath.h, so you'll have to add it. Here's the
relevant part of this file:

template<> EIGEN_STRONG_INLINE Packet4f ei_pand<Packet4f>(const
Packet4f& a, const Packet4f& b) { return _mm_and_ps(a,b); }
template<> EIGEN_STRONG_INLINE Packet2d ei_pand<Packet2d>(const
Packet2d& a, const Packet2d& b) { return _mm_and_pd(a,b); }
template<> EIGEN_STRONG_INLINE Packet4i ei_pand<Packet4i>(const
Packet4i& a, const Packet4i& b) { return _mm_and_si128(a,b); }

template<> EIGEN_STRONG_INLINE Packet4f ei_por<Packet4f>(const
Packet4f& a, const Packet4f& b) { return _mm_or_ps(a,b); }
template<> EIGEN_STRONG_INLINE Packet2d ei_por<Packet2d>(const
Packet2d& a, const Packet2d& b) { return _mm_or_pd(a,b); }
template<> EIGEN_STRONG_INLINE Packet4i ei_por<Packet4i>(const
Packet4i& a, const Packet4i& b) { return _mm_or_si128(a,b); }

template<> EIGEN_STRONG_INLINE Packet4f ei_pxor<Packet4f>(const
Packet4f& a, const Packet4f& b) { return _mm_xor_ps(a,b); }
template<> EIGEN_STRONG_INLINE Packet2d ei_pxor<Packet2d>(const
Packet2d& a, const Packet2d& b) { return _mm_xor_pd(a,b); }
template<> EIGEN_STRONG_INLINE Packet4i ei_pxor<Packet4i>(const
Packet4i& a, const Packet4i& b) { return _mm_xor_si128(a,b); }

template<> EIGEN_STRONG_INLINE Packet4f ei_pandnot<Packet4f>(const
Packet4f& a, const Packet4f& b) { return _mm_andnot_ps(a,b); }
template<> EIGEN_STRONG_INLINE Packet2d ei_pandnot<Packet2d>(const
Packet2d& a, const Packet2d& b) { return _mm_andnot_pd(a,b); }
template<> EIGEN_STRONG_INLINE Packet4i ei_pandnot<Packet4i>(const
Packet4i& a, const Packet4i& b) { return _mm_andnot_si128(a,b); }

Benoit



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