diff --git a/libavfilter/x86/gradfun.c b/libavfilter/x86/gradfun.c
index 1d6a7ab363c6ed13167cd7d2a8f8dd7e75c89fe8..07569de1461928b83dcc5261e9669dacc9aabfcf 100644
--- a/libavfilter/x86/gradfun.c
+++ b/libavfilter/x86/gradfun.c
@@ -168,10 +168,16 @@ av_cold void ff_gradfun_init_x86(GradFunContext *gf)
 {
     int cpu_flags = av_get_cpu_flags();
 
-    if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2)
+#if HAVE_MMX2
+    if (cpu_flags & AV_CPU_FLAG_MMX2)
         gf->filter_line = gradfun_filter_line_mmx2;
-    if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3)
+#endif
+#if HAVE_SSSE3
+    if (cpu_flags & AV_CPU_FLAG_SSSE3)
         gf->filter_line = gradfun_filter_line_ssse3;
-    if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2)
+#endif
+#if HAVE_SSE
+    if (cpu_flags & AV_CPU_FLAG_SSE2)
         gf->blur_line = gradfun_blur_line_sse2;
+#endif
 }
diff --git a/libavfilter/x86/yadif.c b/libavfilter/x86/yadif.c
index fe77f3a99c6087a95c99a725163649c635329c1b..6d9f9b2880664f525cef21d9ca131984e997b4b6 100644
--- a/libavfilter/x86/yadif.c
+++ b/libavfilter/x86/yadif.c
@@ -53,10 +53,16 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif)
 {
     int cpu_flags = av_get_cpu_flags();
 
-    if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX)
+#if HAVE_MMX
+    if (cpu_flags & AV_CPU_FLAG_MMX)
         yadif->filter_line = yadif_filter_line_mmx;
-    if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2)
+#endif
+#if HAVE_SSE
+    if (cpu_flags & AV_CPU_FLAG_SSE2)
         yadif->filter_line = yadif_filter_line_sse2;
-    if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3)
+#endif
+#if HAVE_SSSE3
+    if (cpu_flags & AV_CPU_FLAG_SSSE3)
         yadif->filter_line = yadif_filter_line_ssse3;
+#endif
 }