Bugfix regarding alignent in Assign.h (updated map unit test to detect this bug)

Anyway: LinearVectorization+CompleteUnrolling actually uses the InnerVectorization
unrollers, so these two cases could be merged to a single one...
This commit is contained in:
Gael Guennebaud 2008-09-03 14:42:36 +00:00
parent 75649551c2
commit 3bbd1b3114
2 changed files with 11 additions and 2 deletions

View File

@ -157,12 +157,13 @@ struct ei_assign_innervec_CompleteUnrolling
: Index % Derived1::RowsAtCompileTime,
col = int(Derived1::Flags)&RowMajorBit
? Index % int(Derived1::ColsAtCompileTime)
: Index / Derived1::RowsAtCompileTime
: Index / Derived1::RowsAtCompileTime,
SrcAlignment = ei_assign_traits<Derived1,Derived2>::SrcAlignment
};
inline static void run(Derived1 &dst, const Derived2 &src)
{
dst.template copyPacket<Derived2, Aligned, Aligned>(row, col, src);
dst.template copyPacket<Derived2, Aligned, SrcAlignment>(row, col, src);
ei_assign_innervec_CompleteUnrolling<Derived1, Derived2,
Index+ei_packet_traits<typename Derived1::Scalar>::size, Stop>::run(dst, src);
}

View File

@ -33,13 +33,21 @@ template<typename VectorType> void tmap(const VectorType& m)
// test Map.h
Scalar* array1 = ei_aligned_malloc<Scalar>(size);
Scalar* array2 = ei_aligned_malloc<Scalar>(size);
Scalar* array3 = new Scalar[size+1];
Scalar* array3unaligned = size_t(array3)%16 == 0 ? array3+1 : array3;
Map<VectorType, Aligned>(array1, size) = VectorType::Random(size);
Map<VectorType>(array2, size) = Map<VectorType>(array1, size);
Map<VectorType>(array3unaligned, size) = Map<VectorType>(array1, size);
VectorType ma1 = Map<VectorType>(array1, size);
VectorType ma2 = Map<VectorType, Aligned>(array2, size);
VectorType ma3 = Map<VectorType>(array3unaligned, size);
VERIFY_IS_APPROX(ma1, ma2);
VERIFY_IS_APPROX(ma1, ma3);
ei_aligned_free(array1);
ei_aligned_free(array2);
delete[] array3;
}
void test_map()