Index: gcc.dg/graphite/pr40281.c
===================================================================
--- gcc.dg/graphite/pr40281.c	(revision 167037)
+++ gcc.dg/graphite/pr40281.c	(working copy)
@@ -1,4 +1,3 @@
-/* { dg-do compile } */
 /* { dg-options "-O -fprefetch-loop-arrays -w" } */
 /* { dg-options "-O -fprefetch-loop-arrays -march=i686 -msse -w" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
 /* { dg-require-effective-target sse { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
Index: gcc.dg/graphite/vect-pr43423.c
===================================================================
--- gcc.dg/graphite/vect-pr43423.c	(revision 167037)
+++ gcc.dg/graphite/vect-pr43423.c	(working copy)
@@ -1,3 +1,4 @@
+/* { dg-do compile } */
 /* { dg-require-effective-target vect_int } */
 
 int a[100], b[100], c[100];
Index: gcc.dg/graphite/graphite.exp
===================================================================
--- gcc.dg/graphite/graphite.exp	(revision 167037)
+++ gcc.dg/graphite/graphite.exp	(working copy)
@@ -49,7 +49,6 @@
 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"
-dg-runtest $vect_files        "" "-O2 -fgraphite-identity -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details"
 
 # Tests to be run.
 set dg-do-what-default run
@@ -57,6 +56,14 @@
 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"
 
+# Vectorizer tests, to be run or compiled, depending on target capabilities.
+global DEFAULT_VECTFLAGS
+set DEFAULT_VECTCFLAGS "-O2 -fgraphite-identity -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details"
+
+if [check_vect_support_and_set_flags] {
+    dg-runtest $vect_files        "" $DEFAULT_VECTFLAGS
+}
+
 # The default action for the rest of the files is 'compile'.
 set dg-do-what-default compile
 foreach f $scop_files        {lremove wait_to_run_files $f}
Index: gcc.dg/graphite/pr41888.c
===================================================================
--- gcc.dg/graphite/pr41888.c	(revision 167037)
+++ gcc.dg/graphite/pr41888.c	(working copy)
@@ -1,4 +1,3 @@
-/* { dg-do compile } */
 /* { dg-options "-g -O2 -ftree-loop-distribution -fgraphite-identity" } */
 
 int
Index: gcc.dg/graphite/pr42729.c
===================================================================
--- gcc.dg/graphite/pr42729.c	(revision 167037)
+++ gcc.dg/graphite/pr42729.c	(working copy)
@@ -1,4 +1,3 @@
-/* { dg-do compile } */
 /* { dg-options "-O1 -fgraphite-identity -fcompare-debug" } */
 
 int A[10];
Index: gcc.dg/vect/vect.exp
===================================================================
--- gcc.dg/vect/vect.exp	(revision 167037)
+++ gcc.dg/vect/vect.exp	(working copy)
@@ -21,6 +21,7 @@
 load_lib gcc-dg.exp
 
 # Set up flags used for tests that don't specify options.
+global DEFAULT_VECTFLAGS
 set DEFAULT_VECTCFLAGS ""
 
 # If the target system supports vector instructions, the default action
@@ -34,85 +35,8 @@
 # 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.
