[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    Re: [PATCH] Make the _gfortran_pow*  const
From:       Andrew Pinski <pinskia () gmail ! com>
Date:       2006-11-26 8:42:20
Message-ID: 1164530540.19849.158.camel () celery ! andrew ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic