This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[testsuite] Compile gfortran.dg/graphite/vect-pr40979.f90 with -msse2 on x86 (PR tree-optimization/48497)
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Mike Stump <mikestump at comcast dot net>, fortran at gcc dot gnu dot org
- Date: Mon, 06 Jun 2011 19:01:51 +0200
- Subject: [testsuite] Compile gfortran.dg/graphite/vect-pr40979.f90 with -msse2 on x86 (PR tree-optimization/48497)
As described in the PR, gfortran.dg/graphite/vect-pr40979.f90 FAILs on
Solaris 8 and 9/x86, which defaults to -march=pentiumpro:
FAIL: gfortran.dg/graphite/vect-pr40979.f90 -O scan-tree-dump-times vect "vectorized 1 loops" 1
The dump contains 'vectorized 0 loops' instead. The test passes with
-march=pentium4 and also with -msse2. Since the test is compiled with a
long bunch of options, it seemed inappropriate to use dg-options and
repeat that list, just to add -msse2. Instead, I've chosen to implement
dg-additional-options, which unlike dg-options just adds to the list of
default options.
I've missed this facility myself many times, and it seems like a
straightforward addition.
Bootstrapped without regressions on i386-pc-solaris2.8 and
i386-pc-solaris2.11, will commit to mainline in a day or two unless
someone objects.
Rainer
2011-05-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc:
PR tree-optimization/48497
* doc/sourcebuild.texi (Directives, dg-additional-options): Document.
gcc/testsuite:
PR tree-optimization/48497
* lib/gcc-defs.exp (dg-additional-options): New proc.
* gfortran.dg/graphite/vect-pr40979.f90: Use dg-additional-options
-msse2 on 32-bit x86.
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1016,6 +1016,11 @@ This directive does nothing on targets t
default, or that don't provide them at all. It must come after
all @code{dg-options} directives.
For supported values of @var{feature} see @ref{Add Options, ,}.
+
+@item @{ dg-additional-options @var{options} [@{ target @var{selector} @}] @}
+This directive provides a list of compiler options, to be used
+if the target system matches @var{selector}, that are added to the default
+options used for this set of tests.
@end table
@subsubsection Modify the test timeout value
diff --git a/gcc/testsuite/gfortran.dg/graphite/vect-pr40979.f90 b/gcc/testsuite/gfortran.dg/graphite/vect-pr40979.f90
--- a/gcc/testsuite/gfortran.dg/graphite/vect-pr40979.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/vect-pr40979.f90
@@ -1,5 +1,6 @@
! { dg-do compile }
! { dg-require-effective-target vect_double }
+! { dg-additional-options "-msse2" { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
module mqc_m
integer, parameter, private :: longreal = selected_real_kind(15,90)
diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -183,6 +183,28 @@ if { [info procs runtest_file_p] == "" }
}
}
+# Like dg-options, but adds to the default options rather than replacing them.
+
+proc dg-additional-options { args } {
+ upvar dg-extra-tool-flags extra-tool-flags
+
+ if { [llength $args] > 3 } {
+ error "[lindex $args 0]: too many arguments"
+ return
+ }
+
+ if { [llength $args] >= 3 } {
+ switch [dg-process-target [lindex $args 2]] {
+ "S" { eval lappend extra-tool-flags [lindex $args 1] }
+ "N" { }
+ "F" { error "[lindex $args 0]: `xfail' not allowed here" }
+ "P" { error "[lindex $args 0]: `xfail' not allowed here" }
+ }
+ } else {
+ eval lappend extra-tool-flags [lindex $args 1]
+ }
+}
+
# Record additional sources files that must be compiled along with the
# main source file.
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University