Lines 396-421
struct unaligned_copy_using_evaluator_im
Link Here
|
396 |
|
396 |
|
397 |
template <> |
397 |
template <> |
398 |
struct unaligned_copy_using_evaluator_impl<false> |
398 |
struct unaligned_copy_using_evaluator_impl<false> |
399 |
{ |
399 |
{ |
400 |
// MSVC must not inline this functions. If it does, it fails to optimize the |
400 |
// MSVC must not inline this functions. If it does, it fails to optimize the |
401 |
// packet access path. |
401 |
// packet access path. |
402 |
#ifdef _MSC_VER |
402 |
#ifdef _MSC_VER |
403 |
template <typename SrcEvaluatorType, typename DstEvaluatorType> |
403 |
template <typename SrcEvaluatorType, typename DstEvaluatorType> |
404 |
static EIGEN_DONT_INLINE void run(const SrcEvaluatorType& src, DstEvaluatorType& dst, |
404 |
static EIGEN_DONT_INLINE void run(const SrcEvaluatorType& srcEvaluator, DstEvaluatorType& dstEvaluator, |
405 |
typename SrcEvaluatorType::Index start, typename SrcEvaluatorType::Index end) |
405 |
typename SrcEvaluatorType::Index start, typename SrcEvaluatorType::Index end) |
406 |
#else |
406 |
#else |
407 |
template <typename SrcEvaluatorType, typename DstEvaluatorType> |
407 |
template <typename SrcEvaluatorType, typename DstEvaluatorType> |
408 |
static EIGEN_STRONG_INLINE void run(const SrcEvaluatorType& src, DstEvaluatorType& dst, |
408 |
static EIGEN_STRONG_INLINE void run(const SrcEvaluatorType& srcEvaluator, DstEvaluatorType& dstEvaluator, |
409 |
typename SrcEvaluatorType::Index start, typename SrcEvaluatorType::Index end) |
409 |
typename SrcEvaluatorType::Index start, typename SrcEvaluatorType::Index end) |
410 |
#endif |
410 |
#endif |
411 |
{ |
411 |
{ |
412 |
for (typename SrcEvaluatorType::Index index = start; index < end; ++index) |
412 |
for (typename SrcEvaluatorType::Index index = start; index < end; ++index) |
413 |
dst.copyCoeff(index, src); |
413 |
// TODO: Use copyCoeff ? |
|
|
414 |
dstEvaluator.coeffRef(index) = srcEvaluator.coeff(index); |
414 |
} |
415 |
} |
415 |
}; |
416 |
}; |
416 |
|
417 |
|
417 |
template<typename DstXprType, typename SrcXprType> |
418 |
template<typename DstXprType, typename SrcXprType> |
418 |
struct copy_using_evaluator_impl<DstXprType, SrcXprType, LinearVectorizedTraversal, NoUnrolling> |
419 |
struct copy_using_evaluator_impl<DstXprType, SrcXprType, LinearVectorizedTraversal, NoUnrolling> |
419 |
{ |
420 |
{ |
420 |
EIGEN_STRONG_INLINE static void run(const DstXprType &dst, const SrcXprType &src) |
421 |
EIGEN_STRONG_INLINE static void run(const DstXprType &dst, const SrcXprType &src) |
421 |
{ |
422 |
{ |
Lines 429-455
struct copy_using_evaluator_impl<DstXprT
Link Here
|
429 |
const Index size = dst.size(); |
430 |
const Index size = dst.size(); |
430 |
typedef packet_traits<typename DstXprType::Scalar> PacketTraits; |
431 |
typedef packet_traits<typename DstXprType::Scalar> PacketTraits; |
431 |
enum { |
432 |
enum { |
432 |
packetSize = PacketTraits::size, |
433 |
packetSize = PacketTraits::size, |
433 |
dstIsAligned = int(copy_using_evaluator_traits<DstXprType,SrcXprType>::DstIsAligned), |
434 |
dstIsAligned = int(copy_using_evaluator_traits<DstXprType,SrcXprType>::DstIsAligned), |
434 |
dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : dstIsAligned, |
435 |
dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : dstIsAligned, |
435 |
srcAlignment = copy_using_evaluator_traits<DstXprType,SrcXprType>::JointAlignment |
436 |
srcAlignment = copy_using_evaluator_traits<DstXprType,SrcXprType>::JointAlignment |
436 |
}; |
437 |
}; |
437 |
const Index alignedStart = dstIsAligned ? 0 : first_aligned(&dst.coeffRef(0), size); |
438 |
const Index alignedStart = dstIsAligned ? 0 : first_aligned(&dstEvaluator.coeffRef(0), size); |
438 |
const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; |
439 |
const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; |
439 |
|
440 |
|
440 |
unaligned_copy_using_evaluator_impl<dstIsAligned!=0>::run(src,dst.const_cast_derived(),0,alignedStart); |
441 |
unaligned_copy_using_evaluator_impl<dstIsAligned!=0>::run(srcEvaluator, dstEvaluator, 0, alignedStart); |
441 |
|
442 |
|
442 |
for(Index index = alignedStart; index < alignedEnd; index += packetSize) |
443 |
for(Index index = alignedStart; index < alignedEnd; index += packetSize) |
443 |
{ |
444 |
{ |
444 |
dstEvaluator.template writePacket<dstAlignment>(index, srcEvaluator.template packet<srcAlignment>(index)); |
445 |
dstEvaluator.template writePacket<dstAlignment>(index, srcEvaluator.template packet<srcAlignment>(index)); |
445 |
} |
446 |
} |
446 |
|
447 |
|
447 |
unaligned_copy_using_evaluator_impl<>::run(src,dst.const_cast_derived(),alignedEnd,size); |
448 |
unaligned_copy_using_evaluator_impl<>::run(srcEvaluator, dstEvaluator, alignedEnd, size); |
448 |
} |
449 |
} |
449 |
}; |
450 |
}; |
450 |
|
451 |
|
451 |
template<typename DstXprType, typename SrcXprType> |
452 |
template<typename DstXprType, typename SrcXprType> |
452 |
struct copy_using_evaluator_impl<DstXprType, SrcXprType, LinearVectorizedTraversal, CompleteUnrolling> |
453 |
struct copy_using_evaluator_impl<DstXprType, SrcXprType, LinearVectorizedTraversal, CompleteUnrolling> |
453 |
{ |
454 |
{ |
454 |
typedef typename DstXprType::Index Index; |
455 |
typedef typename DstXprType::Index Index; |
455 |
EIGEN_STRONG_INLINE static void run(const DstXprType &dst, const SrcXprType &src) |
456 |
EIGEN_STRONG_INLINE static void run(const DstXprType &dst, const SrcXprType &src) |