Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Black Belt
13 Views

ishft not optimized in 2017.2

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
Highlighted
Employee
13 Views

Thanks Tim. We'll investigate.

0 Kudos