Clear ARM NEON flag

Merge WEBRTC_ARCH_ARM64_NEON and WEBRTC_ARCH_ARM_NEON into one
WEBRTC_HAS_NEON.
Replace WEBRTC_DETECT_ARM_NEON by WEBRTC_DETECT_NEON.
Replace WEBRTC_ARCH_ARM by WEBRTC_ARCH_ARM64 for arm64 cpu.

BUG=4002
R=andrew@webrtc.org, jridges@masque.com, kjellander@webrtc.org

Change-Id: I870a4d0682b80633b671c9aab733153f6d95a980

Review URL: https://webrtc-codereview.appspot.com/49309004

Cr-Commit-Position: refs/heads/master@{#9228}
diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn
index 2c1fafb..45b05b6 100644
--- a/webrtc/BUILD.gn
+++ b/webrtc/BUILD.gn
@@ -113,13 +113,8 @@
   }
 
   if (current_cpu == "arm64") {
-    defines += [ "WEBRTC_ARCH_ARM" ]
-    # TODO(zhongwei) Defining an unique WEBRTC_NEON and
-    # distinguishing ARMv7 NEON and ARM64 NEON by
-    # WEBRTC_ARCH_ARM_V7 and WEBRTC_ARCH_ARM64 should be better.
-
-    # This macro is used to distinguish ARMv7 NEON and ARM64 NEON
-    defines += [ "WEBRTC_ARCH_ARM64_NEON" ]
+    defines += [ "WEBRTC_ARCH_ARM64" ]
+    defines += [ "WEBRTC_HAS_NEON" ]
   }
 
   if (current_cpu == "arm") {
@@ -127,9 +122,9 @@
     if (arm_version >= 7) {
       defines += [ "WEBRTC_ARCH_ARM_V7" ]
       if (arm_use_neon) {
-        defines += [ "WEBRTC_ARCH_ARM_NEON" ]
-      } else if (is_android) {
-        defines += [ "WEBRTC_DETECT_ARM_NEON" ]
+        defines += [ "WEBRTC_HAS_NEON" ]
+      } else if (arm_optionally_use_neon) {
+        defines += [ "WEBRTC_DETECT_NEON" ]
       }
     }
   }
diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi
index e1ef419..863d63b 100644
--- a/webrtc/build/common.gypi
+++ b/webrtc/build/common.gypi
@@ -260,13 +260,8 @@
       }],
       ['target_arch=="arm64"', {
         'defines': [
-          'WEBRTC_ARCH_ARM',
-          # TODO(zhongwei) Defining an unique WEBRTC_NEON and
-          # distinguishing ARMv7 NEON and ARM64 NEON by
-          # WEBRTC_ARCH_ARM_V7 and WEBRTC_ARCH_ARM64 should be better.
-
-          # This macro is used to distinguish ARMv7 NEON and ARM64 NEON
-          'WEBRTC_ARCH_ARM64_NEON',
+          'WEBRTC_ARCH_ARM64',
+          'WEBRTC_HAS_NEON',
         ],
       }],
       ['target_arch=="arm"', {
@@ -278,10 +273,10 @@
             'defines': ['WEBRTC_ARCH_ARM_V7',],
             'conditions': [
               ['arm_neon==1', {
-                'defines': ['WEBRTC_ARCH_ARM_NEON',],
+                'defines': ['WEBRTC_HAS_NEON',],
               }],
-              ['arm_neon==0 and OS=="android"', {
-                'defines': ['WEBRTC_DETECT_ARM_NEON',],
+              ['arm_neon==0 and arm_neon_optional==1', {
+                'defines': ['WEBRTC_DETECT_NEON',],
               }],
             ],
           }],
diff --git a/webrtc/common_audio/fir_filter.cc b/webrtc/common_audio/fir_filter.cc
index c651235..1c5548d 100644
--- a/webrtc/common_audio/fir_filter.cc
+++ b/webrtc/common_audio/fir_filter.cc
@@ -57,19 +57,16 @@
     filter = new FIRFilterC(coefficients, coefficients_length);
   }
 #endif
-#elif defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON)
-#if defined(WEBRTC_ARCH_ARM_NEON)
+#elif defined(WEBRTC_HAS_NEON)
   filter =
       new FIRFilterNEON(coefficients, coefficients_length, max_input_length);
-#else
-  // ARM CPU detection required.
+#elif defined(WEBRTC_DETECT_NEON)
   if (WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) {
     filter =
         new FIRFilterNEON(coefficients, coefficients_length, max_input_length);
   } else {
     filter = new FIRFilterC(coefficients, coefficients_length);
   }
-#endif
 #else
   filter = new FIRFilterC(coefficients, coefficients_length);
 #endif
diff --git a/webrtc/common_audio/resampler/sinc_resampler.cc b/webrtc/common_audio/resampler/sinc_resampler.cc
index 0e18ac5..1c259c5 100644
--- a/webrtc/common_audio/resampler/sinc_resampler.cc
+++ b/webrtc/common_audio/resampler/sinc_resampler.cc
@@ -128,20 +128,15 @@
   convolve_proc_ = WebRtc_GetCPUInfo(kSSE2) ? Convolve_SSE : Convolve_C;
 }
 #endif
