re PR fortran/32239 (optimize power in loops, use __builtin_powi instead of _gfortran_pow_r4_i4)

gcc/fortran:
	
2007-07-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/32239
	* trans-expr.c (gfc_conv_power_op): Use builtin_powi for
	real**int4 powers.
	* f95-lang.c (gfc_init_builtin_functions): Add builtin_powi to the
	builtins table.

	
libgfortran:
	
2007-07-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/32239
	* Makefile.am: Don't generate real**int4 pow functions.
	* gfortran.map: Remove real**int4 pow symbols.
	* Makefile.in: Regenerated.

testsuite

2007-07-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/32239
	* gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90
	(test_4): Use proper test for floating point equality.
	(test_8): Likewise.

From-SVN: r126175
This commit is contained in:
Janne Blomqvist 2007-07-01 19:24:38 +03:00
parent c7b6844eb5
commit 31c97dfe34
9 changed files with 66 additions and 59 deletions

View File

@ -1,3 +1,11 @@
2007-07-01 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/32239
* trans-expr.c (gfc_conv_power_op): Use builtin_powi for
real**int4 powers.
* f95-lang.c (gfc_init_builtin_functions): Add builtin_powi to the
builtins table.
2007-07-01 Janne Blomqvist <jb@gcc.gnu.org>
* trans.h: Remove decls for 64-bit allocation functions.

View File

@ -950,6 +950,13 @@ gfc_init_builtin_functions (void)
BUILT_IN_POW, "pow", true);
gfc_define_builtin ("__builtin_powf", mfunc_float[1],
BUILT_IN_POWF, "powf", true);
gfc_define_builtin ("__builtin_powil", mfunc_longdouble[2],
BUILT_IN_POWIL, "powil", true);
gfc_define_builtin ("__builtin_powi", mfunc_double[2],
BUILT_IN_POWI, "powi", true);
gfc_define_builtin ("__builtin_powif", mfunc_float[2],
BUILT_IN_POWIF, "powif", true);
if (TARGET_C99_FUNCTIONS)
{

View File

@ -780,9 +780,9 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
gfc_add_block_to_block (&se->pre, &rse.pre);
if (expr->value.op.op2->ts.type == BT_INTEGER
&& expr->value.op.op2->expr_type == EXPR_CONSTANT)
&& expr->value.op.op2->expr_type == EXPR_CONSTANT)
if (gfc_conv_cst_int_power (se, lse.expr, rse.expr))
return;
return;
gfc_int4_type_node = gfc_get_int_type (4);
@ -852,7 +852,30 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
break;
case BT_REAL:
fndecl = gfor_fndecl_math_powi[kind][ikind].real;
/* Use builtins for real ** int4. */
if (ikind == 0)
{
switch (kind)
{
case 0:
fndecl = built_in_decls[BUILT_IN_POWIF];
break;
case 1:
fndecl = built_in_decls[BUILT_IN_POWI];
break;
case 2:
case 3:
fndecl = built_in_decls[BUILT_IN_POWIL];
break;
default:
gcc_unreachable ();
}
}
else
fndecl = gfor_fndecl_math_powi[kind][ikind].real;
break;
case BT_COMPLEX:

View File

@ -1,3 +1,10 @@
2007-07-01 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/32239
* gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90
(test_4): Use proper test for floating point equality.
(test_8): Likewise.
2007-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/32554

View File

@ -66,7 +66,7 @@ if (z .gt. 0) then
else
y = (y / 2.) * (2. ** (z + 1))
end if
if (abs (x - y) .gt. abs(x * 1e-6)) call abort()
if (abs (x - y) .gt. spacing (max (abs (x), abs (y)))) call abort()
end
subroutine test_8(x)
@ -79,6 +79,6 @@ if (z .gt. 0) then
else
y = (y / 2._8) * (2._8 ** (z + 1))
end if
if (abs (x - y) .gt. abs(x * 1e-6)) call abort()
if (abs (x - y) .gt. spacing (max (abs (x), abs(y)))) call abort()
end

View File

@ -1,3 +1,10 @@
2007-07-01 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/32239
* Makefile.am: Don't generate real**int4 pow functions.
* gfortran.map: Remove real**int4 pow symbols.
* Makefile.in: Regenerated.
2007-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/32554
@ -6,14 +13,14 @@
2007-07-01 Janne Blomqvist <jb@gcc.gnu.org>
* runtime/memory.c (internal_realloc): Use index_type for size
argument instead of GFC_INTEGER_4.
(allocate_array): Likewise.
(allocate): Likewise, add ifdef around unnecessary check.
(internal_reallo64): Remove.
(allocate_array64): Remove.
(allocate64): Remove.
* gfortran.map: Remove symbols for 64-bit allocation functions.
* runtime/memory.c (internal_realloc): Use index_type for size
argument instead of GFC_INTEGER_4.
(allocate_array): Likewise.
(allocate): Likewise, add ifdef around unnecessary check.
(internal_reallo64): Remove.
(allocate_array64): Remove.
(allocate64): Remove.
* gfortran.map: Remove symbols for 64-bit allocation functions.
2007-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>

View File

@ -430,10 +430,6 @@ i_pow_c = \
$(srcdir)/generated/pow_i4_i4.c \
$(srcdir)/generated/pow_i8_i4.c \
$(srcdir)/generated/pow_i16_i4.c \
$(srcdir)/generated/pow_r4_i4.c \
$(srcdir)/generated/pow_r8_i4.c \
$(srcdir)/generated/pow_r10_i4.c \
$(srcdir)/generated/pow_r16_i4.c \
$(srcdir)/generated/pow_c4_i4.c \
$(srcdir)/generated/pow_c8_i4.c \
$(srcdir)/generated/pow_c10_i4.c \

View File

