Assigning a vectorizable expression to an unaligned destination loses vectorization

Submitted by Christoph Hertzberg @chhtz

Assigned to Nobody

Link to original bugzilla bug (#256)
Version: 3.0

Description

Functions such as

void minus_test(Eigen::Vector2d &a, Eigen::Vector2d &b, Eigen::Vector3d &d){
d.head<2>() = a - b;
}

could easily use vectorization of (a - b), requiring just a single unaligned store to d.head<2>() (similar use-cases with Map<Vector2d> exist).

One question would be to what extent this would be worthwhile (e.g. unaligned = aligned + unaligned would require (just) one additional unaligned load).
If the logic to do this automatically gets to complicated, maybe some modifier could be introduced:

    d.head&lt;2&gt;().packetWise() = a - b.packetWise();  

where packetWise returns a wrapper which overwrites packet() and copyPacket(), and pretends to be Aligned.

Depends on

#99 (closed)

Edited by Eigen Bugzilla