-#elif defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON)
-#if defined(WEBRTC_ARCH_ARM_NEON)
+#elif defined(WEBRTC_HAS_NEON)
 #define CONVOLVE_FUNC Convolve_NEON
 void SincResampler::InitializeCPUSpecificFeatures() {}
-#else
-// ARM CPU detection required.  Function will be set by
-// InitializeCPUSpecificFeatures().
+#elif defined(WEBRTC_DETECT_NEON)
 #define CONVOLVE_FUNC convolve_proc_
-
 void SincResampler::InitializeCPUSpecificFeatures() {
   convolve_proc_ = WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON ?
       Convolve_NEON : Convolve_C;
 }
-#endif
 #else
 // Unknown architecture.
 #define CONVOLVE_FUNC Convolve_C
diff --git a/webrtc/common_audio/resampler/sinc_resampler.h b/webrtc/common_audio/resampler/sinc_resampler.h
index be84a99..9ad7895 100644
--- a/webrtc/common_audio/resampler/sinc_resampler.h
+++ b/webrtc/common_audio/resampler/sinc_resampler.h
@@ -107,7 +107,7 @@
   static float Convolve_SSE(const float* input_ptr, const float* k1,
                             const float* k2,
                             double kernel_interpolation_factor);
-#elif defined(WEBRTC_ARCH_ARM_V7) || defined(WEBRTC_ARCH_ARM64_NEON)
+#elif defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON)
   static float Convolve_NEON(const float* input_ptr, const float* k1,
                              const float* k2,
                              double kernel_interpolation_factor);
diff --git a/webrtc/common_audio/signal_processing/include/signal_processing_library.h b/webrtc/common_audio/signal_processing/include/signal_processing_library.h
index 7014fa1..745715d 100644
--- a/webrtc/common_audio/signal_processing/include/signal_processing_library.h
+++ b/webrtc/common_audio/signal_processing/include/signal_processing_library.h
@@ -105,9 +105,9 @@
 #include "webrtc/common_audio/signal_processing/include/spl_inl.h"
 
 // Initialize SPL. Currently it contains only function pointer initialization.
-// If the underlying platform is known to be ARM-Neon (WEBRTC_ARCH_ARM_NEON
-// defined), the pointers will be assigned to code optimized for Neon; otherwise
-// if run-time Neon detection (WEBRTC_DETECT_ARM_NEON) is enabled, the pointers
+// If the underlying platform is known to be ARM-Neon (WEBRTC_HAS_NEON defined),
+// the pointers will be assigned to code optimized for Neon; otherwise
+// if run-time Neon detection (WEBRTC_DETECT_NEON) is enabled, the pointers
 // will be assigned to either Neon code or generic C code; otherwise, generic C
 // code will be assigned.
 // Note that this function MUST be called in any application that uses SPL
@@ -154,8 +154,7 @@
 typedef int16_t (*MaxAbsValueW16)(const int16_t* vector, int length);
 extern MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16;
 int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, int length);
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 int16_t WebRtcSpl_MaxAbsValueW16Neon(const int16_t* vector, int length);
 #endif
 #if defined(MIPS32_LE)
