This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Improved driver for vectorizer testsuite



There's been talk before (and even a PR) about having these tests run
multiple times for platforms like x86 that support multiple kinds of
vector instructions. With vectorization of generic vectors, the tests
ought to be run with and without hardware vector support as well. You
don't need to handle that here; I'll add it to the PR.


Is this patch ok? I tested it on top of my patches on powerpc-apple-darwin with no new failure and the same new passes.

It does not need the other patches to be installed.

Paolo
2004-04-06  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/vect/vect.exp: Rework so that per-target options for SIMD
	are not passed unless the test uses dg-require-effective-target.  Go
	through the testsuite even if there is no hardware SIMD support.

Index: vect.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/vect/vect.exp,v
retrieving revision 1.10
diff -p -u -r1.10 vect.exp
--- vect.exp	7 Feb 2005 10:07:07 -0000	1.10
+++ vect.exp	8 Apr 2005 08:30:10 -0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2004, 2005 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
@@ -20,67 +20,96 @@
 load_lib gcc-dg.exp
 
 # Set up flags used for tests that don't specify options.
-set DEFAULT_VECTCFLAGS ""
-
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" \
-  "-ftree-vectorizer-verbose=3" "-fdump-tree-vect-stats"
+set DEFAULT_VECTCFLAGS [list "-ftree-vectorize" \
+  "-ftree-vectorizer-verbose=3" "-fdump-tree-vect-stats"]
 
-# If the target system supports vector instructions, the default action
-# for a test is 'run', otherwise it's 'compile'.  Save current default.
-# Executing vector instructions on a system without hardware vector support
-# is also disabled by a call to check_vect, but disabling execution here is
-# more efficient.
-global dg-do-what-default
-set save-dg-do-what-default ${dg-do-what-default}
-
-# Skip these tests for targets that do not support generating vector
-# code.  Set additional target-dependent vector flags, which can be
-# overridden by using dg-options in individual tests.
+# Flags that are tried for targets that do support generating vector
+# code; using these flags is enabled by dg-require-effective-target.
+# An empty list means that the test will effectively be skipped.
+set TARGET_VECTCFLAGS_LIST [list]
+
+# Set additional target-dependent vector flags, which can be overridden
+# by using dg-options in individual tests.  Also, if the target system
+# supports vector instructions, the default action for tests requiring
+# vect_* is 'run', otherwise it's 'compile'.  Vector support is also
+# disabled by a call to check_vect, but disabling the test here is more
+# efficient; see also for Alpha.
 if [istarget "powerpc*-*-*"] {
-    # If there are powerpc targets to skip, do it here.
-
-    lappend DEFAULT_VECTCFLAGS "-maltivec"
     if [check_vmx_hw_available] {
-	set dg-do-what-default run
+ 	set target-dg-do-what-default run
+        lappend TARGET_VECTCFLAGS_LIST [list "-maltivec"]
     } else {
 	if [is-effective-target ilp32] {
 	    # Specify a cpu that supports VMX for compile-only tests.
-	    lappend DEFAULT_VECTCFLAGS "-mcpu=7400"
+	    lappend TARGET_VECTCFLAGS_LIST [list "-maltivec -mcpu=7400"]
 	}
-	set dg-do-what-default compile
+	set target-dg-do-what-default compile
     }
 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
-    lappend DEFAULT_VECTCFLAGS "-msse2"
-    set dg-do-what-default run
+    lappend TARGET_VECTCFLAGS_LIST [list "-msse2"]
+    set target-dg-do-what-default run
 } elseif [istarget "mipsisa64*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mpaired-single"
-    set dg-do-what-default run
+    lappend TARGET_VECTCFLAGS_LIST [list "-mpaired-single"]
+    set target-dg-do-what-default run
 } elseif [istarget "sparc*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
-    set dg-do-what-default run
+    lappend TARGET_VECTCFLAGS_LIST [list "-mcpu=ultrasparc" "-mvis"]
+    set target-dg-do-what-default run
 } elseif [istarget "alpha*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mmax"
+    lappend TARGET_VECTCFLAGS_LIST [list "-mmax"]
     if [check_alpha_max_hw_available] {
-	set dg-do-what-default run
+	set target-dg-do-what-default run
     } else {
-	set dg-do-what-default compile
+ 	set target-dg-do-what-default compile
     }
 } elseif [istarget "ia64-*-*"] {
-    set dg-do-what-default run
+    set target-dg-do-what-default run
+    lappend TARGET_VECTCFLAGS_LIST [list]
 } else {
-    return
+    # Set to a dummy value: the dg-require-effective-target will cause
+    # the test to be skipped anyway.
+    set target-dg-do-what-default compile
+    lappend TARGET_VECTCFLAGS_LIST [list]
+}
+
+proc vect-dg-runtest { testcases default-extra-flags } {
+    global runtests DEFAULT_VECTCFLAGS TARGET_VECTCFLAGS_LIST
+    global dg-do-what-default target-dg-do-what-default
+
+    foreach test $testcases {
+        # If we're only testing specific files and this isn't one of
+        # them, skip it.
+        if ![runtest_file_p $runtests $test] {
+            continue
+        }
+
+	set save-dg-do-what-default ${dg-do-what-default}
+
+        if [expr [search_for $test "dg-require*vect_"] + \
+		 [search_for $test "&& vect_"]] {
+            set option_list $TARGET_VECTCFLAGS_LIST
+	    set dg-do-what-default ${target-dg-do-what-default}
+        } else {
+            set option_list [list ""]
+        }
+
+        set nshort [file tail [file dirname $test]]/[file tail $test]
+
+        foreach flags $option_list {
+            verbose "Testing $nshort, $flags" 1
+            dg-test $test [concat $DEFAULT_VECTCFLAGS $flags] \
+			  ${default-extra-flags}
+        }
+
+	set dg-do-what-default ${save-dg-do-what-default}
+    }
 }
 
 # Initialize `dg'.
 dg-init
 
 # Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]]  \
-	"" $DEFAULT_VECTCFLAGS
-
-# Clean up.
-set dg-do-what-default ${save-dg-do-what-default}
+vect-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2"
 
 # All done.
 dg-finish

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]