KleidiCV Coverage Report


Directory: ./
File: kleidicv/src/arithmetics/add_api.cpp
Date: 2025-09-25 14:13:34
Exec Total Coverage
Lines: 8 8 100.0%
Functions: 8 8 100.0%
Branches: 32 32 100.0%

Line Branch Exec Source
1 // SPDX-FileCopyrightText: 2023 - 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 #include "kleidicv/dispatch.h"
6 #include "kleidicv/kleidicv.h"
7 #include "kleidicv/types.h"
8
9 namespace kleidicv {
10
11 namespace neon {
12
13 template <typename T>
14 kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride,
15 const T *src_b, size_t src_b_stride, T *dst,
16 size_t dst_stride, size_t width, size_t height);
17
18 } // namespace neon
19
20 namespace sve2 {
21
22 template <typename T>
23 kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride,
24 const T *src_b, size_t src_b_stride, T *dst,
25 size_t dst_stride, size_t width, size_t height);
26
27 } // namespace sve2
28
29 namespace sme {
30 template <typename T>
31 kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride,
32 const T *src_b, size_t src_b_stride, T *dst,
33 size_t dst_stride, size_t width, size_t height);
34
35 } // namespace sme
36
37 #if KLEIDICV_EXPERIMENTAL_FEATURE_ADD_SME2
38 namespace sme2 {
39 template <typename T>
40 kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride,
41 const T *src_b, size_t src_b_stride, T *dst,
42 size_t dst_stride, size_t width, size_t height);
43
44 } // namespace sme2
45
46 #endif // KLEIDICV_EXPERIMENTAL_FEATURE_ADD_SME2
47
48 } // namespace kleidicv
49
50 #if KLEIDICV_EXPERIMENTAL_FEATURE_ADD_SME2
51 #define KLEIDICV_DEFINE_C_API(name, type) \
52 KLEIDICV_MULTIVERSION_C_API( \
53 name, &kleidicv::neon::saturating_add<type>, \
54 KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::saturating_add<type>), \
55 KLEIDICV_SME_IMPL_IF(&kleidicv::sme::saturating_add<type>), \
56 KLEIDICV_SME2_IMPL_IF(&kleidicv::sme2::saturating_add<type>))
57 #else
58 #define KLEIDICV_DEFINE_C_API(name, type) \
59 KLEIDICV_MULTIVERSION_C_API( \
60 name, &kleidicv::neon::saturating_add<type>, \
61 KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::saturating_add<type>), \
62 KLEIDICV_SME_IMPL_IF(&kleidicv::sme::saturating_add<type>), nullptr)
63 #endif // KLEIDICV_EXPERIMENTAL_FEATURE_ADD_SME2
64
65
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_s8, int8_t);
66
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_u8, uint8_t);
67
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_s16, int16_t);
68
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_u16, uint16_t);
69
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_s32, int32_t);
70
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_u32, uint32_t);
71
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_s64, int64_t);
72
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_saturating_add_u64, uint64_t);
73