diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-02-06 21:44:56 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-02-06 21:44:56 +0000 |
commit | 3c0d801cdcce83e1739c42de0e26106281a61df9 (patch) | |
tree | a4bb1c0be4d5153898c2f02a7677e835473d9781 | |
parent | 7b919065100b9d5597126afce413f6caa6277704 (diff) | |
download | gcc-3c0d801cdcce83e1739c42de0e26106281a61df9.tar.gz |
2010-02-06 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 156556
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@156557 138bc75d-0d04-0410-961f-82ee72b054a4
59 files changed, 1732 insertions, 689 deletions
diff --git a/ChangeLog.MELT b/ChangeLog.MELT index 2f1fcbdd63b..f29a665bbf3 100644 --- a/ChangeLog.MELT +++ b/ChangeLog.MELT @@ -1,6 +1,10 @@ 2010-02-06 Basile Starynkevitch <basile@starynkevitch.net> + MELT branch merged with trunk rev 156556 + +2010-02-06 Basile Starynkevitch <basile@starynkevitch.net> + MELT branch merged with trunk rev 156526 2010-01-31 Basile Starynkevitch <basile@starynkevitch.net> diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be49d980c15..d1b5fd3ae87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2010-02-06 Richard Earnshaw <rearnsha@arm.com> + + PR target/42957 + * arm.c (arm_override_options): Just return if the user has specified + an invalid fpu name. + +2010-02-03 Jason Merrill <jason@redhat.com> + + PR c++/42870 + * config/i386/cygming.h (ASM_OUTPUT_DEF_FROM_DECLS): Call + i386_pe_maybe_record_exported_symbol. + 2010-02-05 Steve Ellcey <sje@cup.hp.com> PR target/42924 diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index c2bb01e07bd..5a6a919d345 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,174 @@ +2010-02-05 Sebastian Pop <sebastian.pop@amd.com> + Konrad Trifunovic <konrad.trifunovic@inria.fr> + + PR middle-end/42637 + * graphite-dependences.c (build_lexicographical_constraint): Return + a union of dependence polyhedra. + (dependence_polyhedron_1): Adapt for build_lexicographical_constraint. + + * testsuite/gcc.dg/graphite/block-0.c: Enable runtime check. XFAILed. + * testsuite/gcc.dg/graphite/block-4.c: Same. + * testsuite/gcc.dg/graphite/block-7.c: Same. + * testsuite/gcc.dg/graphite/interchange-12.c: Same. + * testsuite/gcc.dg/graphite/interchange-mvt.c: Same. + * testsuite/gfortran.dg/graphite/interchange-1.f: XFAILed. + * testsuite/gfortran.dg/graphite/interchange-3.f90: XFAILed. + * testsuite/gfortran.dg/graphite/run-id-1.f: New testcase for PR42637. + +2010-02-03 Sebastian Pop <sebastian.pop@amd.com> + + * testsuite/gcc.dg/graphite/interchange-12.c: Return 0 to avoid + the execution check to FAIL. This testcase is miscompiled by Graphite + and the check should be re-enabled. + * testsuite/gcc.dg/graphite/interchange-mvt.c: Same. + * testsuite/gcc.dg/graphite/block-0.c: Same. + * testsuite/gcc.dg/graphite/block-4.c: Same. + * testsuite/gcc.dg/graphite/block-7.c: Same. + +2010-02-03 Sebastian Pop <sebastian.pop@amd.com> + + * testsuite/gcc.dg/graphite/interchange-mvt.c: Un-XFAILed. + * testsuite/gcc.dg/graphite/scop-0.c: Fix spaces. + * testsuite/gfortran.dg/graphite/block-1.f90: Rewrite expected output. + * testsuite/gfortran.dg/graphite/block-2.f: Same. + * testsuite/gfortran.dg/graphite/block-3.f90: Same. + * testsuite/gfortran.dg/graphite/block-4.f90: Same. + * testsuite/gfortran.dg/graphite/interchange-1.f: Un-XFAILed. + * testsuite/gfortran.dg/graphite/interchange-3.f90: Un-XFAILed. + +2010-02-03 Sebastian Pop <sebastian.pop@amd.com> + + * graphite-dependences.c (new_poly_ddr): Initialize PDDR_KIND and + PDDR_ORIGINAL_SCATTERING_P. + (pddr_is_empty): Rewritten. + (print_dependence_polyhedron_layout): New. + (print_pddr): New. + (debug_pddr): New. + (build_alias_set_powerset): Moved up. + (poly_drs_may_alias_p): Moved up. + (lexicographically_gt_p): Removed. + (build_lexicographically_gt_constraint): Renamed + build_lexicographical_constraint, reimplemented. + (dependence_polyhedron_1): Simplified parameters. + (dependence_polyhedron): Same. Keep along empty PDDRs + to make efficient use of the cache. + (reduction_dr_p): Compute the PBBs don't pass them as parameters. + (graphite_legal_transform_dr): Rewritten. + (graphite_legal_transform_bb): Pass fewer arguments to + graphite_legal_transform_dr. + (graphite_carried_dependence_level_k): Simplified implementation. + (dot_original_deps_stmt_1): Call dependence_polyhedron. + (dot_transformed_deps_stmt_1): Same. + (dot_original_deps): Same. + (dot_transformed_deps): Same. + * graphite-dependences.h (struct poly_ddr): Added a new field + original_scattering_p. + (PDDR_ORIGINAL_SCATTERING_P): New. + (print_pddr): Declared. + (debug_pddr): Declared. + * graphite-ppl.c: Clarify comment. + * sese.h (print_gimple_bb): Removed unused declaration. + (debug_gbb): Same. + +2010-02-03 Sebastian Pop <sebastian.pop@amd.com> + + * testsuite/g++.dg/graphite/graphite.exp: Rewritten. + * testsuite/gcc.dg/graphite/graphite.exp: Rewritten. + * testsuite/gfortran.dg/graphite/graphite.exp: Rewritten. + * gcc/testsuite/gcc.dg/graphite/block-0.c: Added runtime test. + * testsuite/gcc.dg/graphite/block-1.c: Same. + * testsuite/gcc.dg/graphite/block-3.c: Same. + * testsuite/gcc.dg/graphite/block-4.c: Same. + * testsuite/gcc.dg/graphite/block-5.c: Same. + * testsuite/gcc.dg/graphite/block-6.c: Same. + * testsuite/gcc.dg/graphite/block-7.c: Same. + * testsuite/gcc.dg/graphite/interchange-0.c: Same. + * testsuite/gcc.dg/graphite/interchange-1.c: Same. + * testsuite/gcc.dg/graphite/interchange-10.c: Same. + * testsuite/gcc.dg/graphite/interchange-11.c: Same. + * testsuite/gcc.dg/graphite/interchange-12.c: Same. + * testsuite/gcc.dg/graphite/interchange-2.c: Same. + * testsuite/gcc.dg/graphite/interchange-3.c: Same. + * testsuite/gcc.dg/graphite/interchange-4.c: Same. + * testsuite/gcc.dg/graphite/interchange-5.c: Same. + * testsuite/gcc.dg/graphite/interchange-6.c: Same. + * testsuite/gcc.dg/graphite/interchange-7.c: Same. + * testsuite/gcc.dg/graphite/interchange-8.c: Same. + * testsuite/gcc.dg/graphite/interchange-9.c: Same. + * testsuite/gcc.dg/graphite/interchange-mvt.c: Same. + * testsuite/gcc.dg/graphite/run-id-2.c: Remove useless dg-do run. + +2010-01-22 Ramakrishna Upadrasta <Ramakrishna.Upadrasta@inria.fr> + + * graphite-scop-detection.c (dot_all_scops): Make calls to dot run in + background. + +2010-01-22 Ramakrishna Upadrasta <Ramakrishna.Upadrasta@inria.fr> + + * common.opt: Add -fgraphite-cloog-opts. + * graphite-clast-to-gimple.c (set_cloog_options): Same. + * opts.c (decode_options): Same. + +2010-01-20 Sebastian Pop <sebastian.pop@amd.com> + + * testsuite/gcc.dg/graphite/id-17.c: New. + * testsuite/gcc.dg/graphite/pr41888.c: New. + * testsuite/gcc.dg/graphite/scop-22.c: New. + * testsuite/gfortran.dg/graphite/pr40982.f90: New. + +2010-01-20 Sebastian Pop <sebastian.pop@amd.com> + + * graphite-dependences.c: Clarify comments. + (build_pddr): Add an extra parameter direction. + (graphite_legal_transform_dr): Use build_pddr. + (dot_original_deps_stmt_1): Update use of build_pddr. + (dot_transformed_deps_stmt_1): Same. + (dot_original_deps): Same. + (dot_transformed_deps): Same. + + * testsuite/gcc.dg/graphite/interchange-12.c: New. + * testsuite/gcc.dg/graphite/block-7.c: New. + +2010-01-20 Sebastian Pop <sebastian.pop@amd.com> + + * graphite-dependences.c (pddr_original_scattering): Renamed build_pddr. + (pddr_transformed_scattering): Removed. + (graphite_legal_transform_dr): Use build_pddr. + (dot_original_deps_stmt_1): Same. + (dot_transformed_deps_stmt_1): Same. + (dot_original_deps): Same. + (dot_transformed_deps): Same. + +2010-01-20 Sebastian Pop <sebastian.pop@amd.com> + + * graphite-dependences.c (lexicographically_gt_p): Add comments. + (build_lexicographically_gt_constraint): Same. + (dependence_polyhedron_1): Same. + (dependence_polyhedron): Same. + +2010-01-20 Sebastian Pop <sebastian.pop@amd.com> + + * graphite-dependences.c (build_pairwise_scheduling_equality): Removed. + (build_pairwise_scheduling_inequality): Renamed build_pairwise_scheduling. + (lexicographically_gt_p): Change type of direction to int. + (build_lexicographically_gt_constraint): Same. + (dependence_polyhedron_1): Same. + (dependence_polyhedron): Same. + (pddr_original_scattering): Use integers for direction. + (pddr_transformed_scattering): Same. + (graphite_legal_transform_dr): Same. + (graphite_carried_dependence_level_k): Same. + +2010-01-20 Sebastian Pop <sebastian.pop@amd.com> + + * graphite-dependences.c (build_pairwise_constraint): Renamed + ppl_build_relation. Moved... + (dr_equality_constraints): Use ppl_build_relation. + (build_pairwise_scheduling_equality): Same. + (build_pairwise_scheduling_inequality): Same. + * graphite-ppl.c (ppl_build_relation): ...here. + * graphite-ppl.h (ppl_build_relation): Declared. + 2010-01-14 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/42681 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 74ffb931990..d5e9a55b522 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20100205 +20100206 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 543498ea82a..466981a7e7b 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1639,8 +1639,12 @@ arm_override_options (void) break; } } + if (!arm_fpu_desc) - error ("invalid floating point option: -mfpu=%s", target_fpu_name); + { + error ("invalid floating point option: -mfpu=%s", target_fpu_name); + return; + } switch (arm_fpu_desc->model) { diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index ddec95a36fc..54a61d7a1bc 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -361,6 +361,7 @@ do { \ { \ const char *alias \ = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ + i386_pe_maybe_record_exported_symbol (DECL, alias, 0); \ if (TREE_CODE (DECL) == FUNCTION_DECL) \ i386_pe_declare_function_type (STREAM, alias, \ TREE_PUBLIC (DECL)); \ diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index b77de084a5b..4dc5854b3f9 100644 --- a/gcc/graphite-dependences.c +++ b/gcc/graphite-dependences.c @@ -51,20 +51,26 @@ along with GCC; see the file COPYING3. If not see #include "graphite-dependences.h" /* Returns a new polyhedral Data Dependence Relation (DDR). SOURCE is - the source data reference, SINK is the sink data reference. SOURCE - and SINK define an edge in the Data Dependence Graph (DDG). */ + the source data reference, SINK is the sink data reference. When + the Data Dependence Polyhedron DDP is not NULL or not empty, SOURCE + and SINK are in dependence as described by DDP. */ static poly_ddr_p new_poly_ddr (poly_dr_p source, poly_dr_p sink, - ppl_Pointset_Powerset_C_Polyhedron_t ddp) + ppl_Pointset_Powerset_C_Polyhedron_t ddp, + bool original_scattering_p) { - poly_ddr_p pddr; + poly_ddr_p pddr = XNEW (struct poly_ddr); - pddr = XNEW (struct poly_ddr); PDDR_SOURCE (pddr) = source; PDDR_SINK (pddr) = sink; PDDR_DDP (pddr) = ddp; - PDDR_KIND (pddr) = unknown_dependence; + PDDR_ORIGINAL_SCATTERING_P (pddr) = original_scattering_p; + + if (!ddp || ppl_Pointset_Powerset_C_Polyhedron_is_empty (ddp)) + PDDR_KIND (pddr) = no_dependence; + else + PDDR_KIND (pddr) = has_dependence; return pddr; } @@ -106,17 +112,161 @@ hash_poly_ddr_p (const void *pddr) static bool pddr_is_empty (poly_ddr_p pddr) { - if (PDDR_KIND (pddr) != unknown_dependence) - return PDDR_KIND (pddr) == no_dependence ? true : false; + if (!pddr) + return true; + + gcc_assert (PDDR_KIND (pddr) != unknown_dependence); + + return PDDR_KIND (pddr) == no_dependence ? true : false; +} + +/* Prints to FILE the layout of the dependence polyhedron of PDDR: + + T1|I1|T2|I2|S1|S2|G + + with + | T1 and T2 the scattering dimensions for PDDR_SOURCE and PDDR_SINK + | I1 and I2 the iteration domains + | S1 and S2 the subscripts + | G the global parameters. */ + +static void +print_dependence_polyhedron_layout (FILE *file, poly_ddr_p pddr) +{ + poly_dr_p pdr1 = PDDR_SOURCE (pddr); + poly_dr_p pdr2 = PDDR_SINK (pddr); + poly_bb_p pbb1 = PDR_PBB (pdr1); + poly_bb_p pbb2 = PDR_PBB (pdr2); + + graphite_dim_t i; + graphite_dim_t tdim1 = PDDR_ORIGINAL_SCATTERING_P (pddr) ? + pbb_nb_scattering_orig (pbb1) : pbb_nb_scattering_transform (pbb1); + graphite_dim_t tdim2 = PDDR_ORIGINAL_SCATTERING_P (pddr) ? + pbb_nb_scattering_orig (pbb2) : pbb_nb_scattering_transform (pbb2); + graphite_dim_t idim1 = pbb_dim_iter_domain (pbb1); + graphite_dim_t idim2 = pbb_dim_iter_domain (pbb2); + graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1; + graphite_dim_t sdim2 = PDR_NB_SUBSCRIPTS (pdr2) + 1; + graphite_dim_t gdim = scop_nb_params (PBB_SCOP (pbb1)); + + fprintf (file, "# eq"); + + for (i = 0; i < tdim1; i++) + fprintf (file, " t1_%d", (int) i); + for (i = 0; i < idim1; i++) + fprintf (file, " i1_%d", (int) i); + for (i = 0; i < tdim2; i++) + fprintf (file, " t2_%d", (int) i); + for (i = 0; i < idim2; i++) + fprintf (file, " i2_%d", (int) i); + for (i = 0; i < sdim1; i++) + fprintf (file, " s1_%d", (int) i); + for (i = 0; i < sdim2; i++) + fprintf (file, " s2_%d", (int) i); + for (i = 0; i < gdim; i++) + fprintf (file, " g_%d", (int) i); + + fprintf (file, " cst\n"); +} + +/* Prints to FILE the poly_ddr_p PDDR. */ + +void +print_pddr (FILE *file, poly_ddr_p pddr) +{ + fprintf (file, "pddr (kind: "); + + if (PDDR_KIND (pddr) == unknown_dependence) + fprintf (file, "unknown_dependence"); + else if (PDDR_KIND (pddr) == no_dependence) + fprintf (file, "no_dependence"); + else if (PDDR_KIND (pddr) == has_dependence) + fprintf (file, "has_dependence"); + + fprintf (file, "\n source "); + print_pdr (file, PDDR_SOURCE (pddr)); - if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (PDDR_DDP (pddr))) + fprintf (file, "\n sink "); + print_pdr (file, PDDR_SINK (pddr)); + + if (PDDR_KIND (pddr) == has_dependence) { - PDDR_KIND (pddr) = no_dependence; - return true; + fprintf (file, "\n dependence polyhedron (\n"); + print_dependence_polyhedron_layout (file, pddr); + ppl_print_powerset_matrix (file, PDDR_DDP (pddr)); + fprintf (file, ")\n"); } - PDDR_KIND (pddr) = has_dependence; - return false; + fprintf (file, ")\n"); +} + +/* Prints to STDERR the poly_ddr_p PDDR. */ + +void +debug_pddr (poly_ddr_p pddr) +{ + print_pddr (stderr, pddr); +} + + +/* Remove all the dimensions except alias information at dimension + ALIAS_DIM. */ + +static void +build_alias_set_powerset (ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset, + ppl_dimension_type alias_dim) +{ + ppl_dimension_type *ds; + ppl_dimension_type access_dim; + unsigned i, pos = 0; + + ppl_Pointset_Powerset_C_Polyhedron_space_dimension (alias_powerset, + &access_dim); + ds = XNEWVEC (ppl_dimension_type, access_dim-1); + for (i = 0; i < access_dim; i++) + { + if (i == alias_dim) + continue; + + ds[pos] = i; + pos++; + } + + ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions (alias_powerset, + ds, + access_dim - 1); + free (ds); +} + +/* Return true when PDR1 and PDR2 may alias. */ + +static bool +poly_drs_may_alias_p (poly_dr_p pdr1, poly_dr_p pdr2) +{ + ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset1, alias_powerset2; + ppl_Pointset_Powerset_C_Polyhedron_t accesses1 = PDR_ACCESSES (pdr1); + ppl_Pointset_Powerset_C_Polyhedron_t accesses2 = PDR_ACCESSES (pdr2); + ppl_dimension_type alias_dim1 = pdr_alias_set_dim (pdr1); + ppl_dimension_type alias_dim2 = pdr_alias_set_dim (pdr2); + int empty_p; + + ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron + (&alias_powerset1, accesses1); + ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron + (&alias_powerset2, accesses2); + + build_alias_set_powerset (alias_powerset1, alias_dim1); + build_alias_set_powerset (alias_powerset2, alias_dim2); + + ppl_Pointset_Powerset_C_Polyhedron_intersection_assign + (alias_powerset1, alias_powerset2); + + empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (alias_powerset1); + + ppl_delete_Pointset_Powerset_C_Polyhedron (alias_powerset1); + ppl_delete_Pointset_Powerset_C_Polyhedron (alias_powerset2); + + return !empty_p; } /* Returns a polyhedron of dimension DIM. @@ -190,101 +340,42 @@ map_dr_into_dep_poly (graphite_dim_t dim, return res; } -/* Builds a constraints of the form "POS1 - POS2 CSTR_TYPE C" */ - -static ppl_Constraint_t -build_pairwise_constraint (graphite_dim_t dim, - graphite_dim_t pos1, graphite_dim_t pos2, - int c, enum ppl_enum_Constraint_Type cstr_type) -{ - ppl_Linear_Expression_t expr; - ppl_Constraint_t cstr; - ppl_Coefficient_t coef; - Value v, v_op, v_c; - - value_init (v); - value_init (v_op); - value_init (v_c); - - value_set_si (v, 1); - value_set_si (v_op, -1); - value_set_si (v_c, c); - - ppl_new_Coefficient (&coef); - ppl_new_Linear_Expression_with_dimension (&expr, dim); - - ppl_assign_Coefficient_from_mpz_t (coef, v); - ppl_Linear_Expression_add_to_coefficient (expr, pos1, coef); - ppl_assign_Coefficient_from_mpz_t (coef, v_op); - ppl_Linear_Expression_add_to_coefficient (expr, pos2, coef); - ppl_assign_Coefficient_from_mpz_t (coef, v_c); - ppl_Linear_Expression_add_to_inhomogeneous (expr, coef); - - ppl_new_Constraint (&cstr, expr, cstr_type); - - ppl_delete_Linear_Expression (expr); - ppl_delete_Coefficient (coef); - value_clear (v); - value_clear (v_op); - value_clear (v_c); - - return cstr; -} - /* Builds subscript equality constraints. */ static ppl_Pointset_Powerset_C_Polyhedron_t dr_equality_constraints (graphite_dim_t dim, graphite_dim_t pos, graphite_dim_t nb_subscripts) { - ppl_Polyhedron_t subscript_equalities; + ppl_Polyhedron_t eqs; ppl_Pointset_Powerset_C_Polyhedron_t res; - Value v, v_op; graphite_dim_t i; - value_init (v); - value_init (v_op); - value_set_si (v, 1); - value_set_si (v_op, -1); + ppl_new_C_Polyhedron_from_space_dimension (&eqs, dim, 0); - ppl_new_C_Polyhedron_from_space_dimension (&subscript_equalities, dim, 0); for (i = 0; i < nb_subscripts; i++) { - ppl_Linear_Expression_t expr; - ppl_Constraint_t cstr; - ppl_Coefficient_t coef; - - ppl_new_Coefficient (&coef); - ppl_new_Linear_Expression_with_dimension (&expr, dim); - - ppl_assign_Coefficient_from_mpz_t (coef, v); - ppl_Linear_Expression_add_to_coefficient (expr, pos + i, coef); - ppl_assign_Coefficient_from_mpz_t (coef, v_op); - ppl_Linear_Expression_add_to_coefficient (expr, pos + i + nb_subscripts, - coef); - - ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Polyhedron_add_constraint (subscript_equalities, cstr); - - ppl_delete_Linear_Expression (expr); + ppl_Constraint_t cstr + = ppl_build_relation (dim, pos + i, pos + i + nb_subscripts, + 0, PPL_CONSTRAINT_TYPE_EQUAL); + ppl_Polyhedron_add_constraint (eqs, cstr); ppl_delete_Constraint (cstr); - ppl_delete_Coefficient (coef); } - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (&res, subscript_equalities); - value_clear (v); - value_clear (v_op); - ppl_delete_Polyhedron (subscript_equalities); - + ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&res, eqs); + ppl_delete_Polyhedron (eqs); return res; } -/* Builds scheduling equality constraints. */ +/* Builds scheduling inequality constraints: when DIRECTION is + 1 builds a GE constraint, + 0 builds an EQ constraint, + -1 builds a LE constraint. */ static ppl_Pointset_Powerset_C_Polyhedron_t -build_pairwise_scheduling_equality (graphite_dim_t dim, - graphite_dim_t pos, graphite_dim_t offset) +build_pairwise_scheduling (graphite_dim_t dim, + graphite_dim_t pos, + graphite_dim_t offset, + int direction) { ppl_Pointset_Powerset_C_Polyhedron_t res; ppl_Polyhedron_t equalities; @@ -292,36 +383,26 @@ build_pairwise_scheduling_equality (graphite_dim_t dim, ppl_new_C_Polyhedron_from_space_dimension (&equalities, dim, 0); - cstr = build_pairwise_constraint (dim, pos, pos + offset, 0, - PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Polyhedron_add_constraint (equalities, cstr); - ppl_delete_Constraint (cstr); - - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&res, equalities); - ppl_delete_Polyhedron (equalities); - return res; -} - -/* Builds scheduling inequality constraints. */ + switch (direction) + { + case -1: + cstr = ppl_build_relation (dim, pos, pos + offset, 1, + PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL); + break; -static ppl_Pointset_Powerset_C_Polyhedron_t -build_pairwise_scheduling_inequality (graphite_dim_t dim, - graphite_dim_t pos, - graphite_dim_t offset, - bool direction) -{ - ppl_Pointset_Powerset_C_Polyhedron_t res; - ppl_Polyhedron_t equalities; - ppl_Constraint_t cstr; + case 0: + cstr = ppl_build_relation (dim, pos, pos + offset, 0, + PPL_CONSTRAINT_TYPE_EQUAL); + break; - ppl_new_C_Polyhedron_from_space_dimension (&equalities, dim, 0); + case 1: + cstr = ppl_build_relation (dim, pos, pos + offset, -1, + PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); + break; - if (direction) - cstr = build_pairwise_constraint (dim, pos, pos + offset, -1, - PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - else - cstr = build_pairwise_constraint (dim, pos, pos + offset, 1, - PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL); + default: + gcc_unreachable (); + } ppl_Polyhedron_add_constraint (equalities, cstr); ppl_delete_Constraint (cstr); @@ -331,61 +412,56 @@ build_pairwise_scheduling_inequality (graphite_dim_t dim, return res; } -/* Returns true when adding the lexicographical constraints at level I - to the RES dependence polyhedron returns an empty polyhedron. */ +/* Add to a non empty polyhedron BAG the precedence constraints for + the lexicographical comparison of time vectors in BAG following the + lexicographical order. DIM is the dimension of the polyhedron BAG. + TDIM is the number of loops common to the two statements that are + compared lexicographically, i.e. the number of loops containing + both statements. OFFSET is the number of dimensions needed to + represent the first statement, i.e. dimT1 + dimI1 in the layout of + the BAG polyhedron: T1|I1|T2|I2|S1|S2|G. When DIRECTION is set to + 1, compute the direct dependence from PDR1 to PDR2, and when + DIRECTION is -1, compute the reversed dependence relation, from + PDR2 to PDR1. */ -static bool -lexicographically_gt_p (ppl_Pointset_Powerset_C_Polyhedron_t res, - graphite_dim_t dim, - graphite_dim_t offset, - bool direction, graphite_dim_t i) +static ppl_Pointset_Powerset_C_Polyhedron_t +build_lexicographical_constraint (ppl_Pointset_Powerset_C_Polyhedron_t bag, + graphite_dim_t dim, + graphite_dim_t tdim, + graphite_dim_t offset, + int direction) { - ppl_Pointset_Powerset_C_Polyhedron_t ineq; - bool empty_p; + graphite_dim_t i; + ppl_Pointset_Powerset_C_Polyhedron_t res, lex; - ineq = build_pairwise_scheduling_inequality (dim, i, offset, - direction); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (ineq, res); - empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (ineq); - if (!empty_p) - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, ineq); - ppl_delete_Pointset_Powerset_C_Polyhedron (ineq); + ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&res, dim, 1); - return !empty_p; -} + lex = build_pairwise_scheduling (dim, 0, offset, direction); + ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (lex, bag); -/* Build the precedence constraints for the lexicographical comparison - of time vectors RES following the lexicographical order. */ + if (!ppl_Pointset_Powerset_C_Polyhedron_is_empty (lex)) + ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (res, lex); -static void -build_lexicographically_gt_constraint (ppl_Pointset_Powerset_C_Polyhedron_t *res, - graphite_dim_t dim, - graphite_dim_t tdim1, - graphite_dim_t offset, - bool direction) -{ - graphite_dim_t i; - - if (lexicographically_gt_p (*res, dim, offset, direction, 0)) - return; + ppl_delete_Pointset_Powerset_C_Polyhedron (lex); - for (i = 0; i < tdim1 - 1; i++) + for (i = 0; i < tdim - 1; i++) { ppl_Pointset_Powerset_C_Polyhedron_t sceq; - sceq = build_pairwise_scheduling_equality (dim, i, offset); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (*res, sceq); + sceq = build_pairwise_scheduling (dim, i, offset, 0); + ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (bag, sceq); ppl_delete_Pointset_Powerset_C_Polyhedron (sceq); - if (lexicographically_gt_p (*res, dim, offset, direction, i + 1)) - return; - } + lex = build_pairwise_scheduling (dim, i + 1, offset, direction); + ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (lex, bag); - if (i == tdim1 - 1) - { - ppl_delete_Pointset_Powerset_C_Polyhedron (*res); - ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (res, dim, 1); + if (!ppl_Pointset_Powerset_C_Polyhedron_is_empty (lex)) + ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (res, lex); + + ppl_delete_Pointset_Powerset_C_Polyhedron (lex); } + + return res; } /* Build the dependence polyhedron for data references PDR1 and PDR2. @@ -397,22 +473,29 @@ build_lexicographically_gt_constraint (ppl_Pointset_Powerset_C_Polyhedron_t *res | T1 and T2 the scattering dimensions for PDR1 and PDR2 | I1 and I2 the iteration domains | S1 and S2 the subscripts - | G the global parameters. */ + | G the global parameters. -static poly_ddr_p -dependence_polyhedron_1 (poly_bb_p pbb1, poly_bb_p pbb2, - ppl_Pointset_Powerset_C_Polyhedron_t d1, - ppl_Pointset_Powerset_C_Polyhedron_t d2, - poly_dr_p pdr1, poly_dr_p pdr2, - ppl_Polyhedron_t s1, ppl_Polyhedron_t s2, - bool direction, - bool original_scattering_p) + When DIRECTION is set to 1, compute the direct dependence from PDR1 + to PDR2, and when DIRECTION is -1, compute the reversed dependence + relation, from PDR2 to PDR1. */ + +static ppl_Pointset_Powerset_C_Polyhedron_t +dependence_polyhedron_1 (poly_dr_p pdr1, poly_dr_p pdr2, + int direction, bool original_scattering_p) { + poly_bb_p pbb1 = PDR_PBB (pdr1); + poly_bb_p pbb2 = PDR_PBB (pdr2); scop_p scop = PBB_SCOP (pbb1); + ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1); + ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2); graphite_dim_t tdim1 = original_scattering_p ? pbb_nb_scattering_orig (pbb1) : pbb_nb_scattering_transform (pbb1); graphite_dim_t tdim2 = original_scattering_p ? pbb_nb_scattering_orig (pbb2) : pbb_nb_scattering_transform (pbb2); + ppl_Polyhedron_t scat1 = original_scattering_p ? + PBB_ORIGINAL_SCATTERING (pbb1) : PBB_TRANSFORMED_SCATTERING (pbb1); + ppl_Polyhedron_t scat2 = original_scattering_p ? + PBB_ORIGINAL_SCATTERING (pbb2) : PBB_TRANSFORMED_SCATTERING (pbb2); graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb1); graphite_dim_t ddim2 = pbb_dim_iter_domain (pbb2); graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1; @@ -431,8 +514,8 @@ dependence_polyhedron_1 (poly_bb_p pbb1, poly_bb_p pbb2, (&context, SCOP_CONTEXT (scop)); ppl_insert_dimensions_pointset (context, 0, dim - gdim); - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sc1, s1); - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sc2, s2); + ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sc1, scat1); + ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sc2, scat2); id1 = map_into_dep_poly (dim, gdim, d1, ddim1, tdim1); id2 = map_into_dep_poly (dim, gdim, d2, ddim2, tdim1 + ddim1 + tdim2); @@ -468,107 +551,64 @@ dependence_polyhedron_1 (poly_bb_p pbb1, poly_bb_p pbb2, ppl_delete_Pointset_Powerset_C_Polyhedron (dreq); if (!ppl_Pointset_Powerset_C_Polyhedron_is_empty (res)) - build_lexicographically_gt_constraint (&res, dim, MIN (tdim1, tdim2), - tdim1 + ddim1, direction); + { + ppl_Pointset_Powerset_C_Polyhedron_t lex = + build_lexicographical_constraint (res, dim, MIN (tdim1, tdim2), + tdim1 + ddim1, direction); + ppl_delete_Pointset_Powerset_C_Polyhedron (res); + res = lex; + } - return new_poly_ddr (pdr1, pdr2, res); + return res; } /* Build the dependence polyhedron for data references PDR1 and PDR2. - If possible use already cached information. */ + If possible use already cached information. + + When DIRECTION is set to 1, compute the direct dependence from PDR1 + to PDR2, and when DIRECTION is -1, compute the reversed dependence + relation, from PDR2 to PDR1. */ static poly_ddr_p -dependence_polyhedron (poly_bb_p pbb1, poly_bb_p pbb2, - ppl_Pointset_Powerset_C_Polyhedron_t d1, - ppl_Pointset_Powerset_C_Polyhedron_t d2, - poly_dr_p pdr1, poly_dr_p pdr2, - ppl_Polyhedron_t s1, ppl_Polyhedron_t s2, - bool direction, - bool original_scattering_p) +dependence_polyhedron (poly_dr_p pdr1, poly_dr_p pdr2, + int direction, bool original_scattering_p) { PTR *x = NULL; poly_ddr_p res; + ppl_Pointset_Powerset_C_Polyhedron_t ddp; + /* Return the PDDR from the cache if it already has been computed. */ if (original_scattering_p) { struct poly_ddr tmp; + scop_p scop = PBB_SCOP (PDR_PBB (pdr1)); tmp.source = pdr1; tmp.sink = pdr2; - x = htab_find_slot (SCOP_ORIGINAL_PDDRS (PBB_SCOP (pbb1)), + x = htab_find_slot (SCOP_ORIGINAL_PDDRS (scop), &tmp, INSERT); if (x && *x) return (poly_ddr_p) *x; } - res = dependence_polyhedron_1 (pbb1, pbb2, d1, d2, pdr1, pdr2, - s1, s2, direction, original_scattering_p); - - if (original_scattering_p) - *x = res; - - return res; -} - -static bool -poly_drs_may_alias_p (poly_dr_p pdr1, poly_dr_p pdr2); - -/* Returns the PDDR corresponding to the original schedule, or NULL if - the dependence relation is empty or unknown (cannot judge dependency - under polyhedral model). */ - -static poly_ddr_p -pddr_original_scattering (poly_bb_p pbb1, poly_bb_p pbb2, - poly_dr_p pdr1, poly_dr_p pdr2) -{ - poly_ddr_p pddr; - ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1); - ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2); - ppl_Polyhedron_t so1 = PBB_ORIGINAL_SCATTERING (pbb1); - ppl_Polyhedron_t so2 = PBB_ORIGINAL_SCATTERING (pbb2); - if ((pdr_read_p (pdr1) && pdr_read_p (pdr2)) || PDR_BASE_OBJECT_SET (pdr1) != PDR_BASE_OBJECT_SET (pdr2) - || PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2)) - return NULL; - - pddr = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, so1, so2, - true, true); - if (pddr_is_empty (pddr)) - return NULL; - - return pddr; -} - -/* Returns the PDDR corresponding to the transformed schedule, or NULL if - the dependence relation is empty or unknown (cannot judge dependency - under polyhedral model). */ - -static poly_ddr_p -pddr_transformed_scattering (poly_bb_p pbb1, poly_bb_p pbb2, - poly_dr_p pdr1, poly_dr_p pdr2) -{ - poly_ddr_p pddr; - ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1); - ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2); - ppl_Polyhedron_t st1 = PBB_ORIGINAL_SCATTERING (pbb1); - ppl_Polyhedron_t st2 = PBB_ORIGINAL_SCATTERING (pbb2); + || PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2) + || !poly_drs_may_alias_p (pdr1, pdr2)) + ddp = NULL; + else + ddp = dependence_polyhedron_1 (pdr1, pdr2, direction, + original_scattering_p); - if ((pdr_read_p (pdr1) && pdr_read_p (pdr2)) - || PDR_BASE_OBJECT_SET (pdr1) != PDR_BASE_OBJECT_SET (pdr2) - || PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2)) - return NULL; + res = new_poly_ddr (pdr1, pdr2, ddp, original_scattering_p); - pddr = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, st1, st2, - true, false); - if (pddr_is_empty (pddr)) - return NULL; + if (original_scattering_p) + *x = res; - return pddr; + return res; } - /* Return true when the data dependence relation between the data references PDR1 belonging to PBB1 and PDR2 is part of a reduction. */ @@ -591,9 +631,11 @@ reduction_dr_1 (poly_bb_p pbb1, poly_dr_p pdr1, poly_dr_p pdr2) part of a reduction. */ static inline bool -reduction_dr_p (poly_bb_p pbb1, poly_bb_p pbb2, - poly_dr_p pdr1, poly_dr_p pdr2) +reduction_dr_p (poly_dr_p pdr1, poly_dr_p pdr2) { + poly_bb_p pbb1 = PDR_PBB (pdr1); + poly_bb_p pbb2 = PDR_PBB (pdr2); + if (PBB_IS_REDUCTION (pbb1)) return reduction_dr_1 (pbb1, pdr1, pdr2); @@ -608,61 +650,71 @@ reduction_dr_p (poly_bb_p pbb1, poly_bb_p pbb2, functions. */ static bool -graphite_legal_transform_dr (poly_bb_p pbb1, poly_bb_p pbb2, - poly_dr_p pdr1, poly_dr_p pdr2) +graphite_legal_transform_dr (poly_dr_p pdr1, poly_dr_p pdr2) { - ppl_Polyhedron_t st1, st2; ppl_Pointset_Powerset_C_Polyhedron_t po, pt; graphite_dim_t ddim1, otdim1, otdim2, ttdim1, ttdim2; - ppl_Pointset_Powerset_C_Polyhedron_t temp; + ppl_Pointset_Powerset_C_Polyhedron_t po_temp; ppl_dimension_type pdim; bool is_empty_p; - poly_ddr_p pddr; - ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1); - ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2); + poly_ddr_p opddr, tpddr; + poly_bb_p pbb1, pbb2; - if (reduction_dr_p (pbb1, pbb2, pdr1, pdr2)) + if (reduction_dr_p (pdr1, pdr2)) return true; - pddr = pddr_original_scattering (pbb1, pbb2, pdr1, pdr2); - if (!pddr) + /* We build the reverse dependence relation for the transformed + scattering, such that when we intersect it with the original PO, + we get an empty intersection when the transform is legal: + i.e. the transform should reverse no dependences, and so PT, the + reversed transformed PDDR, should have no constraint from PO. */ + opddr = dependence_polyhedron (pdr1, pdr2, 1, true); + tpddr = dependence_polyhedron (pdr1, pdr2, -1, false); + + /* There are no dependences between PDR1 and PDR2 in the original + version of the program, or after the transform, so the + transform is legal. */ + if (pddr_is_empty (opddr)) return true; - po = PDDR_DDP (pddr); + if (pddr_is_empty (tpddr)) + { + free_poly_ddr (tpddr); + return true; + } - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "\nloop carries dependency.\n"); + po = PDDR_DDP (opddr); + pt = PDDR_DDP (tpddr); - st1 = PBB_TRANSFORMED_SCATTERING (pbb1); - st2 = PBB_TRANSFORMED_SCATTERING (pbb2); + /* Copy PO into PO_TEMP, such that PO is not destroyed. PO is + stored in a cache and should not be modified or freed. */ + ppl_Pointset_Powerset_C_Polyhedron_space_dimension (po, &pdim); + ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&po_temp, + pdim, 0); + ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (po_temp, po); + + /* Extend PO and PT to have the same dimensions. */ + pbb1 = PDR_PBB (pdr1); + pbb2 = PDR_PBB (pdr2); ddim1 = pbb_dim_iter_domain (pbb1); otdim1 = pbb_nb_scattering_orig (pbb1); otdim2 = pbb_nb_scattering_orig (pbb2); ttdim1 = pbb_nb_scattering_transform (pbb1); ttdim2 = pbb_nb_scattering_transform (pbb2); - - /* Copy the PO polyhedron into the TEMP, so it is not destroyed. - Keep in mind, that PO polyhedron might be restored from the cache - and should not be modified! */ - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (po, &pdim); - ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&temp, pdim, 0); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (temp, po); - - pddr = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, st1, st2, - false, false); - pt = PDDR_DDP (pddr); - - /* Extend PO and PT to have the same dimensions. */ - ppl_insert_dimensions_pointset (temp, otdim1, ttdim1); - ppl_insert_dimensions_pointset (temp, otdim1 + ttdim1 + ddim1 + otdim2, ttdim2); + ppl_insert_dimensions_pointset (po_temp, otdim1, ttdim1); + ppl_insert_dimensions_pointset (po_temp, otdim1 + ttdim1 + ddim1 + otdim2, + ttdim2); ppl_insert_dimensions_pointset (pt, 0, otdim1); ppl_insert_dimensions_pointset (pt, otdim1 + ttdim1 + ddim1, otdim2); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (temp, pt); - is_empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (temp); + ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (po_temp, pt); + is_empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (po_temp); - ppl_delete_Pointset_Powerset_C_Polyhedron (temp); - free_poly_ddr (pddr); + ppl_delete_Pointset_Powerset_C_Polyhedron (po_temp); + free_poly_ddr (tpddr); + + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "\nloop carries dependency.\n"); return is_empty_p; } @@ -696,7 +748,7 @@ graphite_legal_transform_bb (poly_bb_p pbb1, poly_bb_p pbb2) for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), i, pdr1); i++) for (j = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), j, pdr2); j++) - if (!graphite_legal_transform_dr (pbb1, pbb2, pdr1, pdr2)) + if (!graphite_legal_transform_dr (pdr1, pdr2)) return false; return true; @@ -725,66 +777,6 @@ graphite_legal_transform (scop_p scop) return true; } -/* Remove all the dimensions except alias information at dimension - ALIAS_DIM. */ - -static void -build_alias_set_powerset (ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset, - ppl_dimension_type alias_dim) -{ - ppl_dimension_type *ds; - ppl_dimension_type access_dim; - unsigned i, pos = 0; - - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (alias_powerset, - &access_dim); - ds = XNEWVEC (ppl_dimension_type, access_dim-1); - for (i = 0; i < access_dim; i++) - { - if (i == alias_dim) - continue; - - ds[pos] = i; - pos++; - } - - ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions (alias_powerset, - ds, - access_dim - 1); - free (ds); -} - -/* Return true when PDR1 and PDR2 may alias. */ - -static bool -poly_drs_may_alias_p (poly_dr_p pdr1, poly_dr_p pdr2) -{ - ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset1, alias_powerset2; - ppl_Pointset_Powerset_C_Polyhedron_t accesses1 = PDR_ACCESSES (pdr1); - ppl_Pointset_Powerset_C_Polyhedron_t accesses2 = PDR_ACCESSES (pdr2); - ppl_dimension_type alias_dim1 = pdr_alias_set_dim (pdr1); - ppl_dimension_type alias_dim2 = pdr_alias_set_dim (pdr2); - int empty_p; - - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&alias_powerset1, accesses1); - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&alias_powerset2, accesses2); - - build_alias_set_powerset (alias_powerset1, alias_dim1); - build_alias_set_powerset (alias_powerset2, alias_dim2); - - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign - (alias_powerset1, alias_powerset2); - - empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (alias_powerset1); - - ppl_delete_Pointset_Powerset_C_Polyhedron (alias_powerset1); - ppl_delete_Pointset_Powerset_C_Polyhedron (alias_powerset2); - - return !empty_p; -} - /* Returns TRUE when the dependence polyhedron between PDR1 and PDR2 represents a loop carried dependence at level LEVEL. */ @@ -792,46 +784,30 @@ static bool graphite_carried_dependence_level_k (poly_dr_p pdr1, poly_dr_p pdr2, int level) { - poly_bb_p pbb1 = PDR_PBB (pdr1); - poly_bb_p pbb2 = PDR_PBB (pdr2); - ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1); - ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2); - ppl_Polyhedron_t so1 = PBB_TRANSFORMED_SCATTERING (pbb1); - ppl_Polyhedron_t so2 = PBB_TRANSFORMED_SCATTERING (pbb2); ppl_Pointset_Powerset_C_Polyhedron_t po; ppl_Pointset_Powerset_C_Polyhedron_t eqpp; - graphite_dim_t tdim1 = pbb_nb_scattering_transform (pbb1); - graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb1); + graphite_dim_t tdim1 = pbb_nb_scattering_transform (PDR_PBB (pdr1)); + graphite_dim_t ddim1 = pbb_dim_iter_domain (PDR_PBB (pdr1)); ppl_dimension_type dim; bool empty_p; - poly_ddr_p pddr; - int obj_base_set1 = PDR_BASE_OBJECT_SET (pdr1); - int obj_base_set2 = PDR_BASE_OBJECT_SET (pdr2); - - if ((pdr_read_p (pdr1) && pdr_read_p (pdr2)) - || !poly_drs_may_alias_p (pdr1, pdr2)) - return false; - - if (obj_base_set1 != obj_base_set2) - return true; - - if (PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2)) - return false; - - pddr = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, so1, so2, - true, false); + poly_ddr_p pddr = dependence_polyhedron (pdr1, pdr2, 1, false); if (pddr_is_empty (pddr)) - return false; + { + free_poly_ddr (pddr); + return false; + } po = PDDR_DDP (pddr); ppl_Pointset_Powerset_C_Polyhedron_space_dimension (po, &dim); - eqpp = build_pairwise_scheduling_inequality (dim, level, tdim1 + ddim1, 1); + eqpp = build_pairwise_scheduling (dim, level, tdim1 + ddim1, 1); ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (eqpp, po); empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (eqpp); ppl_delete_Pointset_Powerset_C_Polyhedron (eqpp); + free_poly_ddr (pddr); + return !empty_p; } @@ -872,7 +848,7 @@ dot_original_deps_stmt_1 (FILE *file, scop_p scop) { for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++) for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++) - if (pddr_original_scattering (pbb1, pbb2, pdr1, pdr2)) + if (!pddr_is_empty (dependence_polyhedron (pdr1, pdr2, 1, true))) { fprintf (file, "OS%d -> OS%d\n", pbb_index (pbb1), pbb_index (pbb2)); @@ -897,12 +873,20 @@ dot_transformed_deps_stmt_1 (FILE *file, scop_p scop) { for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++) for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++) - if (pddr_transformed_scattering (pbb1, pbb2, pdr1, pdr2)) - { - fprintf (file, "TS%d -> TS%d\n", - pbb_index (pbb1), pbb_index (pbb2)); - goto done; - } + { + poly_ddr_p pddr = dependence_polyhedron (pdr1, pdr2, 1, false); + + if (!pddr_is_empty (pddr)) + { + fprintf (file, "TS%d -> TS%d\n", + pbb_index (pbb1), pbb_index (pbb2)); + + free_poly_ddr (pddr); + goto done; + } + + free_poly_ddr (pddr); + } done:; } } @@ -936,7 +920,7 @@ dot_original_deps (FILE *file, scop_p scop) for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++) for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++) for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++) - if (pddr_original_scattering (pbb1, pbb2, pdr1, pdr2)) + if (!pddr_is_empty (dependence_polyhedron (pdr1, pdr2, 1, true))) fprintf (file, "OS%d_D%d -> OS%d_D%d\n", pbb_index (pbb1), PDR_ID (pdr1), pbb_index (pbb2), PDR_ID (pdr2)); @@ -956,10 +940,16 @@ dot_transformed_deps (FILE *file, scop_p scop) for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++) for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++) for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++) - if (pddr_transformed_scattering (pbb1, pbb2, pdr1, pdr2)) - fprintf (file, "TS%d_D%d -> TS%d_D%d\n", - pbb_index (pbb1), PDR_ID (pdr1), - pbb_index (pbb2), PDR_ID (pdr2)); + { + poly_ddr_p pddr = dependence_polyhedron (pdr1, pdr2, 1, false); + + if (!pddr_is_empty (pddr)) + fprintf (file, "TS%d_D%d -> TS%d_D%d\n", + pbb_index (pbb1), PDR_ID (pdr1), + pbb_index (pbb2), PDR_ID (pdr2)); + + free_poly_ddr (pddr); + } } /* Pretty print to FILE all the data dependences of SCoP in DOT diff --git a/gcc/graphite-dependences.h b/gcc/graphite-dependences.h index cd89ba38644..f6f4fea95d2 100644 --- a/gcc/graphite-dependences.h +++ b/gcc/graphite-dependences.h @@ -30,6 +30,8 @@ enum poly_dependence_kind { has_dependence }; +/* Represents a Polyhedral Data Dependence Relation. */ + typedef struct poly_ddr { /* Source and sink data references of the dependence. */ @@ -40,17 +42,23 @@ typedef struct poly_ddr enum poly_dependence_kind kind; + /* True when the dependence relation is for the original scattering. */ + bool original_scattering_p; + } *poly_ddr_p; #define PDDR_SOURCE(PDDR) (PDDR->source) #define PDDR_SINK(PDDR) (PDDR->sink) #define PDDR_DDP(PDDR) (PDDR->ddp) #define PDDR_KIND(PDDR) (PDDR->kind) +#define PDDR_ORIGINAL_SCATTERING_P(PDDR) (PDDR->original_scattering_p) extern int eq_poly_ddr_p (const void *, const void *); extern hashval_t hash_poly_ddr_p (const void *); extern void free_poly_ddr (void *); extern void dot_deps (scop_p); extern void dot_deps_stmt (scop_p); +extern void print_pddr (FILE *, poly_ddr_p); +extern void debug_pddr (poly_ddr_p); #endif diff --git a/gcc/graphite-ppl.c b/gcc/graphite-ppl.c index b47e24a4ab4..0b7633514ef 100644 --- a/gcc/graphite-ppl.c +++ b/gcc/graphite-ppl.c @@ -700,5 +700,45 @@ ppl_min_for_le_polyhedron (ppl_Polyhedron_t pol, ppl_delete_Coefficient (denom); } +/* Builds a constraint in dimension DIM relating dimensions POS1 to + POS2 as "POS1 - POS2 + C CSTR_TYPE 0" */ + +ppl_Constraint_t +ppl_build_relation (int dim, int pos1, int pos2, int c, + enum ppl_enum_Constraint_Type cstr_type) +{ + ppl_Linear_Expression_t expr; + ppl_Constraint_t cstr; + ppl_Coefficient_t coef; + Value v, v_op, v_c; + + value_init (v); + value_init (v_op); + value_init (v_c); + + value_set_si (v, 1); + value_set_si (v_op, -1); + value_set_si (v_c, c); + + ppl_new_Coefficient (&coef); + ppl_new_Linear_Expression_with_dimension (&expr, dim); + + ppl_assign_Coefficient_from_mpz_t (coef, v); + ppl_Linear_Expression_add_to_coefficient (expr, pos1, coef); + ppl_assign_Coefficient_from_mpz_t (coef, v_op); + ppl_Linear_Expression_add_to_coefficient (expr, pos2, coef); + ppl_assign_Coefficient_from_mpz_t (coef, v_c); + ppl_Linear_Expression_add_to_inhomogeneous (expr, coef); + + ppl_new_Constraint (&cstr, expr, cstr_type); + + ppl_delete_Linear_Expression (expr); + ppl_delete_Coefficient (coef); + value_clear (v); + value_clear (v_op); + value_clear (v_c); + + return cstr; +} #endif diff --git a/gcc/graphite-ppl.h b/gcc/graphite-ppl.h index f7dc2b31ed2..488ad6f8022 100644 --- a/gcc/graphite-ppl.h +++ b/gcc/graphite-ppl.h @@ -50,6 +50,8 @@ void ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, ppl_Linear_Expression_t, Value); void ppl_min_for_le_polyhedron (ppl_Polyhedron_t, ppl_Linear_Expression_t, Value); +ppl_Constraint_t ppl_build_relation (int, int, int, int, + enum ppl_enum_Constraint_Type); /* Assigns to RES the value of the INTEGER_CST T. */ diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 8fd7b54ef07..ddd1121a58d 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -1497,7 +1497,7 @@ dot_all_scops (VEC (scop_p, heap) *scops) dot_all_scops_1 (stream, scops); fclose (stream); - x = system ("dotty /tmp/allscops.dot"); + x = system ("dotty /tmp/allscops.dot &"); #else dot_all_scops_1 (stderr, scops); #endif @@ -1523,7 +1523,7 @@ dot_scop (scop_p scop) dot_all_scops_1 (stream, scops); fclose (stream); - x = system ("dotty /tmp/allscops.dot"); + x = system ("dotty /tmp/allscops.dot &"); } #else dot_all_scops_1 (stderr, scops); diff --git a/gcc/sese.h b/gcc/sese.h index a54854a7610..20dd1b023da 100644 --- a/gcc/sese.h +++ b/gcc/sese.h @@ -390,7 +390,4 @@ nb_common_loops (sese region, gimple_bb_p gbb1, gimple_bb_p gbb2) return sese_loop_depth (region, common); } -extern void print_gimple_bb (FILE *, gimple_bb_p, int, int); -extern void debug_gbb (gimple_bb_p, int); - #endif diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fdb749509de..b8c4b8c8e52 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2010-02-06 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * gfortran.dg/read_no_eor.f90: New test. + +2010-02-05 Jason Merrill <jason@redhat.com> + + * g++.dg/ext/label13.C: Move constructor body out of class. + +2010-02-03 Jason Merrill <jason@redhat.com> + + PR c++/42870 + * g++.dg/ext/dllexport3.C: New. + 2010-02-05 Ozkan Sezer <sezeroz@gmail.com> * gcc.dg/format/ms-format3.c: New test for specific MS types. diff --git a/gcc/testsuite/g++.dg/ext/dllexport3.C b/gcc/testsuite/g++.dg/ext/dllexport3.C new file mode 100644 index 00000000000..a47a5e07760 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/dllexport3.C @@ -0,0 +1,19 @@ +// PR c++/42870 +// { dg-do compile { target i?86-*-cygwin *-*-mingw* } } +// { dg-final { scan-assembler "-export:_ZN2SaD1Ev" } } + +#define ATTRIBUTE __attribute__ ((dllexport)) +class ATTRIBUTE Sa { + public: + Sa() + {} + ~Sa(); +}; +ATTRIBUTE Sa::~Sa() +{return;} + +bool DllMain(void *a,void*b,int) +{ + Sa s; + return true; +} diff --git a/gcc/testsuite/g++.dg/ext/label13.C b/gcc/testsuite/g++.dg/ext/label13.C index 5f3c0f5cb38..931263a3fa0 100644 --- a/gcc/testsuite/g++.dg/ext/label13.C +++ b/gcc/testsuite/g++.dg/ext/label13.C @@ -5,14 +5,16 @@ int i; struct C { - C() - { - static void *labelref = &&label; - goto *labelref; - label: i = 1; - } + C(); }; +C::C() +{ + static void *labelref = &&label; + goto *labelref; + label: i = 1; +} + int main() { C c; diff --git a/gcc/testsuite/g++.dg/graphite/graphite.exp b/gcc/testsuite/g++.dg/graphite/graphite.exp index ba7c8ccec89..f46dcc706d3 100644 --- a/gcc/testsuite/g++.dg/graphite/graphite.exp +++ b/gcc/testsuite/g++.dg/graphite/graphite.exp @@ -33,58 +33,36 @@ proc lremove {list_variable value} { # The default action for a test is 'compile'. Save current default. global dg-do-what-default set save-dg-do-what-default ${dg-do-what-default} -set dg-do-what-default compile # Initialize `dg'. dg-init -# Main loop. - set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.C ] ] - -# Flags using for block-* files. -set DEFAULT_FLAGS_GRAPHITE_BLOCK "-O2 -floop-block -fno-loop-strip-mine \ - -fno-loop-interchange -fdump-tree-graphite-all" -set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.C ] ] -dg-runtest $block_files "" $DEFAULT_FLAGS_GRAPHITE_BLOCK -foreach block_file $block_files {lremove wait_to_run_files $block_file} - -# Flags using for id-* files. -set DEFAULT_FLAGS_GRAPHITE_IDENTITY "-O2 -fgraphite-identity" -set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.C ] ] -dg-runtest $id_files "" $DEFAULT_FLAGS_GRAPHITE_IDENTITY -foreach id_file $id_files {lremove wait_to_run_files $id_file} - -# Flags using for interchange-* files. -set DEFAULT_FLAGS_GRAPHITE_INTERCHANGE "-O2 -fdump-tree-graphite-all \ - -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math" +set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.C ] ] +set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.C ] ] +set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.C ] ] set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.C ] ] -dg-runtest $interchange_files "" $DEFAULT_FLAGS_GRAPHITE_INTERCHANGE -foreach interchange_file $interchange_files {lremove wait_to_run_files $interchange_file} - -# Flags using for scop-* files. -set DEFAULT_FLAGS_GRAPHITE_SCOP "-O2 -fgraphite -fdump-tree-graphite-all" -set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.C ] ] -dg-runtest $scop_files "" $DEFAULT_FLAGS_GRAPHITE_SCOP -foreach scop_file $scop_files {lremove wait_to_run_files $scop_file} +set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.C ] ] +# Tests to be compiled. +set dg-do-what-default compile +dg-runtest $scop_files "" "-O2 -fgraphite -fdump-tree-graphite-all" +dg-runtest $id_files "" "-O2 -fgraphite-identity -ffast-math" -# Schedule now the tests to be run. +# Tests to be run. set dg-do-what-default run - -# Flags using for run-id-* files. -set DEFAULT_FLAGS_RUN_ID "-O2 -fgraphite-identity" -set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.C ] ] -dg-runtest $run_id_files "" $DEFAULT_FLAGS_RUN_ID -foreach run_id_file $run_id_files {lremove wait_to_run_files $run_id_file} - +dg-runtest $run_id_files "" "-O2 -fgraphite-identity" +dg-runtest $interchange_files "" "-O2 -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math -fdump-tree-graphite-all" +dg-runtest $block_files "" "-O2 -floop-block -fno-loop-strip-mine -fno-loop-interchange -ffast-math -fdump-tree-graphite-all" # The default action for the rest of the files is 'compile'. set dg-do-what-default compile - -# Flags using for other files. -set DEFAULT_FLAGS_GRAPHITE "-ansi -pedantic-errors" -dg-runtest $wait_to_run_files "" $DEFAULT_FLAGS_GRAPHITE +foreach f $scop_files {lremove wait_to_run_files $f} +foreach f $id_files {lremove wait_to_run_files $f} +foreach f $run_id_files {lremove wait_to_run_files $f} +foreach f $interchange_files {lremove wait_to_run_files $f} +foreach f $block_files {lremove wait_to_run_files $f} +dg-runtest $wait_to_run_files "" "-ansi -pedantic-errors" # Clean up. set dg-do-what-default ${save-dg-do-what-default} diff --git a/gcc/testsuite/gcc.dg/graphite/block-0.c b/gcc/testsuite/gcc.dg/graphite/block-0.c index a00694ca406..320ee791367 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-0.c +++ b/gcc/testsuite/gcc.dg/graphite/block-0.c @@ -1,11 +1,16 @@ +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + #define N 1000 +int a[N]; -int toto() +static int __attribute__((noinline)) +foo (void) { int j; int i; - int a[N]; - int b[N]; for (i = 0; i < N; i++) for (j = 0; j < N; j++) @@ -16,8 +21,19 @@ int toto() main() { - return toto(); + int i, res; + + for (i = 0; i < N; i++) + a[i] = i; + + res = foo (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 1999; } -/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c index 35c5c6a1f1e..64ff67b2226 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-1.c +++ b/gcc/testsuite/gcc.dg/graphite/block-1.c @@ -1,8 +1,11 @@ /* { dg-require-effective-target size32plus } */ -#define MAX 8192 +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif -void bar (void); +#define MAX 100 int main() { @@ -11,8 +14,6 @@ int main() int A[MAX * MAX]; int B[MAX * MAX]; - bar (); - for (i = 0; i < MAX; i++) for (j = 0; j < MAX; j++) { @@ -24,13 +25,15 @@ int main() for (j = 0; j < MAX; j++) A[i*MAX + j] += B[j*MAX + i]; - bar (); - for(i = 0; i < MAX; i++) for(j = 0; j < MAX; j++) sum += A[i*MAX + j]; - return sum; +#if DEBUG + fprintf (stderr, "sum = %d \n", sum); +#endif + + return sum != 990000; } /* { dg-final { scan-tree-dump-times "will be loop blocked" 2 "graphite" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-3.c b/gcc/testsuite/gcc.dg/graphite/block-3.c index 75356161334..01e186352f8 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-3.c +++ b/gcc/testsuite/gcc.dg/graphite/block-3.c @@ -1,11 +1,17 @@ /* { dg-require-effective-target size32plus } */ +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + #define N 24 #define M 100 -float A[M][M][M], B[M][M], C[M][M]; +int A[M][M][M], B[M][M], C[M][M]; -void test (void) +static int __attribute__((noinline)) +foo (void) { int i, j, k; @@ -20,6 +26,29 @@ void test (void) for (j = 0; j < M; j++) for (k = 0; k < M; k++) A[i][j][k] = B[i][k] * C[k][j]; + + return A[0][0][0] + A[M-1][M-1][M-1]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < M; i++) + for (j = 0; j < M; j++) + { + B[i][j] = i; + C[i][j] = j; + } + + res = foo (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 9801; } /* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-4.c b/gcc/testsuite/gcc.dg/graphite/block-4.c index d752a4d95e6..50927573782 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-4.c +++ b/gcc/testsuite/gcc.dg/graphite/block-4.c @@ -1,11 +1,17 @@ /* { dg-require-effective-target size32plus } */ +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + #define N 24 #define M 1000 -float A[1000][1000], B[1000][1000], C[1000][1000]; +int A[M][M], B[M][M], C[M][M]; -void test (void) +static int __attribute__((noinline)) +foo (void) { int i, j, k; @@ -14,11 +20,34 @@ void test (void) for (k = 0; k < 24; k++) A[i][j] = B[i][k] * C[k][j]; - for (i = 0; i < 1000; i++) - for (j = 0; j < 1000; j++) - for (k = 0; k < 1000; k++) + for (i = 0; i < M; i++) + for (j = 0; j < M; j++) + for (k = 0; k < M; k++) A[i][j] = B[i][k] * C[k][j]; + + return A[0][0] + A[M-1][M-1]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < M; i++) + for (j = 0; j < M; j++) + { + B[i][j] = i; + C[i][j] = j; + } + + res = foo (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 998001; } -/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-5.c b/gcc/testsuite/gcc.dg/graphite/block-5.c index a8f3817e67e..4b99900c9d4 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-5.c +++ b/gcc/testsuite/gcc.dg/graphite/block-5.c @@ -1,16 +1,20 @@ /* { dg-require-effective-target size32plus } */ -#define N 10000 -void foo (int); -int test () -{ - int a[N][N]; - int b[N][N]; - unsigned i, j; +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif - for (i = 0; i < N; i++) - for (j = 0; j < N; j++) - a[i][j] = i*j; +#define N 200 + +int a[N][N]; +int b[N][N]; + +static int __attribute__((noinline)) +foo (void) +{ + int i, j; + int res = 0; /* This loop nest should be blocked. */ for (j = 1; j < N; j++) @@ -18,8 +22,30 @@ int test () a[i][j] = a[i][j-1] + b[i][j]; for (i = 0; i < N; i++) + res += a[i][i]; + + return res; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < N; i++) for (j = 0; j < N; j++) - foo (a[i][j]); + { + a[i][j] = i + j; + b[i][j] = i - j; + } + + res = foo (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 1333300; } /* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-6.c b/gcc/testsuite/gcc.dg/graphite/block-6.c index 6905e3635f7..a147ab8af49 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-6.c +++ b/gcc/testsuite/gcc.dg/graphite/block-6.c @@ -1,24 +1,46 @@ /* { dg-require-effective-target size32plus } */ -#define N 10000 -void foo (int); -int test () -{ - int a[N][N]; - unsigned i, j; +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif - for (i = 0; i < N; i++) - for (j = 0; j < N; j++) - a[i][j] = i*j; +#define N 200 +int a[N][N]; + +static int __attribute__((noinline)) +foo (void) +{ + int i, j; + int res = 0; /* Interchange is not legal for loops 0 and 1. */ for (i = 1; i < N; i++) - for (j = 1; j < (N-1) ; j++) - a[i][j] = a[i-1][j+1] * a[i-1][j+1]/2; + for (j = 1; j < N - 1; j++) + a[i][j] = a[i-1][j+1] * a[i-1][j+1] / 2; + + for (i = 0; i < N; i++) + res += a[i][i]; + + return res; +} + +int +main (void) +{ + int i, j, res; for (i = 0; i < N; i++) for (j = 0; j < N; j++) - foo (a[i][j]); + a[i][j] = i + j; + + res = foo (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 204007516; } /* { dg-final { scan-tree-dump-times "will be loop blocked" 0 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-7.c b/gcc/testsuite/gcc.dg/graphite/block-7.c new file mode 100644 index 00000000000..a07ef11738d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/block-7.c @@ -0,0 +1,51 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 200 + +int A[N][N], B[N][N], C[N][N]; + +static void __attribute__((noinline)) +matmult (void) +{ + int i, j, k; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = 0; + for (k = 0; k < N; k++) + A[i][j] += B[i][k] * C[k][j]; + } +} + +int +main (void) +{ + int i, j, res = 0; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + B[i][j] = j; + C[i][j] = i; + } + + matmult (); + + for (i = 0; i < N; i++) + res += A[i][i]; + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 529340000; +} + +/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp index c4a8b2e748b..411e0417afd 100644 --- a/gcc/testsuite/gcc.dg/graphite/graphite.exp +++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp @@ -33,58 +33,36 @@ proc lremove {list_variable value} { # The default action for a test is 'compile'. Save current default. global dg-do-what-default set save-dg-do-what-default ${dg-do-what-default} -set dg-do-what-default compile # Initialize `dg'. dg-init -# Main loop. - set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.c ] ] - -# Flags using for block-* files. -set DEFAULT_FLAGS_GRAPHITE_BLOCK "-O2 -floop-block -fno-loop-strip-mine \ - -fno-loop-interchange -fdump-tree-graphite-all" -set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.c ] ] -dg-runtest $block_files "" $DEFAULT_FLAGS_GRAPHITE_BLOCK -foreach block_file $block_files {lremove wait_to_run_files $block_file} - -# Flags using for id-* files. -set DEFAULT_FLAGS_GRAPHITE_IDENTITY "-O2 -fgraphite-identity" -set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ] -dg-runtest $id_files "" $DEFAULT_FLAGS_GRAPHITE_IDENTITY -foreach id_file $id_files {lremove wait_to_run_files $id_file} - -# Flags using for interchange-* files. -set DEFAULT_FLAGS_GRAPHITE_INTERCHANGE "-O2 -fdump-tree-graphite-all \ - -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math" +set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.c ] ] +set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ] +set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.c ] ] set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c ] ] -dg-runtest $interchange_files "" $DEFAULT_FLAGS_GRAPHITE_INTERCHANGE -foreach interchange_file $interchange_files {lremove wait_to_run_files $interchange_file} - -# Flags using for scop-* files. -set DEFAULT_FLAGS_GRAPHITE_SCOP "-O2 -fgraphite -fdump-tree-graphite-all" -set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.c ] ] -dg-runtest $scop_files "" $DEFAULT_FLAGS_GRAPHITE_SCOP -foreach scop_file $scop_files {lremove wait_to_run_files $scop_file} +set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.c ] ] +# Tests to be compiled. +set dg-do-what-default compile +dg-runtest $scop_files "" "-O2 -fgraphite -fdump-tree-graphite-all" +dg-runtest $id_files "" "-O2 -fgraphite-identity -ffast-math" -# Schedule now the tests to be run. +# Tests to be run. set dg-do-what-default run - -# Flags using for run-id-* files. -set DEFAULT_FLAGS_RUN_ID "-O2 -fgraphite-identity" -set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.c ] ] -dg-runtest $run_id_files "" $DEFAULT_FLAGS_RUN_ID -foreach run_id_file $run_id_files {lremove wait_to_run_files $run_id_file} - +dg-runtest $run_id_files "" "-O2 -fgraphite-identity" +dg-runtest $interchange_files "" "-O2 -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math -fdump-tree-graphite-all" +dg-runtest $block_files "" "-O2 -floop-block -fno-loop-strip-mine -fno-loop-interchange -ffast-math -fdump-tree-graphite-all" # The default action for the rest of the files is 'compile'. set dg-do-what-default compile - -# Flags using for other files. -set DEFAULT_FLAGS_GRAPHITE "-ansi -pedantic-errors" -dg-runtest $wait_to_run_files "" $DEFAULT_FLAGS_GRAPHITE +foreach f $scop_files {lremove wait_to_run_files $f} +foreach f $id_files {lremove wait_to_run_files $f} +foreach f $run_id_files {lremove wait_to_run_files $f} +foreach f $interchange_files {lremove wait_to_run_files $f} +foreach f $block_files {lremove wait_to_run_files $f} +dg-runtest $wait_to_run_files "" "-ansi -pedantic-errors" # Clean up. set dg-do-what-default ${save-dg-do-what-default} diff --git a/gcc/testsuite/gcc.dg/graphite/id-17.c b/gcc/testsuite/gcc.dg/graphite/id-17.c new file mode 100644 index 00000000000..c93c211e459 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-17.c @@ -0,0 +1,21 @@ +typedef struct +{ + int offset_for_ref_frame[256]; +} seq_parameter_set_rbsp_t; + +typedef struct +{ + unsigned int num_ref_frames_in_pic_order_cnt_cycle; + int offset_for_ref_frame[1]; + int auto_crop_right; +} ImageParameters; + +ImageParameters *img; + +void GenerateSequenceParameterSet(seq_parameter_set_rbsp_t *sps) +{ + unsigned i; + for (i=0; i<img->num_ref_frames_in_pic_order_cnt_cycle; i++) + sps->offset_for_ref_frame[i] = img->offset_for_ref_frame[i]; + error("foo"); +} diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-0.c b/gcc/testsuite/gcc.dg/graphite/interchange-0.c index 3e8525070bf..e6e6dfc4795 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-0.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-0.c @@ -1,9 +1,16 @@ /* { dg-require-effective-target size32plus } */ -int a[1000][1000]; +#define DEBUG 0 -int -foo (int N) +#if DEBUG +#include <stdio.h> +#endif + +#define N 1000 +int a[N][N]; + +static int __attribute__((noinline)) +foo (void) { int j; int i; @@ -12,8 +19,27 @@ foo (int N) for (j = 0; j < N; j++) a[j][i] = a[j][i] + 1; - return a[N][123]; + return a[N-1][N-1]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + a[i][j] = 1; + + a[N-1][N-1] = 12; + res = foo (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 13; } -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg -final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-1.c b/gcc/testsuite/gcc.dg/graphite/interchange-1.c index cd9197d4d1a..80a2e346234 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-1.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-1.c @@ -2,8 +2,15 @@ /* Formerly known as ltrans-1.c */ +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + double u[1782225]; -int foo(int N, int *res) + +static int __attribute__((noinline)) +foo (int N) { int i, j; double sum = 0.0; @@ -15,8 +22,27 @@ int foo(int N, int *res) u[1336 * i] *= 2; } - *res = sum + N; + + return sum + N + u[1336 * 2] + u[1336]; } +int +main (void) +{ + int i, j, res; + + for (i = 0; i < 1782225; i++) + u[i] = 2; + + res = foo (1335); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 3565793; +} + + /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-10.c b/gcc/testsuite/gcc.dg/graphite/interchange-10.c index 0cd22a3b412..17f807b0c07 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-10.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-10.c @@ -1,5 +1,14 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + double u[1782225]; -int foo(int N, int *res) + +static void __attribute__((noinline)) +foo (int N, int *res) { int i, j; double sum = 0.0; @@ -12,7 +21,24 @@ int foo(int N, int *res) for (j = 0; j < N; j++) sum = sum + u[i + 1335 * j]; - *res = sum + N; + *res = sum + N + u[1336 * 2] + u[1336]; +} + +int +main (void) +{ + int i, res; + + for (i = 0; i < 1782225; i++) + u[i] = 2; + + foo (1335, &res); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 7130239; } /* { dg-final { scan-tree-dump-times "will be interchanged" 2 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-11.c b/gcc/testsuite/gcc.dg/graphite/interchange-11.c index dea8df75369..eecc979a1f3 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-11.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-11.c @@ -1,5 +1,14 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + double u[1782225]; -int foo(int N, int *res) + +static void __attribute__((noinline)) +foo (int N, int *res) { int i, j; double sum = 0.0; @@ -14,5 +23,22 @@ int foo(int N, int *res) *res = sum; } +int +main (void) +{ + int i, res; + + for (i = 0; i < 1782225; i++) + u[i] = 2; + + foo (1335, &res); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 3564450; +} + /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-12.c b/gcc/testsuite/gcc.dg/graphite/interchange-12.c new file mode 100644 index 00000000000..c0e331bb687 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/interchange-12.c @@ -0,0 +1,51 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 200 + +int A[N][N], B[N][N], C[N][N]; + +static int __attribute__((noinline)) +matmult (void) +{ + int i, j, k; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = 0; + for (k = 0; k < N; k++) + A[i][j] += B[i][k] * C[k][j]; + } + + return A[0][0] + A[N-1][N-1]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = 0; + B[i][j] = i - j; + C[i][j] = i + j; + } + + res = matmult (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 2626800; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-2.c b/gcc/testsuite/gcc.dg/graphite/interchange-2.c index 6b1dbe6514f..62692defae4 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-2.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-2.c @@ -2,12 +2,19 @@ /* Formerly known as ltrans-2.c */ +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + double u[1782225]; -int foo(int N, int *res) + +static void __attribute__((noinline)) +foo (int N, int *res) { unsigned int i, j; double sum = 0; - + /* This loop should be converted to a perfect nest and interchanged. */ for (i = 0; i < N; i++) @@ -19,7 +26,25 @@ int foo(int N, int *res) u[1336 * i] *= 2; } } - *res = sum + N; + + *res = sum + N + u[1336 * 2] + u[1336]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < 1782225; i++) + u[i] = 2; + + foo (1335, &res); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 3565793; } /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-3.c b/gcc/testsuite/gcc.dg/graphite/interchange-3.c index c2a67445631..95c228d07e8 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-3.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-3.c @@ -2,19 +2,44 @@ /* Formerly known as ltrans-3.c */ +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + double u[1782225]; -int foo(int N, int *res) + +static void __attribute__((noinline)) +foo (int N, int *res) { unsigned int i, j; double sum = 0; - for (i = 0; i < N; i++) + for (i = 0; i < N; i++) + { + for (j = 0; j < N; j++) { - for (j = 0; j < N; j++) - { - sum = sum + u[i + 1335 * j]; - } + sum = sum + u[i + 1335 * j]; } - *res = sum + N; + } + + *res = sum + N + u[1336 * 2] + u[1336]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < 1782225; i++) + u[i] = 2; + + foo (1335, &res); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 3565789; } /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-4.c b/gcc/testsuite/gcc.dg/graphite/interchange-4.c index c0ec7fa3c81..5d3c7b186f6 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-4.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-4.c @@ -2,8 +2,15 @@ /* Formerly known as ltrans-4.c */ +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + double u[1782225]; -int foo(int N, int *res) + +static int __attribute__((noinline)) +foo (int N, int *res) { int i, j; double sum = 0; @@ -13,7 +20,25 @@ int foo(int N, int *res) for (i = 0; i < N; i++) u[1336 * i] *= 2; - *res = sum + N; + + *res = sum + N + u[1336 * 2] + u[1336]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < 1782225; i++) + u[i] = 2; + + foo (1335, &res); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 3565793; } /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-5.c b/gcc/testsuite/gcc.dg/graphite/interchange-5.c index 19a5e09397f..a912fe24984 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-5.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-5.c @@ -2,17 +2,44 @@ /* Formerly known as ltrans-5.c */ -int foo () +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 100 +#define M 1111 +int A[N][M]; + +static int __attribute__((noinline)) +foo (void) { - int A[100][1111]; int i, j; - for( i = 0; i < 1111; i++) - for( j = 0; j < 100; j++) + for( i = 0; i < M; i++) + for( j = 0; j < N; j++) A[j][i] = 5 * A[j][i]; - return A[10][10]; + return A[0][0] + A[N-1][M-1]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < N; i++) + for (j = 0; j < M; j++) + A[i][j] = 2; + + res = foo (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 20; } -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-6.c b/gcc/testsuite/gcc.dg/graphite/interchange-6.c index 18454879b1f..2ff886cf7ee 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-6.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-6.c @@ -2,17 +2,44 @@ /* Formerly known as ltrans-6.c */ -int medium_loop_interchange(int A[100][200]) +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 100 +#define M 200 + +static int __attribute__((noinline)) +foo (int A[N][M]) { - int i,j; + int i, j; /* This loop should be interchanged. */ - - for(j = 0; j < 200; j++) - for(i = 0; i < 100; i++) + for(j = 0; j < M; j++) + for(i = 0; i < N; i++) A[i][j] = A[i][j] + A[i][j]; - return A[1][1]; + return A[0][0] + A[N-1][M-1]; +} + +int +main (void) +{ + int A[N][M]; + int i, j, res; + + for (i = 0; i < N; i++) + for (j = 0; j < M; j++) + A[i][j] = 2; + + res = foo (A); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 8; } /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-7.c b/gcc/testsuite/gcc.dg/graphite/interchange-7.c index 2a7bf867bda..a030943c01a 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-7.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-7.c @@ -1,17 +1,45 @@ +/* { dg-require-effective-target size32plus } */ + /* Formerly known as ltrans-8.c */ -double +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 111 +#define M 1111 + +static int __attribute__((noinline)) foo (double *a) { int i,j; - double r = 0.0; + int r = 0; - for (i = 0; i < 100; ++i) - for (j = 0; j < 1000; ++j) - r += a[j * 100 + i]; + for (i = 0; i < N; ++i) + for (j = 0; j < M; ++j) + r += a[j * N + i]; return r; } +int +main (void) +{ + double A[N*M]; + int i, res; + + for (i = 0; i < N*M; i++) + A[i] = 2; + + res = foo (A); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 246642; +} + /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-8.c b/gcc/testsuite/gcc.dg/graphite/interchange-8.c index 24b9a15a7ed..94bd66b644d 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-8.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-8.c @@ -1,9 +1,15 @@ -int +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +int B[4]; +int A[4][4][4][4]; + +static int __attribute__((noinline)) foo (void) { int i, j, k, l; - int B[4]; - int A[4][4][4][4]; for (l = 0; l < 4; l++) { @@ -37,7 +43,36 @@ foo (void) } } - return A[0][1][0][2]; + return A[0][1][0][2] + A[0][3][0][3] + A[0][2][0][2] + A[0][1][0][1] + A[3][3][0][2]; +} + +int +main (void) +{ + int i, j, k, l, res; + + for (i = 0; i < 4; i++) + B[i] = 2; + + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + for (k = 0; k < 4; k++) + for (l = 0; l < 4; l++) + A[i][j][k][l] = i + j + k + l; + + res = foo (); + +#if DEBUG + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + for (k = 0; k < 4; k++) + for (l = 0; l < 4; l++) + fprintf (stderr, "A[%d][%d][%d][%d] = %d \n", i, j, k, l, A[i][j][k][l]); + + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 424; } /* Loops K and L should be interchanged. */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-9.c b/gcc/testsuite/gcc.dg/graphite/interchange-9.c index e55d8180cfe..d4e05c369af 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-9.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-9.c @@ -1,15 +1,43 @@ -int +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 1111 +#define M 1111 + +static int __attribute__((noinline)) foo (int *x) { int i, j; int sum = 0; - for (j = 0; j < 10000; ++j) - for (i = 0; i < 10000; ++i) - sum += x[10000 * i + j]; + for (j = 0; j < M; ++j) + for (i = 0; i < N; ++i) + sum += x[M * i + j]; return sum; } +int +main (void) +{ + int A[N*M]; + int i, res; + + for (i = 0; i < N*M; i++) + A[i] = 2; + + res = foo (A); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 2468642; +} + /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c index 915a7acf33b..a1310dd6725 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c @@ -1,24 +1,57 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + #define NMAX 2000 -static double x1[NMAX], x2[NMAX], a[NMAX][NMAX], y_1[NMAX], y_2[NMAX]; +static int x1[NMAX], x2[NMAX], a[NMAX][NMAX], y1[NMAX], y2[NMAX]; -void mvt(long N) { +static int __attribute__((noinline)) +mvt (long N) +{ - int i,j; + int i,j; - for (i=0; i<N; i++) { - for (j=0; j<N; j++) { - x1[i] = x1[i] + a[i][j] * y_1[j]; - } - } - - for (i=0; i<N; i++) { - for (j=0; j<N; j++) { - x2[i] = x2[i] + a[j][i] * y_2[j]; - } + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x1[i] = x1[i] + a[i][j] * y1[j]; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x2[i] = x2[i] + a[j][i] * y2[j]; + + return x1[0] + x2[0]; +} + +int +main (void) +{ + int i, j, res; + + for (i = 0; i < NMAX; i++) + for (j = 0; j < NMAX; j++) + a[i][j] = i + j; + + for (i = 0; i < NMAX; i++) + { + x1[i] = 0; + x2[i] = 2*i; + y1[i] = 100 - i; + y2[i] = i; } + + res = mvt (NMAX); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + return res != 199900000; } -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr41888.c b/gcc/testsuite/gcc.dg/graphite/pr41888.c new file mode 100644 index 00000000000..b262af68e92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr41888.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-g -O2 -ftree-loop-distribution -fgraphite-identity" } */ + +int +foo (int *x) +{ + int a[10], b[10]; + int i; + a[9] = 8; + b[9] = 8; + for (i = 0; i < 9; i++) + { + a[i] = *x++; + b[i] = 1; + } + b[i] = b[i] & !(a[i] ^ *x++); + return b[i] ? i + 1 : 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/run-id-2.c b/gcc/testsuite/gcc.dg/graphite/run-id-2.c index acaa14c6d0e..0fd5efd8dc2 100644 --- a/gcc/testsuite/gcc.dg/graphite/run-id-2.c +++ b/gcc/testsuite/gcc.dg/graphite/run-id-2.c @@ -1,6 +1,7 @@ int a[1] = {1}; -static int __attribute__((noinline)) foo(int n) +static int __attribute__((noinline)) +foo(int n) { int i, c = 0; for (i = 0; i < n; i++) @@ -24,5 +25,3 @@ int main() foo(0) != 0 || foo(1) != 1 || bar(0) != 0 || bar(1) != 2 || bar(2) != 5; } -/* { dg-do run } */ -/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-0.c b/gcc/testsuite/gcc.dg/graphite/scop-0.c index 067e7bcffe0..120de9c7f23 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-0.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-0.c @@ -17,6 +17,6 @@ int toto() /* End scop 1. */ } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-22.c b/gcc/testsuite/gcc.dg/graphite/scop-22.c new file mode 100644 index 00000000000..b77be22b14d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/scop-22.c @@ -0,0 +1,21 @@ +double u[1782225]; + +void foo(int N, int *res) +{ + int i; + double a, b; + double sum = 0.0; + + for (i = 0; i < N; i++) + { + a = u[i]; + u[i] = i * i; + b = u[i]; + sum += a + b; + } + + *res = sum + N; +} + +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gfortran.dg/graphite/block-1.f90 b/gcc/testsuite/gfortran.dg/graphite/block-1.f90 index 8125853b937..cea307e5acd 100644 --- a/gcc/testsuite/gfortran.dg/graphite/block-1.f90 +++ b/gcc/testsuite/gfortran.dg/graphite/block-1.f90 @@ -3,10 +3,11 @@ subroutine matrix_multiply(a,b,c,n) real(8), dimension(n,n) :: a,b,c ! The following code is disabled for the moment. -! c=0.d0 +c=0.d0 end subroutine matrix_multiply -! { dg-final { scan-tree-dump-times "Loop blocked" 2 "graphite" { xfail *-*-* } } } -! { dg-final { cleanup-tree-dump "graphite" } } +! { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" } } +! { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } +! { dg-final { cleanup-tree-dump "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/block-2.f b/gcc/testsuite/gfortran.dg/graphite/block-2.f index 6c7ee6fe951..75fccca146c 100644 --- a/gcc/testsuite/gfortran.dg/graphite/block-2.f +++ b/gcc/testsuite/gfortran.dg/graphite/block-2.f @@ -16,5 +16,6 @@ RETURN END -! { dg-final { scan-tree-dump-times "Loop blocked" 3 "graphite" { xfail { "*-*-*" } } } } -! { dg-final { cleanup-tree-dump "graphite" } } +! { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite" } } +! { dg-final { scan-tree-dump-times "will be loop blocked" 2 "graphite" { xfail *-*-* } } } +! { dg-final { cleanup-tree-dump "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/block-3.f90 b/gcc/testsuite/gfortran.dg/graphite/block-3.f90 index 1579e66e411..9a66adffd92 100644 --- a/gcc/testsuite/gfortran.dg/graphite/block-3.f90 +++ b/gcc/testsuite/gfortran.dg/graphite/block-3.f90 @@ -12,6 +12,7 @@ enddo end subroutine matrix_multiply -! { dg-final { scan-tree-dump-times "Loop blocked" 2 "graphite" { xfail *-*-* } } } -! { dg-final { cleanup-tree-dump "graphite" } } +! { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" { xfail *-*-* } } } +! { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } +! { dg-final { cleanup-tree-dump "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/block-4.f90 b/gcc/testsuite/gfortran.dg/graphite/block-4.f90 index f37d70aec3f..061830fb973 100644 --- a/gcc/testsuite/gfortran.dg/graphite/block-4.f90 +++ b/gcc/testsuite/gfortran.dg/graphite/block-4.f90 @@ -15,6 +15,7 @@ enddo end subroutine matrix_multiply -! { dg-final { scan-tree-dump-times "Loop blocked" 2 "graphite" { xfail *-*-* } } } -! { dg-final { cleanup-tree-dump "graphite" } } +! { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" { xfail *-*-* } } } +! { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } +! { dg-final { cleanup-tree-dump "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/graphite.exp b/gcc/testsuite/gfortran.dg/graphite/graphite.exp index 99b46def818..11dd42dc57e 100644 --- a/gcc/testsuite/gfortran.dg/graphite/graphite.exp +++ b/gcc/testsuite/gfortran.dg/graphite/graphite.exp @@ -33,56 +33,36 @@ proc lremove {list_variable value} { # The default action for a test is 'compile'. Save current default. global dg-do-what-default set save-dg-do-what-default ${dg-do-what-default} -set dg-do-what-default compile # Initialize `dg'. dg-init -# Main loop. set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] - -# Flags using for block-* files. -set DEFAULT_FLAGS_GRAPHITE_BLOCK "-O2 -floop-block -fno-loop-strip-mine \ - -fno-loop-interchange -fdump-tree-graphite-all" -set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.\[fF\]{,90,95,03,08} ] ] -gfortran-dg-runtest $block_files $DEFAULT_FLAGS_GRAPHITE_BLOCK -foreach block_file $block_files {lremove wait_to_run_files $block_file} - -# Flags using for id-* files. -set DEFAULT_FLAGS_GRAPHITE_IDENTITY "-O2 -fgraphite-identity" -set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.\[fF\]{,90,95,03,08} ] ] -gfortran-dg-runtest $id_files $DEFAULT_FLAGS_GRAPHITE_IDENTITY -foreach id_file $id_files {lremove wait_to_run_files $id_file} - -# Flags using for interchange-* files. -set DEFAULT_FLAGS_GRAPHITE_INTERCHANGE "-O2 -fdump-tree-graphite-all \ - -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math" +set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.\[fF\]{,90,95,03,08} ] ] +set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.\[fF\]{,90,95,03,08} ] ] set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.\[fF\]{,90,95,03,08} ] ] -gfortran-dg-runtest $interchange_files $DEFAULT_FLAGS_GRAPHITE_INTERCHANGE -foreach interchange_file $interchange_files {lremove wait_to_run_files $interchange_file} - -# Flags using for scop-* files. -set DEFAULT_FLAGS_GRAPHITE_SCOP "-O2 -fgraphite -fdump-tree-graphite-all" set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.\[fF\]{,90,95,03,08} ] ] -gfortran-dg-runtest $scop_files $DEFAULT_FLAGS_GRAPHITE_SCOP -foreach scop_file $scop_files {lremove wait_to_run_files $scop_file} - -# Schedule now the tests to be run. -set dg-do-what-default run - -# Flags using for run-id-* files. -set DEFAULT_FLAGS_RUN_ID "-O2 -fgraphite-identity" set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.\[fF\]{,90,95,03,08} ] ] -gfortran-dg-runtest $run_id_files $DEFAULT_FLAGS_RUN_ID -foreach run_id_file $run_id_files {lremove wait_to_run_files $run_id_file} +# Tests to be compiled. +set dg-do-what-default compile +gfortran-dg-runtest $scop_files "-O2 -fgraphite -fdump-tree-graphite-all" +gfortran-dg-runtest $id_files "-O2 -fgraphite-identity -ffast-math" +gfortran-dg-runtest $interchange_files "-O2 -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math -fdump-tree-graphite-all" +gfortran-dg-runtest $block_files "-O2 -floop-block -fno-loop-strip-mine -fno-loop-interchange -ffast-math -fdump-tree-graphite-all" + +# Tests to be run. +set dg-do-what-default run +gfortran-dg-runtest $run_id_files "-O2 -fgraphite-identity" # The default action for the rest of the files is 'compile'. set dg-do-what-default compile - -# Flags using for other files. -set DEFAULT_GRAPHITE_FLAGS "" -gfortran-dg-runtest $wait_to_run_files $DEFAULT_GRAPHITE_FLAGS +foreach f $block_files {lremove wait_to_run_files $f} +foreach f $id_files {lremove wait_to_run_files $f} +foreach f $interchange_files {lremove wait_to_run_files $f} +foreach f $scop_files {lremove wait_to_run_files $f} +foreach f $run_id_files {lremove wait_to_run_files $f} +gfortran-dg-runtest $wait_to_run_files "" # Clean up. set dg-do-what-default ${save-dg-do-what-default} diff --git a/gcc/testsuite/gfortran.dg/graphite/pr40982.f90 b/gcc/testsuite/gfortran.dg/graphite/pr40982.f90 new file mode 100644 index 00000000000..b9641aef031 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/pr40982.f90 @@ -0,0 +1,69 @@ +! { dg-options "-O3 -fgraphite-identity -floop-interchange " } + +module mqc_m + + +implicit none + +private +public :: mutual_ind_quad_cir_coil + +integer, parameter, private :: longreal = selected_real_kind(15,90) +real (kind = longreal), parameter, private :: pi = 3.141592653589793_longreal +real (kind = longreal), parameter, private :: small = 1.0e-10_longreal + +contains + + subroutine mutual_ind_quad_cir_coil (r_coil, x_coil, y_coil, z_coil, h_coil, n_coil, & + rotate_coil, m, mu, l12) + real (kind = longreal), intent(in) :: r_coil, x_coil, y_coil, z_coil, h_coil, n_coil, & + mu + real (kind = longreal), dimension(:,:), intent(in) :: rotate_coil + integer, intent(in) :: m + real (kind = longreal), intent(out) :: l12 + real (kind = longreal), dimension(3,3) :: rotate_quad + real (kind = longreal), dimension(9), save :: x2gauss, y2gauss, w2gauss, z1gauss, & + w1gauss + real (kind = longreal) :: xxvec, xyvec, xzvec, yxvec, yyvec, yzvec, zxvec, zyvec, & + zzvec, magnitude, l12_lower, l12_upper, dx, dy, dz, theta, & + a, b1, b2, numerator, denominator, coefficient, angle + real (kind = longreal), dimension(3) :: c_vector, q_vector, rot_c_vector, & + rot_q_vector, current_vector, & + coil_current_vec, coil_tmp_vector + integer :: i, j, k + logical, save :: first = .true. + + do i = 1, 2*m + theta = pi*real(i,longreal)/real(m,longreal) + c_vector(1) = r_coil * cos(theta) + c_vector(2) = r_coil * sin(theta) + coil_tmp_vector(1) = -sin(theta) + coil_tmp_vector(2) = cos(theta) + coil_tmp_vector(3) = 0.0_longreal + coil_current_vec(1) = dot_product(rotate_coil(1,:),coil_tmp_vector(:)) + coil_current_vec(2) = dot_product(rotate_coil(2,:),coil_tmp_vector(:)) + coil_current_vec(3) = dot_product(rotate_coil(3,:),coil_tmp_vector(:)) + do j = 1, 9 + c_vector(3) = 0.5 * h_coil * z1gauss(j) + rot_c_vector(1) = dot_product(rotate_coil(1,:),c_vector(:)) + dx + rot_c_vector(2) = dot_product(rotate_coil(2,:),c_vector(:)) + dy + rot_c_vector(3) = dot_product(rotate_coil(3,:),c_vector(:)) + dz + do k = 1, 9 + q_vector(1) = 0.5_longreal * a * (x2gauss(k) + 1.0_longreal) + q_vector(2) = 0.5_longreal * b1 * (y2gauss(k) - 1.0_longreal) + q_vector(3) = 0.0_longreal + rot_q_vector(1) = dot_product(rotate_quad(1,:),q_vector(:)) + rot_q_vector(2) = dot_product(rotate_quad(2,:),q_vector(:)) + rot_q_vector(3) = dot_product(rotate_quad(3,:),q_vector(:)) + numerator = w1gauss(j) * w2gauss(k) * & + dot_product(coil_current_vec,current_vector) + denominator = sqrt(dot_product(rot_c_vector-rot_q_vector, & + rot_c_vector-rot_q_vector)) + l12_lower = l12_lower + numerator/denominator + end do + end do + end do + l12 = coefficient * (b1 * l12_lower + b2 * l12_upper) + end subroutine mutual_ind_quad_cir_coil + +end module mqc_m diff --git a/gcc/testsuite/gfortran.dg/graphite/run-id-1.f b/gcc/testsuite/gfortran.dg/graphite/run-id-1.f new file mode 100644 index 00000000000..521d268f37a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/run-id-1.f @@ -0,0 +1,47 @@ + subroutine mul66(rt,rtt,r) + real*8 rt(6,6),r(6,6),rtt(6,6) + do i=1,6 + do j=1,6 + do ia=1,6 + rtt(i,ia)=rt(i,j)*r(j,ia)+rtt(i,ia) + end do + end do + end do + end + + program test + real*8 xj(6,6),w(6,6),w1(6,6) + parameter(idump=0) + integer i,j + + do i=1,6 + do j=1,6 + xj(i,j) = 0.0d0 + w1(i,j) = 0.0d0 + w(i,j) = i * 10.0d0 + j; + end do + end do + + xj(1,2) = 1.0d0 + xj(2,1) = -1.0d0 + xj(3,4) = 1.0d0 + xj(4,3) = -1.0d0 + xj(5,6) = 1.0d0 + xj(6,5) = -1.0d0 + + call mul66(xj,w1,w) + + if (idump.ne.0) then + write(6,*) 'w1 after call to mul66' + do i = 1,6 + do j = 1,6 + write(6,'(D15.7)') w1(i,j) + end do + end do + end if + + if (w1(1,1).ne.21.0d0) then + call abort() + end if + + end diff --git a/gcc/testsuite/gfortran.dg/read_no_eor.f90 b/gcc/testsuite/gfortran.dg/read_no_eor.f90 new file mode 100644 index 00000000000..118816405bc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/read_no_eor.f90 @@ -0,0 +1,46 @@ +! { dg-do run } +! Handle eor and eof conditions with missing eor in file. +! Test case modified from case presented by Ian Harvey on clf. +program eieio_stat + use, intrinsic :: iso_fortran_env, only: iostat_end, iostat_eor + implicit none + integer, parameter :: unit=10 + integer :: ios1, ios2, ios3 + character(25) :: buffer + character(100) :: themessage + !**** + open(10,file="eieio", form="unformatted", access="stream", status="replace") + write(10) "Line-1" // char(10) + write(10) "Line-2" + close(10) + + open(10,file="eieio") + + buffer = 'abcdefg' + read (unit,"(a)",advance="no",iostat=ios1, pad="yes") buffer + if (ios1 /= iostat_eor .and. buffer /= "Line-1") call abort + + buffer = '<' + read (unit,"(a)",advance="no",iostat=ios2,pad="yes") buffer + if (ios2 /= iostat_eor .and. buffer /= "Line-2") call abort + + buffer = '5678' + read (unit,"(a)",advance="no",iostat=ios3, iomsg=themessage) buffer + if (ios3 /= iostat_end .and. buffer /= "5678") call abort + + rewind(10) + + buffer = "abcdefg" + read (unit,"(a)",advance="no",iostat=ios1, pad="no") buffer + if (ios1 /= iostat_eor .and. buffer /= "abcdefg") call abort + + buffer = '<' + read (unit,"(a)",advance="no",iostat=ios2,pad="no") buffer + if (ios2 /= iostat_eor .and. buffer /= "<") call abort + + buffer = '1234' + read (unit,"(a)",advance="no",iostat=ios3, iomsg=themessage) buffer + if (ios3 <= 0 .and. buffer /= "1234") call abort + + close(unit, status="delete") +end program eieio_stat diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog index a02b1740f01..84291be5dcd 100644 --- a/libcpp/po/ChangeLog +++ b/libcpp/po/ChangeLog @@ -1,5 +1,9 @@ 2010-02-05 Joseph Myers <joseph@codesourcery.com> + * sv.po: Update. + +2010-02-05 Joseph Myers <joseph@codesourcery.com> + * be.po, ca.po, da.po, de.po, el.po, es.po, fr.po, id.po, ja.po, nl.po, sv.po, tr.po, uk,po, vi.po, zh_CN.po, zh_TW.po: Update. diff --git a/libcpp/po/sv.po b/libcpp/po/sv.po index 47dad1fa6f7..277fc73dd10 100644 --- a/libcpp/po/sv.po +++ b/libcpp/po/sv.po @@ -1,17 +1,17 @@ # This file is distributed under the same license as the gcc package. # Swedish messages for cpplib. -# Copyright © 2000, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright © 2000, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # Dennis Björklund <db@zigo.dhs.org>, 2000, 2001, 2002. -# Göran Uddeborg <goeran@uddeborg.se>, 2005, 2006, 2007, 2008, 2009. +# Göran Uddeborg <goeran@uddeborg.se>, 2005, 2006, 2007, 2008, 2009, 2010. # # Remember: GCC team does not want RCS keywords in the header! # msgid "" msgstr "" -"Project-Id-Version: cpplib 4.5-b20091203\n" +"Project-Id-Version: cpplib 4.5-b20100204\n" "Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n" "POT-Creation-Date: 2010-01-11 11:42+0000\n" -"PO-Revision-Date: 2009-12-04 22:41+0100\n" +"PO-Revision-Date: 2010-02-05 21:39+0100\n" "Last-Translator: Göran Uddeborg <goeran@uddeborg.se>\n" "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" "MIME-Version: 1.0\n" @@ -435,9 +435,8 @@ msgid "invalid prefix \"0b\" for floating constant" msgstr "ogiltigt prefix \"0b\" på flyttalskonstant" #: expr.c:339 -#, fuzzy msgid "no digits in hexadecimal floating constant" -msgstr "användning av hexadecimal flyttalskonstant enligt C99" +msgstr "inga siffror i hexadecimal flyttalskonstant" #: expr.c:343 msgid "use of C99 hexadecimal floating constant" diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index c77b018e8dd..be54763e96f 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2010-02-06 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran + * io/transfer.c (read_sf): Handle EOR and EOF conditions for + ADVANCE="no" with PAD="yes" or PAD="no". + 2010-02-03 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/42901 diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index a110c6529ff..e627a1c7590 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -305,7 +305,20 @@ read_sf (st_parameter_dt *dtp, int * length, int no_error) if (lorig > *length && !dtp->u.p.sf_seen_eor && !seen_comma) { if (n > 0 || no_error) - dtp->u.p.at_eof = 1; + { + if (dtp->u.p.advance_status == ADVANCE_NO) + { + if (dtp->u.p.current_unit->pad_status == PAD_NO) + { + hit_eof (dtp); + return NULL; + } + else + dtp->u.p.eor_condition = 1; + } + else + dtp->u.p.at_eof = 1; + } else { hit_eof (dtp); diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 410a15cea5d..863d5513833 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2010-02-06 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/42989 + * config/abi/pre/gnu.ver: Fix wstring move assignment operator typo. + +2010-02-06 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/27340 + * include/bits/valarray_before.h: Uglify the structs wrapping + cmath functions differently, eg, _Cos instead of __cos. + * include/bits/valarray_after.h: Adjust. + 2010-02-05 Paolo Carlini <paolo.carlini@oracle.com> * include/std/future (swap(packaged_task<>&, packaged_task<>&)): Fix diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 447b63ede49..04c0f7c0a8f 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1104,7 +1104,7 @@ GLIBCXX_3.4.14 { _ZNSsC1EOSs; _ZNSbIwSt11char_traitsIwESaIwEEC1EOS2_; _ZNSsaSEOSs; - _ZNSbIwSt11char_traitsIwESaIwEEC1EOS2_; + _ZNSbIwSt11char_traitsIwESaIwEEaSEOS2_; _ZNSs6assignEOSs; _ZNSbIwSt11char_traitsIwESaIwEE6assignEOS2_; diff --git a/libstdc++-v3/include/bits/valarray_after.h b/libstdc++-v3/include/bits/valarray_after.h index e4093f1b695..070840e3452 100644 --- a/libstdc++-v3/include/bits/valarray_after.h +++ b/libstdc++-v3/include/bits/valarray_after.h @@ -1,7 +1,7 @@ // The template and inlines for the -*- C++ -*- internal _Meta class. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2009 Free Software Foundation, Inc. +// 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -419,128 +419,128 @@ _GLIBCXX_BEGIN_NAMESPACE(std) #undef _DEFINE_EXPR_BINARY_OPERATOR -#define _DEFINE_EXPR_UNARY_FUNCTION(_Name) \ +#define _DEFINE_EXPR_UNARY_FUNCTION(_Name, _UName) \ template<class _Dom> \ - inline _Expr<_UnClos<__##_Name, _Expr, _Dom>, \ + inline _Expr<_UnClos<_UName, _Expr, _Dom>, \ typename _Dom::value_type> \ _Name(const _Expr<_Dom, typename _Dom::value_type>& __e) \ { \ typedef typename _Dom::value_type _Tp; \ - typedef _UnClos<__##_Name, _Expr, _Dom> _Closure; \ + typedef _UnClos<_UName, _Expr, _Dom> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__e())); \ } \ \ template<typename _Tp> \ - inline _Expr<_UnClos<__##_Name, _ValArray, _Tp>, _Tp> \ + inline _Expr<_UnClos<_UName, _ValArray, _Tp>, _Tp> \ _Name(const valarray<_Tp>& __v) \ { \ - typedef _UnClos<__##_Name, _ValArray, _Tp> _Closure; \ + typedef _UnClos<_UName, _ValArray, _Tp> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__v)); \ } - _DEFINE_EXPR_UNARY_FUNCTION(abs) - _DEFINE_EXPR_UNARY_FUNCTION(cos) - _DEFINE_EXPR_UNARY_FUNCTION(acos) - _DEFINE_EXPR_UNARY_FUNCTION(cosh) - _DEFINE_EXPR_UNARY_FUNCTION(sin) - _DEFINE_EXPR_UNARY_FUNCTION(asin) - _DEFINE_EXPR_UNARY_FUNCTION(sinh) - _DEFINE_EXPR_UNARY_FUNCTION(tan) - _DEFINE_EXPR_UNARY_FUNCTION(tanh) - _DEFINE_EXPR_UNARY_FUNCTION(atan) - _DEFINE_EXPR_UNARY_FUNCTION(exp) - _DEFINE_EXPR_UNARY_FUNCTION(log) - _DEFINE_EXPR_UNARY_FUNCTION(log10) - _DEFINE_EXPR_UNARY_FUNCTION(sqrt) + _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs) + _DEFINE_EXPR_UNARY_FUNCTION(cos, _Cos) + _DEFINE_EXPR_UNARY_FUNCTION(acos, _Acos) + _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh) + _DEFINE_EXPR_UNARY_FUNCTION(sin, _Sin) + _DEFINE_EXPR_UNARY_FUNCTION(asin, _Asin) + _DEFINE_EXPR_UNARY_FUNCTION(sinh, _Sinh) + _DEFINE_EXPR_UNARY_FUNCTION(tan, _Tan) + _DEFINE_EXPR_UNARY_FUNCTION(tanh, _Tanh) + _DEFINE_EXPR_UNARY_FUNCTION(atan, _Atan) + _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp) + _DEFINE_EXPR_UNARY_FUNCTION(log, _Log) + _DEFINE_EXPR_UNARY_FUNCTION(log10, _Log10) + _DEFINE_EXPR_UNARY_FUNCTION(sqrt, _Sqrt) #undef _DEFINE_EXPR_UNARY_FUNCTION -#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun) \ +#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun, _UFun) \ template<class _Dom1, class _Dom2> \ - inline _Expr<_BinClos<__##_Fun, _Expr, _Expr, _Dom1, _Dom2>, \ + inline _Expr<_BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2>, \ typename _Dom1::value_type> \ _Fun(const _Expr<_Dom1, typename _Dom1::value_type>& __e1, \ - const _Expr<_Dom2, typename _Dom2::value_type>& __e2) \ + const _Expr<_Dom2, typename _Dom2::value_type>& __e2) \ { \ typedef typename _Dom1::value_type _Tp; \ - typedef _BinClos<__##_Fun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \ + typedef _BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2())); \ } \ \ template<class _Dom> \ - inline _Expr<_BinClos<__##_Fun, _Expr, _ValArray, _Dom, \ + inline _Expr<_BinClos<_UFun, _Expr, _ValArray, _Dom, \ typename _Dom::value_type>, \ typename _Dom::value_type> \ _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ const valarray<typename _Dom::value_type>& __v) \ { \ typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<__##_Fun, _Expr, _ValArray, _Dom, _Tp> _Closure; \ + typedef _BinClos<_UFun, _Expr, _ValArray, _Dom, _Tp> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__e(), __v)); \ } \ \ template<class _Dom> \ - inline _Expr<_BinClos<__##_Fun, _ValArray, _Expr, \ + inline _Expr<_BinClos<_UFun, _ValArray, _Expr, \ typename _Dom::value_type, _Dom>, \ typename _Dom::value_type> \ _Fun(const valarray<typename _Dom::valarray>& __v, \ const _Expr<_Dom, typename _Dom::value_type>& __e) \ { \ typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<__##_Fun, _ValArray, _Expr, _Tp, _Dom> _Closure; \ + typedef _BinClos<_UFun, _ValArray, _Expr, _Tp, _Dom> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__v, __e())); \ } \ \ template<class _Dom> \ - inline _Expr<_BinClos<__##_Fun, _Expr, _Constant, _Dom, \ + inline _Expr<_BinClos<_UFun, _Expr, _Constant, _Dom, \ typename _Dom::value_type>, \ typename _Dom::value_type> \ _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ const typename _Dom::value_type& __t) \ { \ typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<__##_Fun, _Expr, _Constant, _Dom, _Tp> _Closure;\ + typedef _BinClos<_UFun, _Expr, _Constant, _Dom, _Tp> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__e(), __t)); \ } \ \ template<class _Dom> \ - inline _Expr<_BinClos<__##_Fun, _Constant, _Expr, \ + inline _Expr<_BinClos<_UFun, _Constant, _Expr, \ typename _Dom::value_type, _Dom>, \ typename _Dom::value_type> \ _Fun(const typename _Dom::value_type& __t, \ const _Expr<_Dom, typename _Dom::value_type>& __e) \ { \ typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<__##_Fun, _Constant, _Expr, _Tp, _Dom> _Closure; \ + typedef _BinClos<_UFun, _Constant, _Expr, _Tp, _Dom> _Closure; \ return _Expr<_Closure, _Tp>(_Closure(__t, __e())); \ } \ \ template<typename _Tp> \ - inline _Expr<_BinClos<__##_Fun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \ + inline _Expr<_BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \ _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ { \ - typedef _BinClos<__##_Fun, _ValArray, _ValArray, _Tp, _Tp> _Closure; \ + typedef _BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp> _Closure;\ return _Expr<_Closure, _Tp>(_Closure(__v, __w)); \ } \ \ template<typename _Tp> \ - inline _Expr<_BinClos<__##_Fun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \ + inline _Expr<_BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \ _Fun(const valarray<_Tp>& __v, const _Tp& __t) \ { \ - typedef _BinClos<__##_Fun, _ValArray, _Constant, _Tp, _Tp> _Closure; \ + typedef _BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp> _Closure;\ return _Expr<_Closure, _Tp>(_Closure(__v, __t)); \ } \ \ template<typename _Tp> \ - inline _Expr<_BinClos<__##_Fun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \ + inline _Expr<_BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \ _Fun(const _Tp& __t, const valarray<_Tp>& __v) \ { \ - typedef _BinClos<__##_Fun, _Constant, _ValArray, _Tp, _Tp> _Closure; \ + typedef _BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp> _Closure;\ return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \ } -_DEFINE_EXPR_BINARY_FUNCTION(atan2) -_DEFINE_EXPR_BINARY_FUNCTION(pow) +_DEFINE_EXPR_BINARY_FUNCTION(atan2, _Atan2) +_DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow) #undef _DEFINE_EXPR_BINARY_FUNCTION diff --git a/libstdc++-v3/include/bits/valarray_before.h b/libstdc++-v3/include/bits/valarray_before.h index 444129be674..3bc85a3e07e 100644 --- a/libstdc++-v3/include/bits/valarray_before.h +++ b/libstdc++-v3/include/bits/valarray_before.h @@ -1,7 +1,7 @@ // The template and inlines for the -*- C++ -*- internal _Meta class. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2009 Free Software Foundation, Inc. +// 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -59,98 +59,98 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // 2) efficiency -- object functions can be easily inlined // 3) be Koenig-lookup-friendly - struct __abs + struct _Abs { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return abs(__t); } }; - struct __cos + struct _Cos { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return cos(__t); } }; - struct __acos + struct _Acos { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return acos(__t); } }; - struct __cosh + struct _Cosh { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return cosh(__t); } }; - struct __sin + struct _Sin { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return sin(__t); } }; - struct __asin + struct _Asin { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return asin(__t); } }; - struct __sinh + struct _Sinh { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return sinh(__t); } }; - struct __tan + struct _Tan { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return tan(__t); } }; - struct __atan + struct _Atan { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return atan(__t); } }; - struct __tanh + struct _Tanh { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return tanh(__t); } }; - struct __exp + struct _Exp { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return exp(__t); } }; - struct __log + struct _Log { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return log(__t); } }; - struct __log10 + struct _Log10 { template<typename _Tp> _Tp operator()(const _Tp& __t) const { return log10(__t); } }; - struct __sqrt + struct _Sqrt { template<typename _Tp> _Tp operator()(const _Tp& __t) const @@ -269,7 +269,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) struct __logical_not { template<typename _Tp> - bool operator()(const _Tp& __x) const { return !__x; } + bool operator()(const _Tp& __x) const + { return !__x; } }; struct __equal_to @@ -315,14 +316,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) }; // The few binary functions we miss. - struct __atan2 + struct _Atan2 { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const { return atan2(__x, __y); } }; - struct __pow + struct _Pow { template<typename _Tp> _Tp operator()(const _Tp& __x, const _Tp& __y) const |