@@ -173,8 +172,7 @@
 typedef int32_t (*MaxAbsValueW32)(const int32_t* vector, int length);
 extern MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32;
 int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, int length);
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 int32_t WebRtcSpl_MaxAbsValueW32Neon(const int32_t* vector, int length);
 #endif
 #if defined(MIPS_DSP_R1_LE)
@@ -194,8 +192,7 @@
 typedef int16_t (*MaxValueW16)(const int16_t* vector, int length);
 extern MaxValueW16 WebRtcSpl_MaxValueW16;
 int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, int length);
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 int16_t WebRtcSpl_MaxValueW16Neon(const int16_t* vector, int length);
 #endif
 #if defined(MIPS32_LE)
@@ -215,8 +212,7 @@
 typedef int32_t (*MaxValueW32)(const int32_t* vector, int length);
 extern MaxValueW32 WebRtcSpl_MaxValueW32;
 int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, int length);
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 int32_t WebRtcSpl_MaxValueW32Neon(const int32_t* vector, int length);
 #endif
 #if defined(MIPS32_LE)
@@ -236,8 +232,7 @@
 typedef int16_t (*MinValueW16)(const int16_t* vector, int length);
 extern MinValueW16 WebRtcSpl_MinValueW16;
 int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, int length);
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 int16_t WebRtcSpl_MinValueW16Neon(const int16_t* vector, int length);
 #endif
 #if defined(MIPS32_LE)
@@ -257,8 +252,7 @@
 typedef int32_t (*MinValueW32)(const int32_t* vector, int length);
 extern MinValueW32 WebRtcSpl_MinValueW32;
 int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, int length);
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 int32_t WebRtcSpl_MinValueW32Neon(const int32_t* vector, int length);
 #endif
 #if defined(MIPS32_LE)
@@ -558,8 +552,7 @@
                                  int16_t dim_cross_correlation,
                                  int16_t right_shifts,
                                  int16_t step_seq2);
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation,
                                     const int16_t* seq1,
                                     const int16_t* seq2,
@@ -724,8 +717,7 @@
                               int coefficients_length,
                               int factor,
                               int delay);
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
                                  int data_in_length,
                                  int16_t* data_out,
diff --git a/webrtc/common_audio/signal_processing/spl_init.c b/webrtc/common_audio/signal_processing/spl_init.c
index 0a49379..73c2039 100644
--- a/webrtc/common_audio/signal_processing/spl_init.c
+++ b/webrtc/common_audio/signal_processing/spl_init.c
@@ -28,8 +28,8 @@
 DownsampleFast WebRtcSpl_DownsampleFast;
 ScaleAndAddVectorsWithRound WebRtcSpl_ScaleAndAddVectorsWithRound;
 
-#if (defined(WEBRTC_DETECT_ARM_NEON) || !defined(WEBRTC_ARCH_ARM_NEON)) && \
-    !defined(MIPS32_LE) && !defined(WEBRTC_ARCH_ARM64_NEON)
+#if (defined(WEBRTC_DETECT_NEON) || !defined(WEBRTC_HAS_NEON)) && \
+    !defined(MIPS32_LE)
 /* Initialize function pointers to the generic C version. */
 static void InitPointersToC() {
   WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16C;
@@ -45,8 +45,7 @@
 }
 #endif
 
-#if defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON)
 /* Initialize function pointers to the Neon version. */
 static void InitPointersToNeon() {
   WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16Neon;
@@ -57,8 +56,6 @@
   WebRtcSpl_MinValueW32 = WebRtcSpl_MinValueW32Neon;
   WebRtcSpl_CrossCorrelation = WebRtcSpl_CrossCorrelationNeon;
   WebRtcSpl_DownsampleFast = WebRtcSpl_DownsampleFastNeon;
-  /* TODO(henrik.lundin): re-enable NEON when the crash from bug 3243 is
-     understood. */
   WebRtcSpl_ScaleAndAddVectorsWithRound =
       WebRtcSpl_ScaleAndAddVectorsWithRoundC;
 }
@@ -87,19 +84,19 @@
 #endif
 
 static void InitFunctionPointers(void) {
-#if defined(WEBRTC_DETECT_ARM_NEON)
+#if defined(WEBRTC_DETECT_NEON)
   if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
     InitPointersToNeon();
   } else {
     InitPointersToC();
   }
