diff --git a/gcc/testsuite/g++.dg/vect/vect.exp b/gcc/testsuite/g++.dg/vect/vect.exp
index aba1866..1e02d6b 100644
--- a/gcc/testsuite/g++.dg/vect/vect.exp
+++ b/gcc/testsuite/g++.dg/vect/vect.exp
@@ -39,6 +39,10 @@ set save-dg-do-what-default ${dg-do-what-default}
 global DEFAULT_VECTCFLAGS
 set DEFAULT_VECTCFLAGS ""
 
+# Reset list of effective targets to be checked against tests.
+global ET_TARGETS
+set ET_TARGETS ""
+
 # These flags are used for all targets.
 lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model"
 
@@ -58,10 +62,10 @@ lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
 dg-init
 
 # Main loop.
-g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.{c,cc,S} ]] \
-        "" $DEFAULT_VECTCFLAGS
-g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-pr*.{c,cc,S} ]] \
-        "" $VECT_SLP_CFLAGS
+et-dg-runtest g++-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/pr*.{c,cc,S} ]] "" $DEFAULT_VECTCFLAGS
+et-dg-runtest g++-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/slp-pr*.{c,cc,S} ]] "" $VECT_SLP_CFLAGS
 
 #### Tests with special options
 global SAVED_DEFAULT_VECTCFLAGS
@@ -70,8 +74,8 @@ set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
 # --param max-aliased-vops=0
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "--param max-aliased-vops=0"
-g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/param-max-aliased*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest g++-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/param-max-aliased*.\[cS\]]] "" $DEFAULT_VECTCFLAGS
 
 # Clean up.
 set dg-do-what-default ${save-dg-do-what-default} 
diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp
index 9dba5d6..4f42982 100644
--- a/gcc/testsuite/gcc.dg/graphite/graphite.exp
+++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp
@@ -60,8 +60,12 @@ dg-runtest $block_files       "" "-O2 -floop-block -fno-loop-strip-mine -fno-loo
 global DEFAULT_VECTCFLAGS
 set DEFAULT_VECTCFLAGS "-O2 -fgraphite-identity -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details -ffast-math"
 
+# Reset list of effective targets to be checked against tests.
+global ET_TARGETS
+set ET_TARGETS ""
+
 if [check_vect_support_and_set_flags] {
-    dg-runtest $vect_files        "" $DEFAULT_VECTCFLAGS
+    et-dg-runtest dg-runtest $vect_files        "" $DEFAULT_VECTCFLAGS
 }
 
 # The default action for the rest of the files is 'compile'.
diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp
index b7d0b07..1325aad 100644
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -24,6 +24,10 @@ load_lib clearcap.exp
 global DEFAULT_VECTCFLAGS
 set DEFAULT_VECTCFLAGS ""
 
+# Reset list of effective targets to be checked against tests.
+global ET_TARGETS
+set ET_TARGETS ""
+
 # 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
@@ -62,13 +66,15 @@ lappend O_VECTCFLAGS "-fdump-tree-vect-details"
 lappend DEFAULT_VECTCFLAGS "-O2"
 
 # Tests that should be run without generating dump info
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # "-O -fdump-tree-veclower2"
 lappend VEC_FLAGS "-O" "-fdump-tree-veclower2"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vec-scal-*.\[cS\]]]  \
-        "" $VEC_FLAGS
+et-dg-runtest dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/vec-scal-*.\[cS\]]] \
+	"" $VEC_FLAGS
 
 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
 
@@ -81,14 +87,18 @@ if { [check_effective_target_lto] } {
     lappend VECT_ADDITIONAL_FLAGS "-flto -ffat-lto-objects"
 }
 foreach flags $VECT_ADDITIONAL_FLAGS {
-    dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]]  \
+    et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
+	$flags $DEFAULT_VECTCFLAGS
+    et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
 	$flags $DEFAULT_VECTCFLAGS
-    dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]]  \
+    et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
 	$flags $DEFAULT_VECTCFLAGS
-    dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]]  \
-        $flags $DEFAULT_VECTCFLAGS
-    dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]]  \
-        $flags $VECT_SLP_CFLAGS
+    et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \
+	$flags $VECT_SLP_CFLAGS
 }
 
 #### Tests with special options
@@ -99,141 +109,164 @@ set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
 # --param vect-max-version-for-alias-checks=0 tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -ffast-math tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-ffast-math"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsv\]*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/fast-math-\[ipsv\]*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -ffast-math SLP tests
 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
 lappend VECT_SLP_CFLAGS "-ffast-math"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-bb-slp-*.\[cS\]]]  \
