https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52473
--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to Jerry DeLisle from comment #7) > (In reply to Thomas Koenig from comment #6) > > Created attachment 41508 [details] > > 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. > > How often or how important is this feature? Would it improve any known > benchmark or real world application in a significant manner? There's protein.f90 - see PR 52934. Calculating a numerical derivative for a periodic function as diff = (cshift(a,1) - cshift(a,-1))/(2*h) seems natural, or the second derivative as d2 = (cshift(a,1) - 2*a + cshift(a,-1))/(h**2) Of course, to be really useful, this would also have to be extended to eoshift...