Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

ishft not optimized in 2017.2

TimP
Black Belt
77 Views

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.

0 Kudos
1 Reply
Kevin_D_Intel
Employee
77 Views

Thanks Tim. We'll investigate.

Reply