-#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON)
+#elif defined(WEBRTC_HAS_NEON)
   InitPointersToNeon();
 #elif defined(MIPS32_LE)
   InitPointersToMIPS();
 #else
   InitPointersToC();
-#endif  /* WEBRTC_DETECT_ARM_NEON */
+#endif  /* WEBRTC_DETECT_NEON */
 }
 
 #if defined(WEBRTC_POSIX)
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h
index cf1266a..8ecbd14 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h
@@ -90,8 +90,7 @@
                               int32_t* outre1Q16,
                               int32_t* outre2Q16);
 
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 void WebRtcIsacfix_Time2SpecNeon(int16_t* inre1Q9,
                                  int16_t* inre2Q9,
                                  int16_t* outre,
@@ -175,8 +174,7 @@
                                  int32_t* ptr1,
                                  int32_t* ptr2);
 
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r,
                                const int16_t* __restrict x,
                                int16_t N,
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h
index 63fe61f..ec20c71 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h
@@ -147,8 +147,7 @@
                                    const int matrix0_index_factor,
                                    const int matrix0_index_step);
 
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 void WebRtcIsacfix_MatrixProduct1Neon(const int16_t matrix0[],
                                       const int32_t matrix1[],
                                       int32_t matrix_product[],
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h
index fb042de..d6153e0 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h
@@ -63,9 +63,8 @@
 // Disable AllpassFilter2FixDec16Neon function due to a clang bug.
 // Refer more details at:
 // https://code.google.com/p/webrtc/issues/detail?id=4567
-#if !(defined __clang__)
-#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if !defined(__clang__) || !defined(WEBRTC_ARCH_ARM64)
+#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON)
 void WebRtcIsacfix_AllpassFilter2FixDec16Neon(
    int16_t *data_ch1,
    int16_t *data_ch2,
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc
index 79a590f..8ef05e8 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc
@@ -68,12 +68,12 @@
 // Disable AllpassFilter2FixDec16Neon function due to a clang bug.
 // Refer more details at:
 // https://code.google.com/p/webrtc/issues/detail?id=4567
-#if !(defined __clang__)
-#ifdef WEBRTC_DETECT_ARM_NEON
+#if !(defined __clang__) || !defined(WEBRTC_ARCH_ARM64)
+#ifdef WEBRTC_DETECT_NEON
   if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
     CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16Neon);
   }
-#elif defined(WEBRTC_ARCH_ARM_NEON)
+#elif defined(WEBRTC_HAS_NEON)
   CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16Neon);
 #endif
 #endif
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc b/webrtc/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc
index 4ea4dab..de1140b 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc
@@ -59,11 +59,11 @@
 
 TEST_F(FiltersTest, AutocorrFixTest) {
   FiltersTester(WebRtcIsacfix_AutocorrC);
-#ifdef WEBRTC_DETECT_ARM_NEON
+#ifdef WEBRTC_DETECT_NEON
   if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
     FiltersTester(WebRtcIsacfix_AutocorrNeon);
   }
-#elif defined(WEBRTC_ARCH_ARM_NEON)
+#elif defined(WEBRTC_HAS_NEON)
   FiltersTester(WebRtcIsacfix_AutocorrNeon);
 #endif
 }
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c
index 2fba3e6..f8abc8a 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c
@@ -198,8 +198,7 @@
  * This function initializes function pointers for ARM Neon platform.
  */
 
-#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON) || \
-  (defined WEBRTC_ARCH_ARM64_NEON)
+#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON)
 static void WebRtcIsacfix_InitNeon(void) {
   WebRtcIsacfix_AutocorrFix = WebRtcIsacfix_AutocorrNeon;
   WebRtcIsacfix_FilterMaLoopFix = WebRtcIsacfix_FilterMaLoopNeon;
@@ -208,7 +207,7 @@
 // Disable AllpassFilter2FixDec16Neon function due to a clang bug.
 // Refer more details at:
 // https://code.google.com/p/webrtc/issues/detail?id=4567
-#if !(defined __clang__)
+#if !defined(__clang__) || !defined(WEBRTC_ARCH_ARM64)
   WebRtcIsacfix_AllpassFilter2FixDec16 =
       WebRtcIsacfix_AllpassFilter2FixDec16Neon;
 #endif
@@ -334,11 +333,11 @@
   WebRtcIsacfix_MatrixProduct1 = WebRtcIsacfix_MatrixProduct1C;
   WebRtcIsacfix_MatrixProduct2 = WebRtcIsacfix_MatrixProduct2C;
 
-#ifdef WEBRTC_DETECT_ARM_NEON
+#ifdef WEBRTC_DETECT_NEON
   if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
     WebRtcIsacfix_InitNeon();
   }
