https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52473
--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Created attachment 41508 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41508&action=edit What an unrolled cshift could look like This is what an unrolled version of cshift could look like, for a simple one-dimensional case. If the shifts are constants, all the if statements are optimized away at compile-time, so it is quite efficient.