For a long time I used the ugly replacement of i/2 (positive integer) by ishft(i,-1). If a compiler didn't optimize /2 with shifts, it could be very slow. Now the new compiler no longer optimizes ishft. I verified this so far for Haswell client and MIC KNC.
Context (netlib vector "seq function" benchmark):
forall(i= 2:n) a(i)= b(i)+c(i/2)*d(i)
There is a C analog. I used to write (unsigned int)i/2 so as to assure optimization, but the 2017.0.2 compiler optimizes only without the cast. In gcc there is still a small advantage to the cast, although gfortran doesn't care much whether I use /2 or ishft.