HI Aldy, Joseph et al., Attached, please find a fixed patch. Please see my responses to Aldy's questions below:
> -----Original Message----- > From: Aldy Hernandez [mailto:al...@redhat.com] > Sent: Wednesday, March 20, 2013 12:33 PM > To: Joseph S. Myers > Cc: Iyer, Balaji V; gcc-patches > Subject: Re: [patch] cilkplus array notation for C (clean, independent > patchset, > take 1) > > On 03/20/13 10:30, Aldy Hernandez wrote: > > > > I have found some little nits that I will point out in a reply to this > > message. > > > > Joseph, folks, et al... How does this look? > > > > Thanks. > > Balaji: > > > +void > > +array_notation_init_builtins (void) > > +{ > > + tree func_type = NULL_TREE; > > + tree new_func = NULL_TREE; > > + func_type = build_function_type_list (integer_type_node, ptr_type_node, > > + NULL_TREE); > > + new_func = build_fn_decl ("__sec_reduce_add", func_type); > > + mark_cold (new_func); > > + new_func = lang_hooks.decls.pushdecl (new_func); > etc > etc > > All these builtins need to be documented in doc/. DONE! > > > +load_lib gcc-dg.exp > > + > > +dg-init > > +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -fcilkplus" " " > > +dg-finish > > + > > +dg-init > > +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O0 > > -fcilkplus" " " > > +dg-finish > > + > > +dg-init > > +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O1 > > -fcilkplus" " " > > +dg-finish > etc > etc > > Can't you do all these dg-runtest's within one pair of dg-init/dg-finish? > Similarly > for the other .exp files. The reason why I did these is so that we can easily isolate the errors to one run if necessary. I fixed them as you requested. > > As I'd mentioned, you have .exp files named compile.exp and execute.exp which > seem to be causing ambiguity problems in parallel checks (make check -jN). > For > some reason, with this patch, the rest of dg.exp fails to run after Cilkplus' > compile/execute.exp runs. Renaming these to something less generic does the > trick. Do you mind prefixing all the .exp's with "cilkplus_" or something > similar? FIXED! I added the "cilkplus_AN_c_" prefix to everything, where "an" stands for Array Notation . This way it won't interfere with the future Cilk Plus patches' test case. > > [Perhaps someone can pontificate as to what the actual problem is here and > describe it. Dejagnu is a mystery to me.] > > > diff --git > > a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/errors.exp > > b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/errors.exp > > new file mode 100644 > > index 0000000..6d7604b > > --- /dev/null > > +++ b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/errors.exp > > @@ -0,0 +1,65 @@ > > +# Copyright (C) 2013 Free Software Foundation, Inc. > > + > > +# This program is free software; you can redistribute it and/or > > +modify # it under the terms of the GNU General Public License as > > +published by # the Free Software Foundation; either version 3 of the > > +License, or # (at your option) any later version. > > +# > > +# This program is distributed in the hope that it will be useful, # > > +but WITHOUT ANY WARRANTY; without even the implied warranty of # > > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU > > +General Public License for more details. > > +# > > +# You should have received a copy of the GNU General Public License # > > +along with GCC; see the file COPYING3. If not see # > > +<http://www.gnu.org/licenses/>. > > + > > +# Written by Balaji V. Iyer <balaji.v.i...@intel.com> > > + > > + > > +load_lib gcc-dg.exp > > + > > +dg-init > > +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -fcilkplus" " " > > +dg-finish > > + > > +dg-init > > +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O0 > > -fcilkplus" " " > > +dg-finish > > + > > +dg-init > > +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O1 > > -fcilkplus" " " > > +dg-finish > > If these are mere syntax error tests, I suggest you get rid of all the > optimization > variants. Surely there is no need to test the error at -O, then at -O2, etc. > -O0 > should suffice. For that matter, you shouldn't pass any optimization flag > and let > the test itself set the flags with "// dg-options" or whatever in the test > itself (if > for some reason you have a test that has one particular error only reportable > at > some optimization level). I did this purely as a safety measure for the commonly used flags that I know of. If it won't cause too much of a problem I would like to keep it. > > And please make sure there are no regressions on the branch when checking > with "make check -k -jN" (N > 1) and for a plain serial check-- at least > while we > iron out this dejagnu setup. It works for make -j8 check on my 8 core machine. Thanks, Balaji V. Iyer.
diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi index 045f964..81b6502 100644 --- a/gcc/doc/passes.texi +++ b/gcc/doc/passes.texi @@ -125,7 +125,25 @@ inside conditions, they are transformed using the function @code{fix_conditional_array_notations}. The C language-specific routines are located in @file{c/c-array-notation.c} and the equivalent C++ routines are in file @file{cp/cp-array-notation.c}. Common routines such as functions to -initialize builtin functions are stored in @file{array-notation-common.c}. +initialize builtin functions are stored in @file{array-notation-common.c}. In +the current array notation implementation there are 12 builtin reduction +operations. Details about these functions and their usage are available in +the Cilk Plus language specification at @w{@uref{http://www.cilkplus.org}}. + +@itemize @bullet +@item __sec_reduce_add +@item __sec_reduce_mul +@item __sec_reduce_max +@item __sec_reduce_min +@item __sec_reduce_max_ind +@item __sec_reduce_min_ind +@item __sec_reduce_all_zero +@item __sec_reduce_all_nonzero +@item __sec_reduce_any_zero +@item __sec_reduce_any_nonzero +@item __sec_reduce +@item __sec_reduce_mutating +@end itemize @end itemize Detailed information about Cilk Plus and language specification is provided in diff --git a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/array_test2.c b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/array_test2.c index 5fb3680..fd128b1 100644 --- a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/array_test2.c +++ b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/array_test2.c @@ -26,7 +26,7 @@ int main(int argc, char **argv) array[ii] = 10; array2[ii] = 5000000; } - array2[0:10:2] = array[0:10:2]; + array2[0:5:2] = array[0:5:2]; printf("==============================================\n"); for (ii = 0; ii<10; ii++) diff --git a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/cilkplus_AN_c_compile.exp b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/cilkplus_AN_c_compile.exp new file mode 100644 index 0000000..a965997 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/cilkplus_AN_c_compile.exp @@ -0,0 +1,34 @@ +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Written by Balaji V. Iyer <balaji.v.i...@intel.com> + + +load_lib gcc-dg.exp + +dg-init +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O0 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O1 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O2 -ftree-vectorize -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O3 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O0 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O1 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O2 -ftree-vectorize -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O3 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/array_notation_tests/errors/*.c]] " -O3 -ftree-vectorize -fcilkplus -g" " " +dg-finish diff --git a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/compile.exp b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/compile.exp deleted file mode 100644 index 6d7604b..0000000 --- a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/compile/compile.exp +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2013 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -# Written by Balaji V. Iyer <balaji.v.i...@intel.com> - - -load_lib gcc-dg.exp - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O0 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O1 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O2 -ftree-vectorize -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O3 -fcilkplus" " " -dg-finish - - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O0 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O1 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O2 -ftree-vectorize -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O3 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/array_notation_tests/errors/*.c]] " -O3 -ftree-vectorize -fcilkplus -g" " " -dg-finish diff --git a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/cilkplus_AN_c_errors.exp b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/cilkplus_AN_c_errors.exp new file mode 100644 index 0000000..a965997 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/cilkplus_AN_c_errors.exp @@ -0,0 +1,34 @@ +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Written by Balaji V. Iyer <balaji.v.i...@intel.com> + + +load_lib gcc-dg.exp + +dg-init +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O0 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O1 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O2 -ftree-vectorize -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O3 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O0 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O1 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O2 -ftree-vectorize -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O3 -fcilkplus" " " +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/array_notation_tests/errors/*.c]] " -O3 -ftree-vectorize -fcilkplus -g" " " +dg-finish diff --git a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/errors.exp b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/errors.exp deleted file mode 100644 index 6d7604b..0000000 --- a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/errors/errors.exp +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2013 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -# Written by Balaji V. Iyer <balaji.v.i...@intel.com> - - -load_lib gcc-dg.exp - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O0 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O1 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O2 -ftree-vectorize -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -O3 -fcilkplus" " " -dg-finish - - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O0 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O1 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O2 -ftree-vectorize -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] " -g -O3 -fcilkplus" " " -dg-finish - -dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/array_notation_tests/errors/*.c]] " -O3 -ftree-vectorize -fcilkplus -g" " " -dg-finish diff --git a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/execute/cilkplus_AN_c_execute.exp b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/execute/cilkplus_AN_c_execute.exp new file mode 100644 index 0000000..37d22c5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/execute/cilkplus_AN_c_execute.exp @@ -0,0 +1,60 @@ +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# This file was written by Balaji V. Iyer <balaji.v.i...@intel.com> +# Many thanks to the GCC C-torture contributors. + +verbose "$tool $libdir" 1 + +set library_var [get_multilibs] +dg-init +set CILK_TORTURE_OPTIONS [list \ + { -O0 -fcilkplus -std=c99} \ + { -O1 -fcilkplus -std=c99} \ + { -O2 -fcilkplus -std=c99} \ + { -O3 -fcilkplus -fomit-frame-pointer -funroll-loops -std=c99} \ + { -O3 -fcilkplus -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 } \ + { -O3 -fcilkplus -fomit-frame-pointer -funroll-all-loops -finline-functions -ftree-vectorize -std=c99 } \ + { -O3 -g -fcilkplus -std=c99} \ + { -Os -fcilkplus -std=c99} ] + + + +if $tracelevel then { + strace $tracelevel +} + +# load support procs +load_lib torture-options.exp +load_lib c-torture.exp + +torture-init +set-torture-options $CILK_TORTURE_OPTIONS {{}} $CILK_TORTURE_OPTIONS + +# +# main test loop +# + +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + c-torture-execute $src +} + +torture-finish diff --git a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/execute/execute.exp b/gcc/testsuite/gcc.dg/cilk-plus/array_notation/execute/execute.exp deleted file mode 100644 index 37d22c5..0000000 --- a/gcc/testsuite/gcc.dg/cilk-plus/array_notation/execute/execute.exp +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2013 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -# This file was written by Balaji V. Iyer <balaji.v.i...@intel.com> -# Many thanks to the GCC C-torture contributors. - -verbose "$tool $libdir" 1 - -set library_var [get_multilibs] -dg-init -set CILK_TORTURE_OPTIONS [list \ - { -O0 -fcilkplus -std=c99} \ - { -O1 -fcilkplus -std=c99} \ - { -O2 -fcilkplus -std=c99} \ - { -O3 -fcilkplus -fomit-frame-pointer -funroll-loops -std=c99} \ - { -O3 -fcilkplus -fomit-frame-pointer -funroll-all-loops -finline-functions -std=c99 } \ - { -O3 -fcilkplus -fomit-frame-pointer -funroll-all-loops -finline-functions -ftree-vectorize -std=c99 } \ - { -O3 -g -fcilkplus -std=c99} \ - { -Os -fcilkplus -std=c99} ] - - - -if $tracelevel then { - strace $tracelevel -} - -# load support procs -load_lib torture-options.exp -load_lib c-torture.exp - -torture-init -set-torture-options $CILK_TORTURE_OPTIONS {{}} $CILK_TORTURE_OPTIONS - -# -# main test loop -# - -foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { - # If we're only testing specific files and this isn't one of them, skip it. - if ![runtest_file_p $runtests $src] then { - continue - } - - c-torture-execute $src -} - -torture-finish