-        "" $VECT_SLP_CFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/fast-math-bb-slp-*.\[cS\]]] \
+	"" $VECT_SLP_CFLAGS
 
 # -fno-fast-math tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-fast-math"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fast-math-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-fast-math-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fno-math-errno tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -fwrapv tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fwrapv"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -ftrapv tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-ftrapv"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-dce tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -fsection-anchors tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # alignment-sensitive -fsection-anchors tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fsection-anchors" \
 	"-fdump-ipa-increase_alignment-details"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -fno-section-anchors tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -funswitch-loops tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -fno-trapping-math tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-scev-cprop
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-scev-cprop
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-pr*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-scevccp-pr*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-scev-cprop
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-scev-cprop -fno-tree-reassoc
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-scev-cprop
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-dominator-opts
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]]  \
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
 	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-pre
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # With -Os
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-Os"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0 
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -ftree-loop-if-convert-stores
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-ftree-loop-if-convert-stores"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/if-cvt-stores-vect-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/if-cvt-stores-vect-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # With -O3.
 # Don't allow IPA cloning, because it throws our counts out of whack.
@@ -242,40 +275,48 @@ lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
 if  [istarget "spu-*-*"] {
   lappend DEFAULT_VECTCFLAGS "-funroll-loops"
 }
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # With -O1
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]]  \
-        "" $O1_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
+	"" $O1_VECTCFLAGS
 
 # With -O
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]]  \
-        "" $O_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]] \
+	"" $O_VECTCFLAGS
 
 # -fno-tree-reassoc
 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]]  \
-        "" $VECT_SLP_CFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
+	"" $VECT_SLP_CFLAGS
 
 # -fno-tree-fre
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-fre"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-fre -fno-tree-pre
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-fre" "-fno-tree-pre"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fre-pre*.\[cS\]]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-fre-pre*.\[cS\]]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fno-tree-sra
 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
 lappend VECT_SLP_CFLAGS "-fno-tree-sra"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-sra-bb-slp-*.\[cS\]]]  \
-        "" $VECT_SLP_CFLAGS
+et-dg-runtest dg-runtest [lsort \
+	[glob -nocomplain $srcdir/$subdir/no-tree-sra-bb-slp-*.\[cS\]]] \
+	"" $VECT_SLP_CFLAGS
 
 
 # Clean up.
diff --git a/gcc/testsuite/gfortran.dg/graphite/graphite.exp b/gcc/testsuite/gfortran.dg/graphite/graphite.exp
index 1df46ea..52add75 100644
--- a/gcc/testsuite/gfortran.dg/graphite/graphite.exp
+++ b/gcc/testsuite/gfortran.dg/graphite/graphite.exp
@@ -52,9 +52,14 @@ 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"
 
+# Reset list of effective targets to be checked against tests.
+global ET_TARGETS
+set ET_TARGETS ""
+
 # Vectorizer tests, to be run or compiled, depending on target capabilities.
 if [check_vect_support_and_set_flags] {
-    gfortran-dg-runtest $vect_files "" "-O2 -fgraphite-identity -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details -ffast-math"
+   et-dg-runtest gfortran-dg-runtest $vect_files "" \
+      "-O2 -fgraphite-identity -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details -ffast-math"
 }
 
 # Tests to be run.
diff --git a/gcc/testsuite/gfortran.dg/vect/vect.exp b/gcc/testsuite/gfortran.dg/vect/vect.exp
index e8f2b1c..09688a1 100644
--- a/gcc/testsuite/gfortran.dg/vect/vect.exp
+++ b/gcc/testsuite/gfortran.dg/vect/vect.exp
@@ -24,6 +24,10 @@ load_lib target-supports.exp
 global DEFAULT_VECTCFLAGS
 set DEFAULT_VECTCFLAGS ""
 
+# Reset list of effective targets to be checked against tests.
+global ET_TARGETS
+set ET_TARGETS ""
+
 # These flags are used for all targets.
 lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model=unlimited" \
   "-fdump-tree-vect-details"
@@ -47,8 +51,10 @@ if ![check_vect_support_and_set_flags] {
 dg-init
 
 # Main loop.
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[fF\]{,90,95,03,08} ]] "" $DEFAULT_VECTCFLAGS
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[fF\]{,90,95,03,08} ]] "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/vect-*.\[fF\]{,90,95,03,08} ]] "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/pr*.\[fF\]{,90,95,03,08} ]] "" $DEFAULT_VECTCFLAGS
 
 #### Tests with special options
 global SAVED_DEFAULT_VECTCFLAGS
