diff --git a/gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c b/gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c
index 5ee427a3b4a..984ffe7144c 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-dlmzb-strlen-1.c
@@ -4,7 +4,6 @@
 /* { dg-skip-if "" { powerpc*-*-aix* } } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "dlmzb\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-macchw-1.c b/gcc/testsuite/gcc.target/powerpc/405-macchw-1.c
index 2253a9c9deb..10ea9cc10f8 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-macchw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-macchw-1.c
@@ -3,10 +3,14 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "macchw " } } */

+/* Ensure -mdejagnu-cpu=405 always defines __PPC405__.  */
+#ifndef __PPC405__
+#error not a PPC405
+#endif
+
 int
 f(int a, int b, int c)
 {
diff --git a/gcc/testsuite/gcc.target/powerpc/405-macchw-2.c b/gcc/testsuite/gcc.target/powerpc/405-macchw-2.c
index aa16413217e..6e0eff2126c 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-macchw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-macchw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "macchw\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-macchwu-1.c b/gcc/testsuite/gcc.target/powerpc/405-macchwu-1.c
index 3a6a1b80df9..e615959f436 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-macchwu-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-macchwu-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "macchwu " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-macchwu-2.c b/gcc/testsuite/gcc.target/powerpc/405-macchwu-2.c
index c1baf82f932..19cbc16ea34 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-macchwu-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-macchwu-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "macchwu\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-machhw-1.c b/gcc/testsuite/gcc.target/powerpc/405-machhw-1.c
index 54d37599af5..134cd2d509f 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-machhw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-machhw-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "machhw " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-machhw-2.c b/gcc/testsuite/gcc.target/powerpc/405-machhw-2.c
index 96a5433e4e7..e04cbe42208 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-machhw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-machhw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "machhw\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-machhwu-1.c b/gcc/testsuite/gcc.target/powerpc/405-machhwu-1.c
index c61f61ad0cd..507736b8c55 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-machhwu-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-machhwu-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "machhwu " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-machhwu-2.c b/gcc/testsuite/gcc.target/powerpc/405-machhwu-2.c
index fa4c2fc0ccc..8d2fd5c9ced 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-machhwu-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-machhwu-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "machhwu\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-maclhw-1.c b/gcc/testsuite/gcc.target/powerpc/405-maclhw-1.c
index 619a22a4075..f171f76ac0f 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-maclhw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-maclhw-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "maclhw " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-maclhw-2.c b/gcc/testsuite/gcc.target/powerpc/405-maclhw-2.c
index b55dcaa662c..953f70b2287 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-maclhw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-maclhw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "maclhw\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-maclhwu-1.c b/gcc/testsuite/gcc.target/powerpc/405-maclhwu-1.c
index c4ca9a43fed..73b97e02a10 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-maclhwu-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-maclhwu-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "maclhwu " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-maclhwu-2.c b/gcc/testsuite/gcc.target/powerpc/405-maclhwu-2.c
index 74be5924729..f395e493451 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-maclhwu-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-maclhwu-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "maclhwu\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mulchw-1.c b/gcc/testsuite/gcc.target/powerpc/405-mulchw-1.c
index 1f29428f572..ad77d16d359 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mulchw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mulchw-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mulchw " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mulchw-2.c b/gcc/testsuite/gcc.target/powerpc/405-mulchw-2.c
index 2d40fa3ba8c..9b65fa5115b 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mulchw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mulchw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mulchw\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mulchwu-1.c b/gcc/testsuite/gcc.target/powerpc/405-mulchwu-1.c
index 8fdd9fa9ea3..741742c412e 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mulchwu-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mulchwu-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mulchwu " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mulchwu-2.c b/gcc/testsuite/gcc.target/powerpc/405-mulchwu-2.c
index af8713882be..82ff7c4a432 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mulchwu-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mulchwu-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mulchwu\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mulhhw-1.c b/gcc/testsuite/gcc.target/powerpc/405-mulhhw-1.c
index 65747009d48..644665011e5 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mulhhw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mulhhw-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mulhhw " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mulhhw-2.c b/gcc/testsuite/gcc.target/powerpc/405-mulhhw-2.c
index b3d9a028c10..9c53a9e3de9 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mulhhw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mulhhw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mulhhw\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mulhhwu-1.c b/gcc/testsuite/gcc.target/powerpc/405-mulhhwu-1.c
index cc96bb8f0b7..ab80a410b18 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mulhhwu-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mulhhwu-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mulhhwu " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mulhhwu-2.c b/gcc/testsuite/gcc.target/powerpc/405-mulhhwu-2.c
index f921e4f2dc9..d56b9597782 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mulhhwu-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mulhhwu-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mulhhwu\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mullhw-1.c b/gcc/testsuite/gcc.target/powerpc/405-mullhw-1.c
index b70f6712ff4..4079887e777 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mullhw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mullhw-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mullhw " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mullhw-2.c b/gcc/testsuite/gcc.target/powerpc/405-mullhw-2.c
index b3fa19c8e1f..c92078a7bcf 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mullhw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mullhw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mullhw\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mullhwu-1.c b/gcc/testsuite/gcc.target/powerpc/405-mullhwu-1.c
index 7707ff32142..dec08dc2bae 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mullhwu-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mullhwu-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mullhwu " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-mullhwu-2.c b/gcc/testsuite/gcc.target/powerpc/405-mullhwu-2.c
index 6e4d92c1ebd..d2b57bd08cf 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-mullhwu-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-mullhwu-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "mullhwu\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-nmacchw-1.c b/gcc/testsuite/gcc.target/powerpc/405-nmacchw-1.c
index b5585d8bd04..fefbb2b302b 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-nmacchw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-nmacchw-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "nmacchw " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-nmacchw-2.c b/gcc/testsuite/gcc.target/powerpc/405-nmacchw-2.c
index ce2a16c24cb..3930d560a7e 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-nmacchw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-nmacchw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "nmacchw\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-nmachhw-1.c b/gcc/testsuite/gcc.target/powerpc/405-nmachhw-1.c
index d0cf9fe2c58..d71e27950cd 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-nmachhw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-nmachhw-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "nmachhw " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-nmachhw-2.c b/gcc/testsuite/gcc.target/powerpc/405-nmachhw-2.c
index 39645692186..ec64c5ceef7 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-nmachhw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-nmachhw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "nmachhw\\. " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-nmaclhw-1.c b/gcc/testsuite/gcc.target/powerpc/405-nmaclhw-1.c
index f5cb17b8f6d..e704cda241d 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-nmaclhw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-nmaclhw-1.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "nmaclhw " } } */

