From 63827fb8e293cd05bf33483f5d0fcc56d3f1f10f Mon Sep 17 00:00:00 2001 From: Ira Rosen Date: Sun, 26 Jul 2009 07:00:23 +0000 Subject: [PATCH] re PR tree-optimization/40801 (internal compiler error: in vect_get_vec_def_for_stmt_copy, at tree-vect-stmts.c:1096) PR tree-optimization/40801 * tree-vect-stmts.c (vectorizable_call): Get previous copy of vector operand from the previous copy of vector statement. Pass the correct definition type value to vect_get_vec_def_for_stmt_copy(). From-SVN: r150096 --- gcc/ChangeLog | 8 ++++ gcc/testsuite/ChangeLog | 7 ++++ .../vect/fast-math-real8-pr40801.f90 | 37 +++++++++++++++++++ gcc/testsuite/gfortran.dg/vect/vect.exp | 6 +++ gcc/tree-vect-stmts.c | 16 +++++--- 5 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/vect/fast-math-real8-pr40801.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96d4d9b0227..99028e8b1e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2009-07-26 Ira Rosen + + PR tree-optimization/40801 + * tree-vect-stmts.c (vectorizable_call): Get previous copy + of vector operand from the previous copy of vector statement. + Pass the correct definition type value to + vect_get_vec_def_for_stmt_copy(). + 2009-07-25 John David Anglin * collect2.c (scan_libraries): Use CONST_CAST2 to perform char ** to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0e39e379ab..6139e0dc0d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2009-07-26 Ira Rosen + + PR tree-optimization/40801 + * gfortran.dg/vect/fast-math-real8-pr40801.f90: New test. + * gfortran.dg/vect/vect.exp: Run tests starting with + "fast-math-real8" with -ffast-math and -fdefault-real-8. + 2009-07-25 David Daney PR rtl-optimization/40445 diff --git a/gcc/testsuite/gfortran.dg/vect/fast-math-real8-pr40801.f90 b/gcc/testsuite/gfortran.dg/vect/fast-math-real8-pr40801.f90 new file mode 100644 index 00000000000..eb6330def63 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/fast-math-real8-pr40801.f90 @@ -0,0 +1,37 @@ +! { dg-do compile } + +MODULE YOMPHY0 +REAL :: ECMNP +REAL :: SCO +REAL :: USDMLT +END MODULE YOMPHY0 +SUBROUTINE ACCONV ( KIDIA,KFDIA,KLON,KTDIA,KLEV,& + &CDLOCK) +USE YOMPHY0 , ONLY : ECMNP ,SCO ,USDMLT +REAL :: PAPHIF(KLON,KLEV),PCVGQ(KLON,KLEV)& + &,PFPLCL(KLON,0:KLEV),PFPLCN(KLON,0:KLEV),PSTRCU(KLON,0:KLEV)& + &,PSTRCV(KLON,0:KLEV) +INTEGER :: KNLAB(KLON,KLEV),KNND(KLON) +REAL :: ZCP(KLON,KLEV),ZLHE(KLON,KLEV),ZDSE(KLON,KLEV)& + &,ZPOII(KLON),ZALF(KLON),ZLN(KLON),ZUN(KLON),ZVN(KLON)& + &,ZPOIL(KLON) +DO JLEV=KLEV-1,KTDIA,-1 + DO JIT=1,NBITER + ZLN(JLON)=MAX(0.,ZLN(JLON)& + &-(ZQW(JLON,JLEV)-ZQN(JLON)& + &*(PQ(JLON,JLEV+1)-ZQN(JLON))))*KNLAB(JLON,JLEV) + ENDDO +ENDDO +IF (ITOP < KLEV+1) THEN + DO JLON=KIDIA,KFDIA + ZZVAL=PFPLCL(JLON,KLEV)+PFPLCN(JLON,KLEV)-SCO + KNND(JLON)=KNND(JLON)*MAX(0.,-SIGN(1.,0.-ZZVAL)) + ENDDO + DO JLEV=ITOP,KLEV + DO JLON=KIDIA,KFDIA + ENDDO + ENDDO +ENDIF +END SUBROUTINE ACCONV + +! { dg-final { cleanup-tree-dump "vect" } } diff --git a/gcc/testsuite/gfortran.dg/vect/vect.exp b/gcc/testsuite/gfortran.dg/vect/vect.exp index 00f5b00bb87..826b64d0045 100644 --- a/gcc/testsuite/gfortran.dg/vect/vect.exp +++ b/gcc/testsuite/gfortran.dg/vect/vect.exp @@ -125,6 +125,12 @@ lappend DEFAULT_VECTCFLAGS "-ffast-math" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[fF\]{,90,95,03,08} ]] \ "" $DEFAULT_VECTCFLAGS +# -ffast-math tests +set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS +lappend DEFAULT_VECTCFLAGS "-ffast-math" "-fdefault-real-8" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-real8*.\[fF\]{,90,95,03,08} ]] \ + "" $DEFAULT_VECTCFLAGS + # -fvect-cost-model tests set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS lappend DEFAULT_VECTCFLAGS "-fvect-cost-model" diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 8e1c973bba7..50900775a04 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -1227,7 +1227,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt) tree fndecl, new_temp, def, rhs_type, lhs_type; gimple def_stmt; enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type}; - gimple new_stmt; + gimple new_stmt = NULL; int ncopies, j; VEC(tree, heap) *vargs = NULL; enum { NARROW, NONE, WIDEN } modifier; @@ -1367,8 +1367,11 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt) vec_oprnd0 = vect_get_vec_def_for_operand (op, stmt, NULL); else - vec_oprnd0 - = vect_get_vec_def_for_stmt_copy (dt[nargs], vec_oprnd0); + { + vec_oprnd0 = gimple_call_arg (new_stmt, i); + vec_oprnd0 + = vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd0); + } VEC_quick_push (tree, vargs, vec_oprnd0); } @@ -1406,14 +1409,15 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt) vec_oprnd0 = vect_get_vec_def_for_operand (op, stmt, NULL); vec_oprnd1 - = vect_get_vec_def_for_stmt_copy (dt[nargs], vec_oprnd0); + = vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd0); } else { + vec_oprnd1 = gimple_call_arg (new_stmt, 2*i); vec_oprnd0 - = vect_get_vec_def_for_stmt_copy (dt[nargs], vec_oprnd1); + = vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd1); vec_oprnd1 - = vect_get_vec_def_for_stmt_copy (dt[nargs], vec_oprnd0); + = vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd0); } VEC_quick_push (tree, vargs, vec_oprnd0);