@ -158,8 +158,7 @@ am__objects_25 = nearest_r4.lo nearest_r8.lo nearest_r10.lo \
nearest_r16.lo
am__objects_26 = set_exponent_r4.lo set_exponent_r8.lo \
set_exponent_r10.lo set_exponent_r16.lo
am__objects_27 = pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_r4_i4.lo \
pow_r8_i4.lo pow_r10_i4.lo pow_r16_i4.lo pow_c4_i4.lo \
am__objects_27 = pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_c4_i4.lo \
pow_c8_i4.lo pow_c10_i4.lo pow_c16_i4.lo pow_i4_i8.lo \
pow_i8_i8.lo pow_i16_i8.lo pow_r4_i8.lo pow_r8_i8.lo \
pow_r10_i8.lo pow_r16_i8.lo pow_c4_i8.lo pow_c8_i8.lo \
@ -816,10 +815,6 @@ i_pow_c = \
$(srcdir)/generated/pow_i4_i4.c \
$(srcdir)/generated/pow_i8_i4.c \
$(srcdir)/generated/pow_i16_i4.c \
$(srcdir)/generated/pow_r4_i4.c \
$(srcdir)/generated/pow_r8_i4.c \
$(srcdir)/generated/pow_r10_i4.c \
$(srcdir)/generated/pow_r16_i4.c \
$(srcdir)/generated/pow_c4_i4.c \
$(srcdir)/generated/pow_c8_i4.c \
$(srcdir)/generated/pow_c10_i4.c \
@ -1412,16 +1407,12 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_i8_i4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_i8_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r10_i16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r10_i4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r10_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r16_i16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r16_i4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r16_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r4_i16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r4_i4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r4_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r8_i16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r8_i4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pow_r8_i8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/product_c10.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/product_c16.Plo@am__quote@
@ -3786,34 +3777,6 @@ pow_i16_i4.lo: $(srcdir)/generated/pow_i16_i4.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i16_i4.lo `test -f '$(srcdir)/generated/pow_i16_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_i16_i4.c
pow_r4_i4.lo: $(srcdir)/generated/pow_r4_i4.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pow_r4_i4.lo -MD -MP -MF "$(DEPDIR)/pow_r4_i4.Tpo" -c -o pow_r4_i4.lo `test -f '$(srcdir)/generated/pow_r4_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r4_i4.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pow_r4_i4.Tpo" "$(DEPDIR)/pow_r4_i4.Plo"; else rm -f "$(DEPDIR)/pow_r4_i4.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/pow_r4_i4.c' object='pow_r4_i4.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r4_i4.lo `test -f '$(srcdir)/generated/pow_r4_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r4_i4.c
pow_r8_i4.lo: $(srcdir)/generated/pow_r8_i4.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pow_r8_i4.lo -MD -MP -MF "$(DEPDIR)/pow_r8_i4.Tpo" -c -o pow_r8_i4.lo `test -f '$(srcdir)/generated/pow_r8_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r8_i4.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pow_r8_i4.Tpo" "$(DEPDIR)/pow_r8_i4.Plo"; else rm -f "$(DEPDIR)/pow_r8_i4.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/pow_r8_i4.c' object='pow_r8_i4.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r8_i4.lo `test -f '$(srcdir)/generated/pow_r8_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r8_i4.c
pow_r10_i4.lo: $(srcdir)/generated/pow_r10_i4.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pow_r10_i4.lo -MD -MP -MF "$(DEPDIR)/pow_r10_i4.Tpo" -c -o pow_r10_i4.lo `test -f '$(srcdir)/generated/pow_r10_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r10_i4.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pow_r10_i4.Tpo" "$(DEPDIR)/pow_r10_i4.Plo"; else rm -f "$(DEPDIR)/pow_r10_i4.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/pow_r10_i4.c' object='pow_r10_i4.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r10_i4.lo `test -f '$(srcdir)/generated/pow_r10_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r10_i4.c
pow_r16_i4.lo: $(srcdir)/generated/pow_r16_i4.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pow_r16_i4.lo -MD -MP -MF "$(DEPDIR)/pow_r16_i4.Tpo" -c -o pow_r16_i4.lo `test -f '$(srcdir)/generated/pow_r16_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r16_i4.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pow_r16_i4.Tpo" "$(DEPDIR)/pow_r16_i4.Plo"; else rm -f "$(DEPDIR)/pow_r16_i4.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/pow_r16_i4.c' object='pow_r16_i4.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r16_i4.lo `test -f '$(srcdir)/generated/pow_r16_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_r16_i4.c
pow_c4_i4.lo: $(srcdir)/generated/pow_c4_i4.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pow_c4_i4.lo -MD -MP -MF "$(DEPDIR)/pow_c4_i4.Tpo" -c -o pow_c4_i4.lo `test -f '$(srcdir)/generated/pow_c4_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/pow_c4_i4.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pow_c4_i4.Tpo" "$(DEPDIR)/pow_c4_i4.Plo"; else rm -f "$(DEPDIR)/pow_c4_i4.Tpo"; exit 1; fi

View File

@ -526,16 +526,12 @@ GFORTRAN_1.0 {
_gfortran_pow_i8_i4;
_gfortran_pow_i8_i8;
_gfortran_pow_r10_i16;
_gfortran_pow_r10_i4;
_gfortran_pow_r10_i8;
_gfortran_pow_r16_i16;
_gfortran_pow_r16_i4;
_gfortran_pow_r16_i8;
_gfortran_pow_r4_i16;
_gfortran_pow_r4_i4;
_gfortran_pow_r4_i8;
_gfortran_pow_r8_i16;
_gfortran_pow_r8_i4;
_gfortran_pow_r8_i8;
_gfortran_product_c10;
_gfortran_product_c16;