diff options
author | Sang-Hoon Park <sang-hoon.park@arm.com> | 2020-12-08 18:42:19 +0000 |
---|---|---|
committer | Sang-Hoon Park <sang-hoon.park@arm.com> | 2021-01-04 13:53:41 +0000 |
commit | 0870db478fc46213138bcfd6e1536610ea145ecf (patch) | |
tree | 766cf948f9125d319248baee8101118c965d4de4 /src/core/NEON/wrapper/intrinsics | |
parent | 8a8f4fac9776b036aec2a50b1473c30750ed32d2 (diff) | |
download | ComputeLibrary-0870db478fc46213138bcfd6e1536610ea145ecf.tar.gz |
Add utility functions for SVE
- Few bit-width dependent intrinsics are added.
- Few math functions are added.
Partially implements: COMPMID-3872
Change-Id: Ia6ab46bd170fec9c7c8d4410b7ef4d84710b68ed
Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4718
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/NEON/wrapper/intrinsics')
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/intrinsics.h | 11 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svcnt.h | 68 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svcvt.h | 74 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svdup_n.h | 57 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svexp.h | 49 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svlog.h | 47 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svpow.h | 47 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svptrue.h | 68 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svreinterpret.h | 57 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svsin.h | 47 | ||||
-rw-r--r-- | src/core/NEON/wrapper/intrinsics/svwhilelt.h | 73 |
11 files changed, 598 insertions, 0 deletions
diff --git a/src/core/NEON/wrapper/intrinsics/intrinsics.h b/src/core/NEON/wrapper/intrinsics/intrinsics.h index c6bad3f9dd..6cf7f9d287 100644 --- a/src/core/NEON/wrapper/intrinsics/intrinsics.h +++ b/src/core/NEON/wrapper/intrinsics/intrinsics.h @@ -73,4 +73,15 @@ #include "src/core/NEON/wrapper/intrinsics/tanh.h" #include "src/core/NEON/wrapper/intrinsics/tbl.h" +#if defined(__ARM_FEATURE_SVE) +#include "src/core/NEON/wrapper/intrinsics/svcnt.h" +#include "src/core/NEON/wrapper/intrinsics/svcvt.h" +#include "src/core/NEON/wrapper/intrinsics/svdup_n.h" +#include "src/core/NEON/wrapper/intrinsics/svexp.h" +#include "src/core/NEON/wrapper/intrinsics/svlog.h" +#include "src/core/NEON/wrapper/intrinsics/svptrue.h" +#include "src/core/NEON/wrapper/intrinsics/svsin.h" +#include "src/core/NEON/wrapper/intrinsics/svwhilelt.h" +#endif /* defined(__ARM_FEATURE_SVE) */ + #endif /* ARM_COMPUTE_WRAPPER_INTRINSICS_H */ diff --git a/src/core/NEON/wrapper/intrinsics/svcnt.h b/src/core/NEON/wrapper/intrinsics/svcnt.h new file mode 100644 index 0000000000..e530e7c83f --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svcnt.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCNT_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCNT_H +#if defined(__ARM_FEATURE_SVE) +#include <arm_sve.h> +namespace arm_compute +{ +namespace wrapper +{ +template <size_t element_size> +inline uint64_t svcnt_size(); + +template <> +inline uint64_t svcnt_size<64>() +{ + return svcntd(); +} + +template <> +inline uint64_t svcnt_size<32>() +{ + return svcntw(); +} + +template <> +inline uint64_t svcnt_size<16>() +{ + return svcnth(); +} + +template <> +inline uint64_t svcnt_size<8>() +{ + return svcntb(); +} + +template <typename T> +inline uint64_t svcnt() +{ + return svcnt_size<sizeof(T) * 8>(); +} +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCNT_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svcvt.h b/src/core/NEON/wrapper/intrinsics/svcvt.h new file mode 100644 index 0000000000..746b004d7d --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svcvt.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCVT_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCVT_H +#if defined(__ARM_FEATURE_SVE) +#include <arm_sve.h> +namespace arm_compute +{ +namespace wrapper +{ +#define SVCVT_Z_TO_F32_IMPL(vtype) \ + template <typename T> \ + inline typename std::enable_if<std::is_same<T, float>::value, svfloat32_t>::type svcvt_z(svbool_t pg, const vtype &a) \ + { \ + return svcvt_f32_z(pg, a); \ + } + +SVCVT_Z_TO_F32_IMPL(svuint32_t) +SVCVT_Z_TO_F32_IMPL(svint32_t) +SVCVT_Z_TO_F32_IMPL(svfloat16_t) + +#undef SVCVT_Z_TO_F32_IMPL + +#define SVCVT_Z_TO_F16_IMPL(vtype) \ + template <typename T> \ + inline typename std::enable_if<std::is_same<T, float16_t>::value, svfloat16_t>::type svcvt_z(svbool_t pg, const vtype &a) \ + { \ + return svcvt_f16_z(pg, a); \ + } + +SVCVT_Z_TO_F16_IMPL(svuint32_t) +SVCVT_Z_TO_F16_IMPL(svint32_t) +SVCVT_Z_TO_F16_IMPL(svfloat32_t) + +#undef SVCVT_Z_TO_F16_IMPL + +#define SVCVT_Z_TO_S32_IMPL(vtype) \ + template <typename T> \ + inline typename std::enable_if<std::is_same<T, int32_t>::value, svint32_t>::type svcvt_z(svbool_t pg, const vtype &a) \ + { \ + return svcvt_s32_z(pg, a); \ + } + +SVCVT_Z_TO_S32_IMPL(svfloat16_t) +SVCVT_Z_TO_S32_IMPL(svfloat32_t) + +#undef SVCVT_Z_TO_S32_IMPL + +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVCVT_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svdup_n.h b/src/core/NEON/wrapper/intrinsics/svdup_n.h new file mode 100644 index 0000000000..b1aed97d9c --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svdup_n.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVDUP_N_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVDUP_N_H +#if defined(__ARM_FEATURE_SVE) +#include <arm_sve.h> +namespace arm_compute +{ +namespace wrapper +{ +#define SVDUP_N_IMPL(etype, vtype, postfix) \ + inline vtype svdup_n(etype a) \ + { \ + return svdup_n_##postfix(a); \ + } + +SVDUP_N_IMPL(int8_t, svint8_t, s8) +SVDUP_N_IMPL(int16_t, svint16_t, s16) +SVDUP_N_IMPL(int32_t, svint32_t, s32) +SVDUP_N_IMPL(int64_t, svint64_t, s64) +SVDUP_N_IMPL(uint8_t, svuint8_t, u8) +SVDUP_N_IMPL(uint16_t, svuint16_t, u16) +SVDUP_N_IMPL(uint32_t, svuint32_t, u32) +SVDUP_N_IMPL(uint64_t, svuint64_t, u64) +SVDUP_N_IMPL(float16_t, svfloat16_t, f16) +SVDUP_N_IMPL(float, svfloat32_t, f32) +SVDUP_N_IMPL(float64_t, svfloat64_t, f64) +SVDUP_N_IMPL(bfloat16_t, svbfloat16_t, bf16) + +#undef SVDUP_N_IMPL + +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVDUP_N_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svexp.h b/src/core/NEON/wrapper/intrinsics/svexp.h new file mode 100644 index 0000000000..d6ce9a77d1 --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svexp.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVEXP_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVEXP_H + +#if defined(__ARM_FEATURE_SVE) +#include "src/core/NEON/SVEMath.h" +#include <arm_sve.h> + +namespace arm_compute +{ +namespace wrapper +{ +#define SVEXP_IMPL(vtype, postfix) \ + inline vtype svexp_z(svbool_t pg, const vtype &a) \ + { \ + return svexp_##postfix##_z(pg, a); \ + } + +SVEXP_IMPL(svfloat32_t, f32) +SVEXP_IMPL(svfloat16_t, f16) + +#undef SVEXP_IMPL +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVEXP_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svlog.h b/src/core/NEON/wrapper/intrinsics/svlog.h new file mode 100644 index 0000000000..5b505ae1e3 --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svlog.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVLOG_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVLOG_H +#if defined(__ARM_FEATURE_SVE) +#include "src/core/NEON/SVEMath.h" +#include <arm_sve.h> + +namespace arm_compute +{ +namespace wrapper +{ +#define SVLOG_IMPL(vtype, postfix) \ + inline vtype svlog_z(svbool_t pg, const vtype &a) \ + { \ + return svlog_##postfix##_z(pg, a); \ + } + +SVLOG_IMPL(svfloat32_t, f32) +SVLOG_IMPL(svfloat16_t, f16) + +#undef SVLOG_IMPL +} // namespace wrapper +} // namespace arm_compute +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVLOG_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svpow.h b/src/core/NEON/wrapper/intrinsics/svpow.h new file mode 100644 index 0000000000..e89a4ab8f6 --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svpow.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVPOW_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVPOW_H +#if defined(__ARM_FEATURE_SVE) +#include "src/core/NEON/SVEMath.h" +namespace arm_compute +{ +namespace wrapper +{ +#define SVPOW_Z_IMPL(type, postfix) \ + inline type svpow_z(svbool_t pg, const type &a, const type &b) \ + { \ + return svpow_##postfix##_z(pg, a, b); \ + } + +SVPOW_Z_IMPL(svfloat32_t, f32) +SVPOW_Z_IMPL(svfloat16_t, f16) + +#undef SVPOW_Z_IMPL + +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVPOW_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svptrue.h b/src/core/NEON/wrapper/intrinsics/svptrue.h new file mode 100644 index 0000000000..53407e5301 --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svptrue.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVPTRUE_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVPTRUE_H +#if defined(__ARM_FEATURE_SVE) +#include <arm_sve.h> +namespace arm_compute +{ +namespace wrapper +{ +template <size_t element_size> +inline svbool_t svptrue_size(); + +template <> +inline svbool_t svptrue_size<64>() +{ + return svptrue_b64(); +} + +template <> +inline svbool_t svptrue_size<32>() +{ + return svptrue_b32(); +} + +template <> +inline svbool_t svptrue_size<16>() +{ + return svptrue_b16(); +} + +template <> +inline svbool_t svptrue_size<8>() +{ + return svptrue_b8(); +} + +template <typename T> +svbool_t svptrue() +{ + return svptrue_size<sizeof(T) * 8>(); +} +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVPTRUE_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svreinterpret.h b/src/core/NEON/wrapper/intrinsics/svreinterpret.h new file mode 100644 index 0000000000..e98742676d --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svreinterpret.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVREINTERPRET_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVREINTERPRET_H +#if defined(__ARM_FEATURE_SVE) +#include <arm_sve.h> +namespace arm_compute +{ +namespace wrapper +{ +#define SVREINTERPRET_TO_F32_IMPL(vtype) \ + template <typename T> \ + inline typename std::enable_if<std::is_same<T, float>::value, svfloat32_t>::type svreinterpret(const vtype &a) \ + { \ + return svreinterpret_f32(a); \ + } + +SVREINTERPRET_TO_F32_IMPL(svuint32_t) +#undef SVREINTERPRET_TO_F32_IMPL + +#define SVREINTERPRET_TO_U32_IMPL(vtype) \ + template <typename T> \ + inline typename std::enable_if<std::is_same<T, uint32_t>::value, svuint32_t>::type svreinterpret(const vtype &a) \ + { \ + return svreinterpret_u32(a); \ + } + +SVREINTERPRET_TO_U32_IMPL(svint32_t) +SVREINTERPRET_TO_U32_IMPL(svfloat32_t) +#undef SVREINTERPRET_TO_U32_IMPL + +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVREINTERPRET_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svsin.h b/src/core/NEON/wrapper/intrinsics/svsin.h new file mode 100644 index 0000000000..05d88d0250 --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svsin.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVSIN_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVSIN_H +#if defined(__ARM_FEATURE_SVE) +#include "src/core/NEON/SVEMath.h" +namespace arm_compute +{ +namespace wrapper +{ +#define SVSIN_Z_IMPL(type, postfix) \ + inline type svsin_z(svbool_t pg, const type &val) \ + { \ + return svsin_##postfix##_z(pg, val); \ + } + +SVSIN_Z_IMPL(svfloat32_t, f32) +SVSIN_Z_IMPL(svfloat16_t, f16) + +#undef SVSIN_Z_IMPL + +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVSIN_H */
\ No newline at end of file diff --git a/src/core/NEON/wrapper/intrinsics/svwhilelt.h b/src/core/NEON/wrapper/intrinsics/svwhilelt.h new file mode 100644 index 0000000000..ef58217dc4 --- /dev/null +++ b/src/core/NEON/wrapper/intrinsics/svwhilelt.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef SRC_CORE_NEON_WRAPPER_INTRINSICS_SVWHILELT_H +#define SRC_CORE_NEON_WRAPPER_INTRINSICS_SVWHILELT_H +#if defined(__ARM_FEATURE_SVE) +#include <arm_sve.h> +namespace arm_compute +{ +namespace wrapper +{ +#define SVWHILELT_IMPL(type) \ + template <size_t element_size> \ + inline svbool_t svwhilelt_size(type a, type b); \ + \ + template <> \ + inline svbool_t svwhilelt_size<64>(type a, type b) \ + { \ + return svwhilelt_b64(a, b); \ + } \ + template <> \ + inline svbool_t svwhilelt_size<32>(type a, type b) \ + { \ + return svwhilelt_b32(a, b); \ + } \ + template <> \ + inline svbool_t svwhilelt_size<16>(type a, type b) \ + { \ + return svwhilelt_b16(a, b); \ + } \ + template <> \ + inline svbool_t svwhilelt_size<8>(type a, type b) \ + { \ + return svwhilelt_b8(a, b); \ + } + +SVWHILELT_IMPL(int32_t) +SVWHILELT_IMPL(uint32_t) +SVWHILELT_IMPL(int64_t) +SVWHILELT_IMPL(uint64_t) + +#undef SVWHILELT_IMPL + +template <typename ScalarType, typename IndexType> +inline svbool_t svwhilelt(IndexType a, IndexType b) +{ + return svwhilelt_size<sizeof(ScalarType) * 8>(a, b); +} +} // namespace wrapper +} // namespace arm_compute + +#endif /* defined(__ARM_FEATURE_SVE) */ +#endif /* SRC_CORE_NEON_WRAPPER_INTRINSICS_SVWHILELT_H */
\ No newline at end of file |