-#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON)
+#elif defined(WEBRTC_HAS_NEON)
   WebRtcIsacfix_InitNeon();
 #endif
 
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c
index 8018a12..c402498 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c
@@ -9,11 +9,6 @@
  */
 
 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h"
-
-#ifdef WEBRTC_ARCH_ARM_NEON
-#include <arm_neon.h>
-#endif
-
 #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
 #include "webrtc/system_wrappers/interface/compile_assert_c.h"
 
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator_c.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator_c.c
index 81bdff5..362bc1a 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator_c.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator_c.c
@@ -10,7 +10,7 @@
 
 #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h"
 
-#ifdef WEBRTC_ARCH_ARM_NEON
+#ifdef WEBRTC_HAS_NEON
 #include <arm_neon.h>
 #endif
 
@@ -56,7 +56,10 @@
     ysum32 -= in[k - 1] * in[k - 1] >> scaling;
     ysum32 += in[PITCH_CORR_LEN2 + k - 1] * in[PITCH_CORR_LEN2 + k - 1] >>
         scaling;
-#ifdef WEBRTC_ARCH_ARM_NEON
+
+    // TODO(zhongwei.yao): Move this function into a separate NEON code file so
+    // that WEBRTC_DETECT_NEON could take advantage of it.
+#ifdef WEBRTC_HAS_NEON
     {
       int32_t vbuff[4];
       int32x4_t int_32x4_sum = vmovq_n_s32(0);
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc b/webrtc/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc
index 855b5fe..dd5ab32 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc
@@ -175,22 +175,22 @@
 
 TEST_F(TransformTest, Time2SpecTest) {
   Time2SpecTester(WebRtcIsacfix_Time2SpecC);
-#ifdef WEBRTC_DETECT_ARM_NEON
+#ifdef WEBRTC_DETECT_NEON
   if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
     Time2SpecTester(WebRtcIsacfix_Time2SpecNeon);
   }
-#elif defined(WEBRTC_ARCH_ARM_NEON)
+#elif defined(WEBRTC_HAS_NEON)
   Time2SpecTester(WebRtcIsacfix_Time2SpecNeon);
 #endif
 }
 
 TEST_F(TransformTest, Spec2TimeTest) {
   Spec2TimeTester(WebRtcIsacfix_Spec2TimeC);
-#ifdef WEBRTC_DETECT_ARM_NEON
+#ifdef WEBRTC_DETECT_NEON
   if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
     Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon);
   }
-#elif defined(WEBRTC_ARCH_ARM_NEON)
+#elif defined(WEBRTC_HAS_NEON)
   Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon);
 #endif
 }
diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc
index 283595e..80ce082 100644
--- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc
+++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc
@@ -555,7 +555,7 @@
 };
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_8kHzOutput DISABLED_8kHzOutput
 #else
 #define MAYBE_8kHzOutput 8kHzOutput
@@ -568,7 +568,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_16kHzOutput DISABLED_16kHzOutput
 #else
 #define MAYBE_16kHzOutput 16kHzOutput
@@ -581,7 +581,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_32kHzOutput DISABLED_32kHzOutput
 #else
 #define MAYBE_32kHzOutput 32kHzOutput
@@ -594,7 +594,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_48kHzOutput DISABLED_48kHzOutput
 #else
 #define MAYBE_48kHzOutput 48kHzOutput
@@ -760,7 +760,7 @@
 };
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_IsacWb30ms DISABLED_IsacWb30ms
 #else
 #define MAYBE_IsacWb30ms IsacWb30ms
@@ -780,7 +780,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_IsacWb60ms DISABLED_IsacWb60ms
 #else
 #define MAYBE_IsacWb60ms IsacWb60ms