@@ -57,44 +63,51 @@ set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
 # -ffast-math tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-ffast-math"
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[fF\]{,90,95,03,08} ]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/fast-math-*.\[fF\]{,90,95,03,08} ]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -ffast-math tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-ffast-math" "-fdefault-real-8"
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-real8*.\[fF\]{,90,95,03,08} ]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/fast-math-real8*.\[fF\]{,90,95,03,08} ]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # -fvect-cost-model tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fvect-cost-model=dynamic"
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cost-model-*.\[fF\]{,90,95,03,08} ]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/cost-model-*.\[fF\]{,90,95,03,08} ]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # --param vect-max-version-for-alias-checks=0 tests
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[fF\]{,90,95,03,08} ]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/no-vfa-*.\[fF\]{,90,95,03,08} ]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # With -O3
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-O3"
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[fF\]{,90,95,03,08} ]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/O3-*.\[fF\]{,90,95,03,08} ]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # With -Ofast
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-Ofast"
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Ofast-*.\[fF\]{,90,95,03,08} ]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/Ofast-*.\[fF\]{,90,95,03,08} ]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # With -fno-tree-copy-prop -fno-tree-fre -O3
 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
 lappend DEFAULT_VECTCFLAGS "-fno-tree-copy-prop" "-fno-tree-fre" "-O3"
-gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fre-no-copy-prop-O3-*.\[fF\]{,90,95,03,08} ]]  \
-        "" $DEFAULT_VECTCFLAGS
+et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \
+	$srcdir/$subdir/no-fre-no-copy-prop-O3-*.\[fF\]{,90,95,03,08} ]] \
+	"" $DEFAULT_VECTCFLAGS
 
 # Clean up.
 set dg-do-what-default ${save-dg-do-what-default}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index e51d07d..c603cbc 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1408,6 +1408,85 @@ proc check_sse_hw_available { } {
     }]
 }
 
+# Return 1 if the target supports executing MIPS Paired-Single instructions, 0
+# otherwise.  Cache the result.
+
+proc check_mpaired_single_hw_available { } {
+    return [check_cached_effective_target mpaired_single_hw_available {
+	# If this is not the right target then we can skip the test.
+	if { !([istarget mips*-*-*]) } {
+	    expr 0
+	} else {
+	    check_runtime_nocache mpaired_single_hw_available {
+	      int main()
+	      {
+		asm volatile ("pll $f2,$f4,$f6");
+		return v[0];
+	      }
+	      #endif
+	    } ""
+	}
+    }]
+}
+
+# Return 1 if the target supports executing Loongson vector instructions, 0
+# otherwise.  Cache the result.
+
+proc check_mips_loongson_hw_available { } {
+    return [check_cached_effective_target mips_loongson_hw_available {
+	# If this is not the right target then we can skip the test.
+	if { !([istarget mips*-*-*]) } {
+	    expr 0
+	} else {
+	    check_runtime_nocache mips_loongson_hw_available {
+	      #include <loongson.h>
+	      int main()
+	      {
+		asm volatile ("paddw $f2,$f4,$f6");
+		return v[0];
+	      }
+	      #endif
+	    } ""
+	}
+    }]
+}
+
+# Return 1 if the target supports executing MIPS MSA instructions, 0
+# otherwise.  Cache the result.
+
+proc check_mips_msa_hw_available { } {
+    return [check_cached_effective_target msa_hw_available {
+	# If this is not the right target then we can skip the test.
+	if { !([istarget mips*-*-*]) } {
+	    expr 0
+	} else {
+	    check_runtime_nocache msa_hw_available {
+	      #if !defined(__mips_msa)
+	      #error "MSA NOT AVAIL"
+	      #else
+	      #if !(((__mips == 64) || (__mips == 32)) && (__mips_isa_rev >= 2))
+	      #error "MSA NOT AVAIL FOR ISA REV < 2"
+	      #endif
+	      #if !defined(__mips_hard_float)
+	      #error "MSA HARD_FLOAT REQUIRED"
+	      #endif
+	      #if __mips_fpr != 64
+	      #error "MSA 64 FPR REQUIRED"
+	      #endif
+	      #include <msa.h>
+
+	      int main()
+	      {
+		v8i16 v = __builtin_msa_ldi_h (0);
+		v[0] = 0;
+		return v[0];
+	      }
+	      #endif
+	    } "-mmsa"
+	}
+    }]
+}
+
 # Return 1 if the target supports executing SSE2 instructions, 0
 # otherwise.  Cache the result.
 
@@ -1477,6 +1556,37 @@ proc check_effective_target_sse2_runtime { } {
     return 0
 }
 