diff --git a/gcc/testsuite/gcc.target/powerpc/405-nmaclhw-2.c b/gcc/testsuite/gcc.target/powerpc/405-nmaclhw-2.c
index fb84421dc22..bd37b2557fc 100644
--- a/gcc/testsuite/gcc.target/powerpc/405-nmaclhw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/405-nmaclhw-2.c
@@ -3,7 +3,6 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target ilp32 } */
 /* { dg-options "-O2 -mdejagnu-cpu=405" } */
-/* { dg-skip-if "other options override -mcpu=405" { ! powerpc_405_nocache } } */

 /* { dg-final { scan-assembler "nmaclhw\\. " } } */

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index dc21dc3a06c..969456281c7 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -7252,23 +7252,6 @@ proc check_effective_target_powerpc_altivec { } {
     }
 }

-# Return 1 if this is a PowerPC 405 target.  The check includes options
-# specified by dg-options for this test, so don't cache the result.
-
-proc check_effective_target_powerpc_405_nocache { } {
-    if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } {
-	return [check_no_compiler_messages_nocache powerpc_405 object {
-	    #ifdef __PPC405__
-	    int dummy;
-	    #else
-	    #error not a PPC405
-	    #endif
-	} [current_compiler_flags]]
-    } else {
-	return 0
-    }
-}
-
 # Return 1 if this is a PowerPC target using the ELFv2 ABI.

 proc check_effective_target_powerpc_elfv2 { } {