-if  [istarget "powerpc-*paired*"]  {
-   lappend DEFAULT_VECTCFLAGS "-mpaired"
-    if [check_750cl_hw_available] {
-        set dg-do-what-default run 
-    } else {
-        set dg-do-what-default compile
-    }
-} elseif [istarget "powerpc*-*-*"] {
-    # Skip targets not supporting -maltivec.
-    if ![is-effective-target powerpc_altivec_ok] {
-	return
-    }
-
-    lappend DEFAULT_VECTCFLAGS "-maltivec"
-    if [check_vsx_hw_available]  {
-      lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
-    }
-
-    if [check_vmx_hw_available] {
-	set dg-do-what-default run
-    } else {
-	if [is-effective-target ilp32] {
-	    # Specify a cpu that supports VMX for compile-only tests.
-	    lappend DEFAULT_VECTCFLAGS "-mcpu=970"
-	}
-	set dg-do-what-default compile
-    }
-} elseif { [istarget  "spu-*-*"] } {
-   set dg-do-what-default run
-} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
-    lappend DEFAULT_VECTCFLAGS "-msse2"
-    if { [check_effective_target_sse2_runtime] } {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif { [istarget "mips*-*-*"]
-	   && ([check_effective_target_mpaired_single]
-		|| [check_effective_target_mips_loongson])
-	   && [check_effective_target_nomips16] } {
-    if { [check_effective_target_mpaired_single] } {
-	lappend DEFAULT_VECTCFLAGS "-mpaired-single"
-    }
-    set dg-do-what-default run
-} elseif [istarget "sparc*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
-    if [check_effective_target_ultrasparc_hw] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "alpha*-*-*"] {
-    # Alpha's vectorization capabilities are extremely limited.
-    # It's more effort than its worth disabling all of the tests
-    # that it cannot pass.  But if you actually want to see what
-    # does work, command out the return.
+if ![check_vect_support_and_set_flags] {
     return
-
-    lappend DEFAULT_VECTCFLAGS "-mmax"
-    if [check_alpha_max_hw_available] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "ia64-*-*"] {
-    set dg-do-what-default run
-} elseif [is-effective-target arm_neon_ok] {
-    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
-    # NEON does not support denormals, so is not used for vectorization by
-    # default to avoid loss of precision.  We must pass -ffast-math to test
-    # vectorization of float operations.
-    lappend DEFAULT_VECTCFLAGS "-ffast-math"
-    if [is-effective-target arm_neon_hw] {
-      set dg-do-what-default run
-    } else {
-      set dg-do-what-default compile
-    }
-} else {
-    return
 }
 
 global VEC_FLAGS
Index: g++.dg/vect/vect.exp
===================================================================
--- g++.dg/vect/vect.exp	(revision 167037)
+++ g++.dg/vect/vect.exp	(working copy)
@@ -36,6 +36,7 @@
 set save-dg-do-what-default ${dg-do-what-default}
 
 # Set up flags used for tests that don't specify options.
+global DEFAULT_VECTFLAGS
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
@@ -45,81 +46,8 @@
 # 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.
-if  [istarget "powerpc-*paired*"]  {
-   lappend DEFAULT_VECTCFLAGS "-mpaired"
-    if [check_750cl_hw_available] {
-        set dg-do-what-default run 
-    } else {
-        set dg-do-what-default compile
-    }
-} elseif [istarget "powerpc*-*-*"] {
-    # Skip targets not supporting -maltivec.
-    if ![is-effective-target powerpc_altivec_ok] {
-	return
-    }
-
-    lappend DEFAULT_VECTCFLAGS "-maltivec"
-    if [check_vsx_hw_available]  {
-      lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
-    }
-
-    if [check_vmx_hw_available] {
-	set dg-do-what-default run
-    } else {
-	if [is-effective-target ilp32] {
-	    # Specify a cpu that supports VMX for compile-only tests.
-	    lappend DEFAULT_VECTCFLAGS "-mcpu=970"
-	}
-	set dg-do-what-default compile
-    }
-} elseif { [istarget  "spu-*-*"] } {
-   set dg-do-what-default run
-} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
-    lappend DEFAULT_VECTCFLAGS "-msse2"
-    if { [check_effective_target_sse2_runtime] } {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif { [istarget "mips*-*-*"]
-	   && ([check_effective_target_mpaired_single]
-		|| [check_effective_target_mips_loongson])
-	   && [check_effective_target_nomips16] } {
-    if { [check_effective_target_mpaired_single] } {
-	lappend DEFAULT_VECTCFLAGS "-mpaired-single"
-    }
-    set dg-do-what-default run
-} elseif [istarget "sparc*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
-    if [check_effective_target_ultrasparc_hw] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "alpha*-*-*"] {
-    # Alpha's vectorization capabilities are extremely limited.
-    # It's more effort than its worth disabling all of the tests
-    # that it cannot pass.  But if you actually want to see what
-    # does work, command out the return.
+if ![check_vect_support_and_set_flags] {
     return
-
-    lappend DEFAULT_VECTCFLAGS "-mmax"
-    if [check_alpha_max_hw_available] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "ia64-*-*"] {
-    set dg-do-what-default run
-} elseif [is-effective-target arm_neon_ok] {
-    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
-    if [is-effective-target arm_neon_hw] {
-      set dg-do-what-default run
-    } else {
-      set dg-do-what-default compile
-    }
-} else {
-    return
 }
 
 # Initialize `dg'.
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 167037)
+++ lib/target-supports.exp	(working copy)
@@ -3768,3 +3768,98 @@
 proc check_effective_target_mempcpy {} {
     return [check_function_available "mempcpy"]
 }
+
+# Check whether the vectorizer tests are supported by the target and
+# append additional target-dependent compile flags to DEFAULT_VECTFLAGS.
+# Set dg-do-what-default to either compile or run, depending on target
+# capabilities.  Return 1 if vectorizer tests are supported by
+# target, 0 otherwise.
+
+proc check_vect_support_and_set_flags { } {
+    global DEFAULT_VECTCFLAGS
+    global dg-do-what-default
+
+    if  [istarget "powerpc-*paired*"]  {
+        lappend DEFAULT_VECTCFLAGS "-mpaired"
+        if [check_750cl_hw_available] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } elseif [istarget "powerpc*-*-*"] {
+        # Skip targets not supporting -maltivec.
+        if ![is-effective-target powerpc_altivec_ok] {
+            return 0
+        }
+
+        lappend DEFAULT_VECTCFLAGS "-maltivec"
+        if [check_vsx_hw_available]  {
+            lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
+        }
+
+        if [check_vmx_hw_available] {
+            set dg-do-what-default run
+        } else {
+            if [is-effective-target ilp32] {
+                # Specify a cpu that supports VMX for compile-only tests.
+                lappend DEFAULT_VECTCFLAGS "-mcpu=970"
+            }
+            set dg-do-what-default compile
+        }
+    } elseif { [istarget  "spu-*-*"] } {
+        set dg-do-what-default run
+    } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
+        lappend DEFAULT_VECTCFLAGS "-msse2"
+        if { [check_effective_target_sse2_runtime] } {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } elseif { [istarget "mips*-*-*"]
+               && ([check_effective_target_mpaired_single]
+                    || [check_effective_target_mips_loongson])
+               && [check_effective_target_nomips16] } {
+        if { [check_effective_target_mpaired_single] } {
+            lappend DEFAULT_VECTCFLAGS "-mpaired-single"
+        }
+        set dg-do-what-default run
+    } elseif [istarget "sparc*-*-*"] {
+        lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
+        if [check_effective_target_ultrasparc_hw] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } elseif [istarget "alpha*-*-*"] {
+        # Alpha's vectorization capabilities are extremely limited.
+        # It's more effort than its worth disabling all of the tests
+        # that it cannot pass.  But if you actually want to see what
+        # does work, command out the return.
+        return 0
+
+        lappend DEFAULT_VECTCFLAGS "-mmax"
+        if [check_alpha_max_hw_available] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } elseif [istarget "ia64-*-*"] {
+        set dg-do-what-default run
+    } elseif [is-effective-target arm_neon_ok] {
+        eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
+        # NEON does not support denormals, so is not used for vectorization by
+        # default to avoid loss of precision.  We must pass -ffast-math to test
+        # vectorization of float operations.
+        lappend DEFAULT_VECTCFLAGS "-ffast-math"
+        if [is-effective-target arm_neon_hw] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
+    } else {
+        return 0
+    }
+
+    return 1
+}
+
Index: gfortran.dg/vect/vect.exp
===================================================================
--- gfortran.dg/vect/vect.exp	(revision 167037)
+++ gfortran.dg/vect/vect.exp	(working copy)
@@ -21,6 +21,7 @@
 load_lib target-supports.exp
 
 # Set up flags used for tests that don't specify options.
+global DEFAULT_VECTFLAGS
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
@@ -38,81 +39,8 @@
 # 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.
-if  [istarget "powerpc-*paired*"]  {
-   lappend DEFAULT_VECTCFLAGS "-mpaired"
-    if [check_750cl_hw_available] {
-        set dg-do-what-default run 
-    } else {
-        set dg-do-what-default compile
-    }
-} elseif [istarget "powerpc*-*-*"] {
-    # Skip targets not supporting -maltivec.
-    if ![is-effective-target powerpc_altivec_ok] {
-	return
-    }
-
-    lappend DEFAULT_VECTCFLAGS "-maltivec"
-    if [check_vsx_hw_available]  {
-      lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
-    }
-
-    if [check_vmx_hw_available] {
-	set dg-do-what-default run
-    } else {
-	if [is-effective-target ilp32] {
-	    # Specify a cpu that supports VMX for compile-only tests.
-	    lappend DEFAULT_VECTCFLAGS "-mcpu=970"
-	}
-	set dg-do-what-default compile
-    }
-} elseif { [istarget  "spu-*-*"] } {
-   set dg-do-what-default run
-} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
-    lappend DEFAULT_VECTCFLAGS "-msse2"
-    if { [check_effective_target_sse2_runtime] } {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif { [istarget "mips*-*-*"]
-	   && ([check_effective_target_mpaired_single]
-		|| [check_effective_target_mips_loongson])
-	   && [check_effective_target_nomips16] } {
-    if { [check_effective_target_mpaired_single] } {
-	lappend DEFAULT_VECTCFLAGS "-mpaired-single"
-    }
-    set dg-do-what-default run
-} elseif [istarget "sparc*-*-*"] {
-    lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
-    if [check_effective_target_ultrasparc_hw] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "alpha*-*-*"] {
-    # Alpha's vectorization capabilities are extremely limited.
-    # It's more effort than its worth disabling all of the tests
-    # that it cannot pass.  But if you actually want to see what
-    # does work, command out the return.
+if ![check_vect_support_and_set_flags] {
     return
-
-    lappend DEFAULT_VECTCFLAGS "-mmax"
-    if [check_alpha_max_hw_available] {
-	set dg-do-what-default run
-    } else {
-	set dg-do-what-default compile
-    }
-} elseif [istarget "ia64-*-*"] {
-    set dg-do-what-default run
-} elseif [is-effective-target arm_neon_ok] {
-    eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
-    if [is-effective-target arm_neon_hw] {
-      set dg-do-what-default run
-    } else {
-      set dg-do-what-default compile
-    }
-} else {
-    return
 }
 
 # Initialize `dg'.