+# Return 1 if the target supports running MIPS Paired-Single
+# executables, 0 otherwise.
+
+proc check_effective_target_mpaired_single_runtime { } {
+    if { [check_effective_target_mpaired_single]
+	 && [check_mpaired_single_hw_available] } {
+	return 1
+    }
+    return 0
+}
+
+# Return 1 if the target supports running Loongson executables, 0 otherwise.
+
+proc check_effective_target_mips_loongson_runtime { } {
+    if { [check_effective_target_mips_loongson]
+	 && [check_mips_loongson_hw_available] } {
+	return 1
+    }
+    return 0
+}
+
+# Return 1 if the target supports running MIPS MSA executables, 0 otherwise.
+
+proc check_effective_target_mips_msa_runtime { } {
+    if { [check_effective_target_mips_msa]
+	 && [check_mips_msa_hw_available] } {
+	return 1
+    }
+    return 0
+}
+
 # Return 1 if the target supports running AVX executables, 0 otherwise.
 
 proc check_effective_target_avx_runtime { } {
@@ -3025,6 +3135,24 @@ proc check_effective_target_arm_neonv2 { } {
     }
 }
 
+# Add the options needed for MIPS Paired-Single.
+
+proc add_options_for_mpaired_single { flags } {
+    if { ! [check_effective_target_mpaired_single] } {
+	return "$flags"
+    }
+    return "$flags -mpaired-single"
+}
+
+# Add the options needed for MIPS SIMD Architecture.
+
+proc add_options_for_mips_msa { flags } {
+    if { ! [check_effective_target_mips_msa] } {
+	return "$flags"
+    }
+    return "$flags -mmsa"
+}
+
 # Return 1 if this a Loongson-2E or -2F target using an ABI that supports
 # the Loongson vector modes.
 
@@ -3036,6 +3164,37 @@ proc check_effective_target_mips_loongson { } {
     }]
 }
 
+# Return 1 if a msa program can be compiled to object
+
+proc check_effective_target_mips_msa { } {
+  if ![check_effective_target_nomips16] {
+      return 0
+  }
+  return [check_no_compiler_messages msa object {
+     #if !defined(__mips_msa)
+     #error "MSA NOT AVAIL"
+     #else
+     #if !(((__mips == 64) || (__mips == 32)) && (__mips_isa_rev >= 2))
+     #error "MSA NOT AVAIL FOR ISA REV < 2"
+     #endif
+     #if !defined(__mips_hard_float)
+     #error "MSA HARD_FLOAT REQUIRED"
+     #endif
+     #if __mips_fpr != 64
+     #error "MSA 64 FPR REQUIRED"
+     #endif
+     #include <msa.h>
+
+     int main()
+     {
+	v8i16 v = __builtin_msa_ldi_h (1);
+
+	return v[0];
+     }
+     #endif
+  } "-mmsa" ]
+}
+
 # Return 1 if this is an ARM target that adheres to the ABI for the ARM
 # Architecture.
 
@@ -5265,6 +5424,29 @@ proc is-effective-target-keyword { arg } {
     }
 }
 
+# Execute tests for all effective targets.
+
+proc et-dg-runtest { runtest testcases flags default-extra-flags } {
+    global ET_TARGETS
+
+    if { [llength $ET_TARGETS] > 0 } {
+	foreach target $ET_TARGETS {
+	    set target_flags $flags
+	    set dg-do-what-default compile
+	    if { [info procs add_options_for_${target}] != [list] } {
+		set target_flags [add_options_for_${target} "$flags"]
+	    }
+	    if { [info procs check_effective_target_${target}_runtime]
+		 != [list] && [check_effective_target_${target}_runtime] } {
+		set dg-do-what-default run
+	    }
+	    $runtest $testcases $target_flags ${default-extra-flags}
+	}
+    } else {
+	$runtest $testcases $flags ${default-extra-flags}
+    }
+}
+
 # Return 1 if target default to short enums
 
 proc check_effective_target_short_enums { } {
@@ -5913,6 +6095,7 @@ proc check_effective_target_stpcpy {} {
 proc check_vect_support_and_set_flags { } {
     global DEFAULT_VECTCFLAGS
     global dg-do-what-default
+    global ET_TARGETS
 
     if  [istarget powerpc-*paired*]  {
         lappend DEFAULT_VECTCFLAGS "-mpaired"
@@ -5953,13 +6136,17 @@ proc check_vect_support_and_set_flags { } {
             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"
+            lappend ET_TARGETS "mpaired_single"
         }
-        set dg-do-what-default run
+        if { [check_effective_target_mips_loongson] } {
+            lappend ET_TARGETS "mips_loongson"
+        }
+        if { [check_effective_target_mips_msa] } {
+            lappend ET_TARGETS "mips_msa"
+        }
+        return [llength $ET_TARGETS]
     } elseif [istarget sparc*-*-*] {
         lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
         if [check_effective_target_ultrasparc_hw] {