@@ -944,7 +944,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_Opus_stereo_20ms DISABLED_Opus_stereo_20ms
 #else
 #define MAYBE_Opus_stereo_20ms Opus_stereo_20ms
diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
index c218c2b..929439f 100644
--- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
+++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
@@ -750,7 +750,7 @@
 };
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_8kHzOutput DISABLED_8kHzOutput
 #else
 #define MAYBE_8kHzOutput 8kHzOutput
@@ -763,7 +763,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_16kHzOutput DISABLED_16kHzOutput
 #else
 #define MAYBE_16kHzOutput 16kHzOutput
@@ -776,7 +776,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_32kHzOutput DISABLED_32kHzOutput
 #else
 #define MAYBE_32kHzOutput 32kHzOutput
@@ -789,7 +789,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_48kHzOutput DISABLED_48kHzOutput
 #else
 #define MAYBE_48kHzOutput 48kHzOutput
@@ -976,7 +976,7 @@
 };
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_IsacWb30ms DISABLED_IsacWb30ms
 #else
 #define MAYBE_IsacWb30ms IsacWb30ms
@@ -996,7 +996,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_IsacWb60ms DISABLED_IsacWb60ms
 #else
 #define MAYBE_IsacWb60ms IsacWb60ms
@@ -1151,7 +1151,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_Opus_stereo_20ms DISABLED_Opus_stereo_20ms
 #else
 #define MAYBE_Opus_stereo_20ms Opus_stereo_20ms
@@ -1171,7 +1171,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_Opus_stereo_20ms_voip DISABLED_Opus_stereo_20ms_voip
 #else
 #define MAYBE_Opus_stereo_20ms_voip Opus_stereo_20ms_voip
diff --git a/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc b/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc
index 334a2fc..1850807 100644
--- a/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc
@@ -538,7 +538,7 @@
 }
 
 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4198
-#if defined(WEBRTC_ANDROID) && defined(__aarch64__)
+#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_EncodeDecode DISABLED_EncodeDecode
 #else
 #define MAYBE_EncodeDecode EncodeDecode
diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c
index 4d59956..374647d 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.c
+++ b/webrtc/modules/audio_processing/aec/aec_core.c
@@ -1458,9 +1458,9 @@
   WebRtcAec_InitAec_mips();
 #endif
 
-#if defined(WEBRTC_ARCH_ARM_NEON)
+#if defined(WEBRTC_HAS_NEON)
   WebRtcAec_InitAec_neon();
-#elif defined(WEBRTC_DETECT_ARM_NEON)
+#elif defined(WEBRTC_DETECT_NEON)
   if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
     WebRtcAec_InitAec_neon();
   }
diff --git a/webrtc/modules/audio_processing/aec/aec_core.h b/webrtc/modules/audio_processing/aec/aec_core.h
index cc9e81b..d9335e3 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.h
+++ b/webrtc/modules/audio_processing/aec/aec_core.h
@@ -58,7 +58,7 @@
 #if defined(MIPS_FPU_LE)
 void WebRtcAec_InitAec_mips(void);
 #endif
-#if defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON)
+#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON)
 void WebRtcAec_InitAec_neon(void);
 #endif
 
diff --git a/webrtc/modules/audio_processing/aec/aec_core_neon.c b/webrtc/modules/audio_processing/aec/aec_core_neon.c
index f8d0b24..9a677aa 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_neon.c
+++ b/webrtc/modules/audio_processing/aec/aec_core_neon.c
@@ -78,7 +78,7 @@
 }
 
 // ARM64's arm_neon.h has already defined vdivq_f32 vsqrtq_f32.
-#if !defined (WEBRTC_ARCH_ARM64_NEON)
+#if !defined (WEBRTC_ARCH_ARM64)
 static float32x4_t vdivq_f32(float32x4_t a, float32x4_t b) {
   int i;
   float32x4_t x = vrecpeq_f32(b);
@@ -120,7 +120,7 @@
   // sqrt(s) = s * 1/sqrt(s)
   return vmulq_f32(s, x);;
 }
