This bugzilla service is closed. All entries have been migrated to

Bug 1685

Summary: Vectorize .reverse() and .reverseInPlace()
Product: Eigen Reporter: Christoph Hertzberg <chtz>
Component: Core - vectorizationAssignee: Nobody <eigen.nobody>
Status: CONFIRMED ---    
Severity: Optimization CC: chtz, gael.guennebaud, jacob.benoit.1, markos
Priority: Low Keywords: JuniorJob
Version: 3.4 (development)   
Hardware: x86 - AVX   
OS: All   

Description Christoph Hertzberg 2019-02-22 10:38:08 UTC
While exposing a bug in LLVM, Bug 1684 also demonstrated that many reverse operations could be nicely vectorized, especially with AVX or AVX512.
E.g., a rowwise vectorization of a Matrix4f with AVX would be possible using two vperm2f128 instructions with AVX or one vpermps instruction with AVX512F.

Similar optimizations are possible with SSE for matrices with 2 rows or (slightly more complicated) 4*n+2 rows.

Low priority/JuniorJob. 
If someone wants to try this, but does not want to dig into the internals of Eigen, provide solutions like:

  template<int rows, int cols>
  void rowwise_reverse(float* out, float const* in);

  template<int rows, int cols>
  void colwise_reverseInPlace(float* in_out);

(Or with a templated Scalar instead of float)

It is also ok to provide solutions just for some cases at first (but avoid writing too much boiler plate code).
Comment 1 Nobody 2019-12-04 18:31:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: