Add a config flag CONFIG_EXCLUDE_SIMD_MISMATCH

This CL re-enabled av1_nn_predict sse3 optimization. Added a config
flag CONFIG_EXCLUDE_SIMD_MISMATCH to exclude SIMD optimizations that
introduce c and SIMD mismatch. This flag is used for SIMD correctness
testing and debugging.

BUG=aomedia:2932

Change-Id: I694fb7c234553a7bcc5a86dfe4a3b9d0fddfecb5
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl
index a09abeb..fe40938 100644
--- a/av1/common/av1_rtcd_defs.pl
+++ b/av1/common/av1_rtcd_defs.pl
@@ -425,9 +425,10 @@
   add_proto qw/void av1_get_horver_correlation_full/, " const int16_t *diff, int stride, int w, int h, float *hcorr, float *vcorr";
   specialize qw/av1_get_horver_correlation_full sse4_1 avx2 neon/;
 
-  # TODO(any): av1_nn_predict sse3 optimization causes SIMD/c mismatch that needs to be fixed.
   add_proto qw/void av1_nn_predict/, " const float *input_nodes, const NN_CONFIG *const nn_config, int reduce_prec, float *const output";
-  specialize qw/av1_nn_predict neon/;
+  if (aom_config("CONFIG_EXCLUDE_SIMD_MISMATCH") ne "yes") {
+    specialize qw/av1_nn_predict sse3 neon/;
+  }
 
   # CNN functions
   if (aom_config("CONFIG_REALTIME_ONLY") ne "yes") {
@@ -435,7 +436,9 @@
     add_proto qw/void av1_cnn_add/, " float **input, int channels, int width, int height, int stride, const float **add";
     add_proto qw/void av1_cnn_predict/, " const float **input, int in_width, int in_height, int in_stride, const CNN_CONFIG *cnn_config, const CNN_THREAD_DATA *thread_data, CNN_MULTI_OUT *output_struct";
     add_proto qw/void av1_cnn_convolve_no_maxpool_padding_valid/, " const float **input, int in_width, int in_height, int in_stride, const CNN_LAYER_CONFIG *layer_config, float **output, int out_stride, int start_idx, int cstep, int channel_step";
-    specialize qw/av1_cnn_convolve_no_maxpool_padding_valid avx2/;
+    if (aom_config("CONFIG_EXCLUDE_SIMD_MISMATCH") ne "yes") {
+      specialize qw/av1_cnn_convolve_no_maxpool_padding_valid avx2/;
+    }
     add_proto qw/void av1_cnn_deconvolve/, " const float **input, int in_width, int in_height, int in_stride, const CNN_LAYER_CONFIG *layer_config, float **output, int out_stride";
     add_proto qw/void av1_cnn_batchnorm/, "float **image, int channels, int width, int height, int stride, const float *gamma, const float *beta, const float *mean, const float *std";
   }
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 7fdad19..f1b1e57 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -92,6 +92,8 @@
 # Debugging flags.
 set_aom_config_var(CONFIG_DEBUG 0 "Enable debug-only code.")
 set_aom_config_var(CONFIG_MISMATCH_DEBUG 0 "Mismatch debugging flag.")
+set_aom_config_var(CONFIG_EXCLUDE_SIMD_MISMATCH 0
+                   "Exclude mismatch in SIMD functions for testing/debugging.")
 
 # AV1 feature flags.
 set_aom_config_var(CONFIG_ACCOUNTING 0 "Enables bit accounting.")
diff --git a/test/av1_nn_predict_test.cc b/test/av1_nn_predict_test.cc
index fb0f9a4..04b44a2 100644
--- a/test/av1_nn_predict_test.cc
+++ b/test/av1_nn_predict_test.cc
@@ -211,9 +211,8 @@
 }
 
 #if HAVE_SSE3
-// TODO(any): enable sse3 optimization test after the SIMD/c mismatch is fixed.
-// INSTANTIATE_TEST_SUITE_P(SSE3, NnPredictTest,
-//                         ::testing::Values(av1_nn_predict_sse3));
+INSTANTIATE_TEST_SUITE_P(SSE3, NnPredictTest,
+                         ::testing::Values(av1_nn_predict_sse3));
 #endif
 
 #if HAVE_NEON