On Sun, Apr 28, 2013 at 10:32:28AM +0200, Thomas Koenig wrote: > Hello world, > > the attached patch does some optimization on > power using ishft and iand, as discussed in the PR. > > I have left out handling real numbers, that should be left > to the middle-end (PR 57073). > > Regression-tested. OK for trunk? >
% cat foo.f90 function foo(k) integer k integer foo foo = (1)**k end function foo % cat foo.f90.003t.original foo (integer(kind=4) & restrict k) { integer(kind=4) __result_foo; __result_foo = _gfortran_pow_i4_i4 (1, *k); return __result_foo; } % cat foo.f90.143t.optimized ;; Function foo (foo_) foo (integer(kind=4) & restrict k) { integer(kind=4) __result_foo.0; integer(kind=4) D.1479; <bb 2>: D.1479_2 = *k_1(D); __result_foo.0_3 = _gfortran_pow_i4_i4 (1, D.1479_2); [tail call] return __result_foo.0_3; } % nm foo.o U _gfortran_pow_i4_i4 00000000 T foo_ :-) -- Steve