This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] PR 57071, some power optimizations
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Thomas Koenig <tkoenig at netcologne dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 28 Apr 2013 04:28:43 -0700
- Subject: Re: [patch, fortran] PR 57071, some power optimizations
- References: <517CDE9C dot 2020301 at netcologne dot de>
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