From 716af69aa402cabe45dabf2eaa65d86198876662 Mon Sep 17 00:00:00 2001 From: Mark Horvath Date: Wed, 13 Mar 2024 15:39:13 +0100 Subject: [PATCH 1/2] Add float and double SVE2 vector traits --- intrinsiccv/include/intrinsiccv/sve2.h | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/intrinsiccv/include/intrinsiccv/sve2.h b/intrinsiccv/include/intrinsiccv/sve2.h index 5c84a467e..8193c9b38 100644 --- a/intrinsiccv/include/intrinsiccv/sve2.h +++ b/intrinsiccv/include/intrinsiccv/sve2.h @@ -115,6 +115,26 @@ class VectorTypes { using Vector4Type = svuint64x4_t; }; // end of class VectorTypes +template <> +class VectorTypes { + public: + using ScalarType = float; + using VectorType = svfloat32_t; + using Vector2Type = svfloat32x2_t; + using Vector3Type = svfloat32x3_t; + using Vector4Type = svfloat32x4_t; +}; // end of class VectorTypes + +template <> +class VectorTypes { + public: + using ScalarType = double; + using VectorType = svfloat64_t; + using Vector2Type = svfloat64x2_t; + using Vector3Type = svfloat64x3_t; + using Vector4Type = svfloat64x4_t; +}; // end of class VectorTypes + // Base class for all SVE vector traits. template class VecTraitsBase : public VectorTypes { @@ -368,6 +388,22 @@ class VecTraits : public VecTraitsBase { } }; // end of class VecTraits +template <> +class VecTraits : public VecTraitsBase { + public: + static inline svfloat32_t svdup(float v) INTRINSICCV_STREAMING_COMPATIBLE { + return svdup_f32(v); + } +}; // end of class VecTraits + +template <> +class VecTraits : public VecTraitsBase { + public: + static inline svfloat64_t svdup(double v) INTRINSICCV_STREAMING_COMPATIBLE { + return svdup_f64(v); + } +}; // end of class VecTraits + // Adapter which adds context and forwards arguments. template class OperationContextAdapter : public OperationBase { -- GitLab From 07d7abe05d02617d519fb768efaf215d210abf59 Mon Sep 17 00:00:00 2001 From: Mark Horvath Date: Thu, 14 Mar 2024 07:20:59 +0100 Subject: [PATCH 2/2] Lane number of floating point vectors for tests --- test/framework/utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/framework/utils.h b/test/framework/utils.h index 23216c786..3c4a9bba5 100644 --- a/test/framework/utils.h +++ b/test/framework/utils.h @@ -59,9 +59,9 @@ class Options { // Returns seed to use. static uint64_t seed() { return seed_; } - // Returns the number of lanes in a vector for a given integral type. + // Returns the number of lanes in a vector for a given arithmetic type. template , bool> = true> + std::enable_if_t, bool> = true> static size_t vector_lanes() { return vector_length_ / sizeof(ElementType); } -- GitLab