diff --git a/gcc/testsuite/gcc.target/i386/adx-check.h b/gcc/testsuite/gcc.target/i386/adx-check.h
index cfed1a38483..45435b91d0e 100644
--- a/gcc/testsuite/gcc.target/i386/adx-check.h
+++ b/gcc/testsuite/gcc.target/i386/adx-check.h
@@ -1,5 +1,8 @@
 #include <stdlib.h>
 #include "cpuid.h"
+#ifdef DEBUG
+#include <stdio.h>
+#endif
 
 static void adx_test (void);
 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vscalefph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vscalefph-1b.c
index 7c7288d6eb3..0ba9ec57f37 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16-vscalefph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vscalefph-1b.c
@@ -1,9 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
 
-
-#define DEBUG
-
 #define AVX512FP16
 #include "avx512fp16-helper.h"
 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1b.c
index fcf6a9058f5..1db7c565262 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vaddph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1b.c
index c201a9258bf..bbd366a5d29 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vcmpph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1b.c
index 48965c6cfb8..ba2f3f31b7c 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vdivph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vfpclassph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vfpclassph-1b.c
index 6745f137c27..322d9cda560 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vfpclassph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vfpclassph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vgetexpph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vgetexpph-1b.c
index 7eb4fa4f537..1c2b28d0fe4 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vgetexpph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vgetexpph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vgetmantph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vgetmantph-1b.c
index e5f87401558..243e477e0ef 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vgetmantph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vgetmantph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1b.c
index f9a3b70d47c..bd022fc1d50 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmaxph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1b.c
index 98808b0eddd..d2c3014f0dc 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vminph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1b.c
index 2b3ba050533..31fb32a09e6 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vmulph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrcpph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrcpph-1b.c
index a6b1e376a8e..3c762e2182d 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrcpph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrcpph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vreduceph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vreduceph-1b.c
index 38515976ce6..06e69f280d8 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vreduceph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vreduceph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrndscaleph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrndscaleph-1b.c
index 04b00e2db2d..01f991de977 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrndscaleph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrndscaleph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrsqrtph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrsqrtph-1b.c
index a5e796b8ebb..c86221f6361 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrsqrtph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vrsqrtph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vscalefph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vscalefph-1b.c
index 5c12d08e2e1..8f505b53719 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vscalefph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vscalefph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsqrtph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsqrtph-1b.c
index 9b0a91d7b5d..f4612933b33 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsqrtph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsqrtph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1b.c
index fa162185e3c..40da2ef8cf9 100644
--- a/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1b.c
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16vl-vsubph-1b.c
@@ -1,7 +1,6 @@
 /* { dg-do run { target avx512fp16 } } */
 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -mavx512dq" } */
 
-#define DEBUG
 #define AVX512VL
 #define AVX512F_LEN 256      
 #define AVX512F_LEN_HALF 128 
diff --git a/gcc/testsuite/gcc.target/i386/readeflags-1.c b/gcc/testsuite/gcc.target/i386/readeflags-1.c
index d0dd0da4555..90f29306014 100644
--- a/gcc/testsuite/gcc.target/i386/readeflags-1.c
+++ b/gcc/testsuite/gcc.target/i386/readeflags-1.c
@@ -2,6 +2,9 @@
 /* { dg-options "-O0" } */
 
 #include <x86intrin.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
 
 extern void abort (void);
 
diff --git a/gcc/testsuite/gcc.target/i386/rtm-check.h b/gcc/testsuite/gcc.target/i386/rtm-check.h
index bdb5a6dc0bf..69788ad390e 100644
--- a/gcc/testsuite/gcc.target/i386/rtm-check.h
+++ b/gcc/testsuite/gcc.target/i386/rtm-check.h
@@ -1,5 +1,8 @@
 #include <stdlib.h>
 #include "cpuid.h"
+#ifdef DEBUG
+#include <stdio.h>
+#endif
 
 static void rtm_test (void);
 
diff --git a/gcc/testsuite/gcc.target/i386/sha-check.h b/gcc/testsuite/gcc.target/i386/sha-check.h
index 5bc5a59ab80..b9ffb5cd096 100644
--- a/gcc/testsuite/gcc.target/i386/sha-check.h
+++ b/gcc/testsuite/gcc.target/i386/sha-check.h
@@ -1,5 +1,8 @@
 #include <stdlib.h>
 #include "cpuid.h"
+#ifdef DEBUG
+#include <stdio.h>
+#endif
 
 static void sha_test (void);
 
diff --git a/gcc/testsuite/gcc.target/i386/writeeflags-1.c b/gcc/testsuite/gcc.target/i386/writeeflags-1.c
index ceaab1ae893..7a57f410b91 100644
--- a/gcc/testsuite/gcc.target/i386/writeeflags-1.c
+++ b/gcc/testsuite/gcc.target/i386/writeeflags-1.c
@@ -2,6 +2,9 @@
 /* { dg-options "-O0" } */
 
 #include <x86intrin.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
 
 extern void abort (void);
 
