blob: 00ef7b7eb38e3f5ab46e7ae09f860364a2173919 [file] [log] [blame]
Sang-Hoon Park0870db42020-12-08 18:42:19 +00001/*
2 * Copyright (c) 2020 Arm Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCVT_H
25#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCVT_H
26#if defined(__ARM_FEATURE_SVE)
27#include <arm_sve.h>
28namespace arm_compute
29{
30namespace wrapper
31{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010032#define SVCVT_Z_TO_F32_IMPL(vtype) \
33 template <typename T> \
34 inline typename std::enable_if<std::is_same<T, float>::value, svfloat32_t>::type svcvt_z(svbool_t pg, \
35 const vtype &a) \
36 { \
37 return svcvt_f32_z(pg, a); \
Sang-Hoon Park0870db42020-12-08 18:42:19 +000038 }
39
40SVCVT_Z_TO_F32_IMPL(svuint32_t)
41SVCVT_Z_TO_F32_IMPL(svint32_t)
42SVCVT_Z_TO_F32_IMPL(svfloat16_t)
43
44#undef SVCVT_Z_TO_F32_IMPL
45
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010046#define SVCVT_Z_TO_F16_IMPL(vtype) \
47 template <typename T> \
48 inline typename std::enable_if<std::is_same<T, float16_t>::value, svfloat16_t>::type svcvt_z(svbool_t pg, \
49 const vtype &a) \
50 { \
51 return svcvt_f16_z(pg, a); \
Sang-Hoon Park0870db42020-12-08 18:42:19 +000052 }
53
54SVCVT_Z_TO_F16_IMPL(svuint32_t)
55SVCVT_Z_TO_F16_IMPL(svint32_t)
56SVCVT_Z_TO_F16_IMPL(svfloat32_t)
57
58#undef SVCVT_Z_TO_F16_IMPL
59
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010060#define SVCVT_Z_TO_S32_IMPL(vtype) \
61 template <typename T> \
62 inline typename std::enable_if<std::is_same<T, int32_t>::value, svint32_t>::type svcvt_z(svbool_t pg, \
63 const vtype &a) \
64 { \
65 return svcvt_s32_z(pg, a); \
Sang-Hoon Park0870db42020-12-08 18:42:19 +000066 }
67
68SVCVT_Z_TO_S32_IMPL(svfloat16_t)
69SVCVT_Z_TO_S32_IMPL(svfloat32_t)
70
71#undef SVCVT_Z_TO_S32_IMPL
72
73} // namespace wrapper
74} // namespace arm_compute
75
76#endif /* defined(__ARM_FEATURE_SVE) */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010077#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCVT_H */