-#endif  // WEBRTC_ARCH_ARM64_NEON
+#endif  // WEBRTC_ARCH_ARM64
 
 static void ScaleErrorSignalNEON(AecCore* aec, float ef[2][PART_LEN1]) {
   const float mu = aec->extended_filter_enabled ? kExtendedMu : aec->normal_mu;
diff --git a/webrtc/modules/audio_processing/aec/aec_rdft.c b/webrtc/modules/audio_processing/aec/aec_rdft.c
index 015617c..2c3cff2 100644
--- a/webrtc/modules/audio_processing/aec/aec_rdft.c
+++ b/webrtc/modules/audio_processing/aec/aec_rdft.c
@@ -579,9 +579,9 @@
 #if defined(MIPS_FPU_LE)
   aec_rdft_init_mips();
 #endif
-#if defined(WEBRTC_ARCH_ARM_NEON)
+#if defined(WEBRTC_HAS_NEON)
   aec_rdft_init_neon();
-#elif defined(WEBRTC_DETECT_ARM_NEON)
+#elif defined(WEBRTC_DETECT_NEON)
   if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
     aec_rdft_init_neon();
   }
diff --git a/webrtc/modules/audio_processing/aec/aec_rdft.h b/webrtc/modules/audio_processing/aec/aec_rdft.h
index 22f5dd1..18eb7a5 100644
--- a/webrtc/modules/audio_processing/aec/aec_rdft.h
+++ b/webrtc/modules/audio_processing/aec/aec_rdft.h
@@ -54,7 +54,7 @@
 #if defined(MIPS_FPU_LE)
 void aec_rdft_init_mips(void);
 #endif
-#if defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON)
+#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON)
 void aec_rdft_init_neon(void);
 #endif
 
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.c b/webrtc/modules/audio_processing/aecm/aecm_core.c
index 6741acb..b124e30 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core.c
+++ b/webrtc/modules/audio_processing/aecm/aecm_core.c
@@ -373,8 +373,7 @@
 }
 
 // Initialize function pointers for ARM Neon platform.
