This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH] Make the _gfortran_pow* const
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Sun, 26 Nov 2006 00:42:20 -0800
- Subject: Re: [PATCH] Make the _gfortran_pow* const
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=XIyvunaAgy/1JsRq5D/P0CM5f8DuKAcjiMjsd8k5SE2J3sHJ5cAMh57F+hHEhnoW5hsiGvPK4ijREFi5aBSdjk3wA5I9Rfk6Y88wg0sT/JNSTU1MQ28+go8oBqd26cEQi4pz4BG1mJtsMIid7NdwSRcH9vo7sz7mjTAagguLwRM=
- References: <1164516466.19849.152.camel@celery.andrew.com> <20061126093837.1svbfyb9ws0gc44o@webmail.physik.uni-muenchen.de>
On Sun, 2006-11-26 at 09:38 +0100, Tobias SchlÃter wrote:
> Andrew Pinski <pinskia@gmail.com> wrote on Sun, 26 Nov 2006:
> > This patch makes the _gfortran_pow* function constant functions as the
> > return value is only dependent on those values and they don't have any
> > special side effects.
> >
> > This patch speeds up my father's code by about 10% where he has a couple
> > of rd**3.
>
> Why are they not compiled as rd*rd*rd? We have code which should do
> just that.
>From trans-expr.c (gfc_conv_cst_int_power):
if (((FLOAT_TYPE_P (type) && !flag_unsafe_math_optimizations) || optimize_size)
&& (n > 2 || n < -1))
return 0;
Because rd is a floating point value and n > 2.
There was also some rd**-3 in the source also.
-- Pinski