Compilation issue: neon=1 armv8.2 on Android with NDKr18beta1

- The issue was related to the __fp16 specialization on the depthwise
  convolution layer (cpu)

Resolves COMPMID-4741

Change-Id: I6072230c60df6659951db2a1adf611eca6ab7efe
Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6026
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
diff --git a/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst.hpp b/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst.hpp
index a92817b..53ad5b5 100644
--- a/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst.hpp
+++ b/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst.hpp
@@ -154,16 +154,7 @@
 
     // Compute activation values
     TAccum activation_min, activation_max;
-    if (std::numeric_limits<TAccum>::is_integer)
-    {
-      activation_min = std::numeric_limits<TAccum>::min();
-      activation_max = std::numeric_limits<TAccum>::max();
-    }
-    else
-    {
-      activation_min = static_cast<TAccum>(-std::numeric_limits<float>::infinity());
-      activation_max = static_cast<TAccum>(std::numeric_limits<float>::infinity());
-    }
+    std::tie(activation_min, activation_max) = get_default_activation_values<TAccum>();
 
     switch (this->m_args.activation.type)
     {
diff --git a/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst_generic.hpp b/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst_generic.hpp
index ee5ab84..f04f775 100644
--- a/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst_generic.hpp
+++ b/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst_generic.hpp
@@ -333,16 +333,7 @@
 
     // Compute activation values
     TAccum activation_min, activation_max;
-    if (std::numeric_limits<TAccum>::is_integer)
-    {
-      activation_min = std::numeric_limits<TAccum>::min();
-      activation_max = std::numeric_limits<TAccum>::max();
-    }
-    else
-    {
-      activation_min = static_cast<TAccum>(-std::numeric_limits<float>::infinity());
-      activation_max = static_cast<TAccum>(std::numeric_limits<float>::infinity());
-    }
+    std::tie(activation_min, activation_max) = get_default_activation_values<TAccum>();
 
     switch (this->m_args.activation.type)
     {
diff --git a/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst_generic_multiplier.hpp b/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst_generic_multiplier.hpp
index 31e5834..bb580e6 100644
--- a/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst_generic_multiplier.hpp
+++ b/src/core/NEON/kernels/arm_conv/depthwise/depthwise_depthfirst_generic_multiplier.hpp
@@ -426,16 +426,7 @@
 
     // Compute activation values
     TAccum activation_min, activation_max;
-    if (std::numeric_limits<TAccum>::is_integer)
-    {
-      activation_min = std::numeric_limits<TAccum>::min();
-      activation_max = std::numeric_limits<TAccum>::max();
-    }
-    else
-    {
-      activation_min = static_cast<TAccum>(-std::numeric_limits<float>::infinity());
-      activation_max = static_cast<TAccum>(std::numeric_limits<float>::infinity());
-    }
+    std::tie(activation_min, activation_max) = get_default_activation_values<TAccum>();
 
     switch (this->m_args.activation.type)
     {
diff --git a/src/core/NEON/kernels/arm_gemm/utils.hpp b/src/core/NEON/kernels/arm_gemm/utils.hpp
index 82464d2..2ae3db1 100644
--- a/src/core/NEON/kernels/arm_gemm/utils.hpp
+++ b/src/core/NEON/kernels/arm_gemm/utils.hpp
@@ -27,6 +27,7 @@
 #include "arm_gemm.hpp"
 
 #include <cstddef>
+#include <tuple>
 
 // Macro for unreachable code (e.g. impossible default cases on switch)
 #define UNREACHABLE(why)  __builtin_unreachable()
@@ -202,6 +203,38 @@
       return 16 / sizeof(T);
   }
 }
+
+// get_default_activation_values(): Returns the default values for activation min and max for integer activation.
+template <typename T>
+inline std::tuple<T, T> get_default_activation_values()
+{
+    const T min = static_cast<T>(std::numeric_limits<T>::min());
+    const T max = static_cast<T>(std::numeric_limits<T>::max());
+
+    return std::make_tuple(min, max);
+}
+
+// get_default_activation_values(): Returns the default values for activation min and max for float activation.
+template <>
+inline std::tuple<float, float> get_default_activation_values()
+{
+    const float min = static_cast<float>(-std::numeric_limits<float>::infinity());
+    const float max = static_cast<float>(std::numeric_limits<float>::infinity());
+
+    return std::make_tuple(min, max);
+}
+
+#if defined(__ARM_FP16_ARGS)
+// get_default_activation_values(): Returns the default values for activation min and max for __fp16 activation.
+template <>
+inline std::tuple<__fp16, __fp16> get_default_activation_values()
+{
+    const __fp16 min = static_cast<__fp16>(-std::numeric_limits<float>::infinity());
+    const __fp16 max = static_cast<__fp16>(std::numeric_limits<float>::infinity());
+
+    return std::make_tuple(min, max);
+}
+#endif  // defined(__ARM_FP16_ARGS)
 } // utils namespace
 } // arm_gemm namespace