scalars fitting in a single packet requires more work, step 1

* add a, Alignable trait
* update LinearVectorization assignment
This commit is contained in:
Gael Guennebaud 2010-07-08 14:27:47 +02:00
parent 2a1500915a
commit 300a226ffa
6 changed files with 18 additions and 3 deletions

View File

@ -397,7 +397,12 @@ struct ei_assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling
EIGEN_STRONG_INLINE static void run(Derived1 &dst, const Derived2 &src)
{
const Index size = dst.size();
const Index packetSize = ei_packet_traits<typename Derived1::Scalar>::size;
typedef ei_packet_traits<typename Derived1::Scalar> PacketTraits;
enum {
packetSize = PacketTraits::size,
dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : int(ei_assign_traits<Derived1,Derived2>::DstIsAligned) ,
srcAlignment = ei_assign_traits<Derived1,Derived2>::JointAlignment
};
const Index alignedStart = ei_assign_traits<Derived1,Derived2>::DstIsAligned ? 0
: ei_first_aligned(&dst.coeffRef(0), size);
const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize;
@ -406,7 +411,7 @@ struct ei_assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling
for(Index index = alignedStart; index < alignedEnd; index += packetSize)
{
dst.template copyPacket<Derived2, Aligned, ei_assign_traits<Derived1,Derived2>::JointAlignment>(index, src);
dst.template copyPacket<Derived2, dstAlignment, srcAlignment>(index, src);
}
ei_unaligned_assign_impl<>::run(src,dst,alignedEnd,size);

View File

@ -84,7 +84,8 @@ template<typename T> struct ei_packet_traits : ei_default_packet_traits
typedef T type;
enum {
Vectorizable = 0,
size = 1
size = 1,
AlignedOnScalar = 0
};
enum {
HasAdd = 0,

View File

@ -88,6 +88,7 @@ template<> struct ei_packet_traits<float> : ei_default_packet_traits
typedef Packet4f type;
enum {
Vectorizable = 1,
AlignedOnScalar = 1,
size=4,
// FIXME check the Has*
@ -104,6 +105,7 @@ template<> struct ei_packet_traits<int> : ei_default_packet_traits
enum {
// FIXME check the Has*
Vectorizable = 1,
AlignedOnScalar = 1,
size=4
};
};

View File

@ -62,6 +62,7 @@ template<> struct ei_packet_traits<float> : ei_default_packet_traits
typedef Packet4f type;
enum {
Vectorizable = 1,
AlignedOnScalar = 1,
size = 4,
// FIXME check the Has*
@ -77,6 +78,7 @@ template<> struct ei_packet_traits<int> : ei_default_packet_traits
typedef Packet4i type;
enum {
Vectorizable = 1,
AlignedOnScalar = 1,
size=4
// FIXME check the Has*
};

View File

@ -38,6 +38,7 @@ template<> struct ei_packet_traits<std::complex<float> > : ei_default_packet_tr
typedef Packet2cf type;
enum {
Vectorizable = 1,
AlignedOnScalar = 1,
size = 2,
HasAdd = 1,
@ -224,6 +225,7 @@ template<> struct ei_packet_traits<std::complex<double> > : ei_default_packet_t
typedef Packet1cd type;
enum {
Vectorizable = 1,
AlignedOnScalar = 0,
size = 1,
HasAdd = 1,

View File

@ -67,6 +67,7 @@ template<> struct ei_packet_traits<float> : ei_default_packet_traits
typedef Packet4f type;
enum {
Vectorizable = 1,
AlignedOnScalar = 1,
size=4,
HasDiv = 1,
@ -82,6 +83,7 @@ template<> struct ei_packet_traits<double> : ei_default_packet_traits
typedef Packet2d type;
enum {
Vectorizable = 1,
AlignedOnScalar = 1,
size=2,
HasDiv = 1
@ -93,6 +95,7 @@ template<> struct ei_packet_traits<int> : ei_default_packet_traits
enum {
// FIXME check the Has*
Vectorizable = 1,
AlignedOnScalar = 1,
size=4
};
};