-#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON || \
-     defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON)
 static void WebRtcAecm_InitNeon(void)
 {
   WebRtcAecm_StoreAdaptiveChannel = WebRtcAecm_StoreAdaptiveChannelNeon;
@@ -521,13 +520,13 @@
     WebRtcAecm_StoreAdaptiveChannel = StoreAdaptiveChannelC;
     WebRtcAecm_ResetAdaptiveChannel = ResetAdaptiveChannelC;
 
-#ifdef WEBRTC_DETECT_ARM_NEON
+#ifdef WEBRTC_DETECT_NEON
     uint64_t features = WebRtc_GetCPUFeaturesARM();
     if ((features & kCPUFeatureNEON) != 0)
     {
       WebRtcAecm_InitNeon();
     }
-#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON)
+#elif defined(WEBRTC_HAS_NEON)
     WebRtcAecm_InitNeon();
 #endif
 
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.h b/webrtc/modules/audio_processing/aecm/aecm_core.h
index 15614d6..5646e8f 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core.h
+++ b/webrtc/modules/audio_processing/aecm/aecm_core.h
@@ -409,8 +409,7 @@
 // For the above function pointers, functions for generic platforms are declared
 // and defined as static in file aecm_core.c, while those for ARM Neon platforms
 // are declared below and defined in file aecm_core_neon.c.
-#if (defined WEBRTC_DETECT_ARM_NEON) || defined (WEBRTC_ARCH_ARM_NEON) || \
-     defined (WEBRTC_ARCH_ARM64_NEON)
+#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON)
 void WebRtcAecm_CalcLinearEnergiesNeon(AecmCore* aecm,
                                        const uint16_t* far_spectrum,
                                        int32_t* echo_est,
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_c.c b/webrtc/modules/audio_processing/aecm/aecm_core_c.c
index 3a06bb6..eb2bd91 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core_c.c
+++ b/webrtc/modules/audio_processing/aecm/aecm_core_c.c
@@ -23,7 +23,7 @@
 #include "webrtc/typedefs.h"
 
 // Square root of Hanning window in Q14.
-#if defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON)
+#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON)
 // Table is defined in an ARM assembly file.
 extern const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END;
 #else
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_neon.c b/webrtc/modules/audio_processing/aecm/aecm_core_neon.c
index 40c145a..1751fcf 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core_neon.c
+++ b/webrtc/modules/audio_processing/aecm/aecm_core_neon.c
@@ -32,7 +32,7 @@
 };
 
 static inline void AddLanes(uint32_t* ptr, uint32x4_t v) {
-#if defined(__aarch64__)
+#if defined(WEBRTC_ARCH_ARM64)
   *(ptr) = vaddvq_u32(v);
 #else
   uint32x2_t tmp_v;
diff --git a/webrtc/modules/audio_processing/ns/nsx_core.c b/webrtc/modules/audio_processing/ns/nsx_core.c
index aa46d08..f6711b5 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core.c
+++ b/webrtc/modules/audio_processing/ns/nsx_core.c
@@ -19,7 +19,7 @@
 #include "webrtc/modules/audio_processing/ns/nsx_core.h"
 #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h"
 
-#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON)
+#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON)
 /* Tables are defined in ARM assembly files. */
 extern const int16_t WebRtcNsx_kLogTable[9];
 extern const int16_t WebRtcNsx_kCounterDiv[201];
@@ -65,7 +65,7 @@
   237, 238, 238, 239, 240, 241, 241, 242, 243, 244, 244, 245, 246, 247, 247,
   248, 249, 249, 250, 251, 252, 252, 253, 254, 255, 255
 };
-#endif  // WEBRTC_DETECT_ARM_NEON || WEBRTC_ARCH_ARM_NEON
+#endif  // WEBRTC_DETECT_NEON || WEBRTC_HAS_NEON
 
 // Skip first frequency bins during estimation. (0 <= value < 64)
 static const int kStartBand = 5;
@@ -557,8 +557,7 @@
 Denormalize WebRtcNsx_Denormalize;
 NormalizeRealBuffer WebRtcNsx_NormalizeRealBuffer;
 
-#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON || \
-     defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON)
 // Initialize function pointers for ARM Neon platform.
 static void WebRtcNsx_InitNeon(void) {
   WebRtcNsx_NoiseEstimation = WebRtcNsx_NoiseEstimationNeon;
@@ -763,12 +762,12 @@
   WebRtcNsx_Denormalize = DenormalizeC;
   WebRtcNsx_NormalizeRealBuffer = NormalizeRealBufferC;
 
-#ifdef WEBRTC_DETECT_ARM_NEON
+#ifdef WEBRTC_DETECT_NEON
   uint64_t features = WebRtc_GetCPUFeaturesARM();
   if ((features & kCPUFeatureNEON) != 0) {
       WebRtcNsx_InitNeon();
   }
-#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON)
+#elif defined(WEBRTC_HAS_NEON)
   WebRtcNsx_InitNeon();
 #endif
 
diff --git a/webrtc/modules/audio_processing/ns/nsx_core.h b/webrtc/modules/audio_processing/ns/nsx_core.h
index 8f0db6d..33b9a32 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core.h
+++ b/webrtc/modules/audio_processing/ns/nsx_core.h
@@ -215,8 +215,7 @@
                                uint32_t* priorLocSnr,
                                uint32_t* postLocSnr);
 
-#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON || \
-     defined WEBRTC_ARCH_ARM64_NEON)
+#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON)
 // For the above function pointers, functions for generic platforms are declared
 // and defined as static in file nsx_core.c, while those for ARM Neon platforms
 // are declared below and defined in file nsx_core_neon.c.
diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h
index 8bcaa88..3034c7e 100644
--- a/webrtc/typedefs.h
+++ b/webrtc/typedefs.h
@@ -55,8 +55,10 @@
 #error Define either WEBRTC_ARCH_LITTLE_ENDIAN or WEBRTC_ARCH_BIG_ENDIAN
 #endif
 
-#if (defined(WEBRTC_ARCH_X86_FAMILY) && !defined(__SSE2__)) ||  \
-    (defined(WEBRTC_ARCH_ARM_V7) && !defined(WEBRTC_ARCH_ARM_NEON))
+// TODO(zhongwei.yao): WEBRTC_CPU_DETECTION is only used in one place; we should
+// probably just remove it.
+#if (defined(WEBRTC_ARCH_X86_FAMILY) && !defined(__SSE2__)) || \
+    defined(WEBRTC_DETECT_NEON)
 #define WEBRTC_CPU_DETECTION
 #endif