From 0870db478fc46213138bcfd6e1536610ea145ecf Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Tue, 8 Dec 2020 18:42:19 +0000 Subject: 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 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4718 Tested-by: Arm Jenkins Reviewed-by: Michalis Spyrou Comments-Addressed: Arm Jenkins --- src/core/NEON/wrapper/intrinsics/intrinsics.h | 11 ++++ src/core/NEON/wrapper/intrinsics/svcnt.h | 68 ++++++++++++++++++++++ src/core/NEON/wrapper/intrinsics/svcvt.h | 74 ++++++++++++++++++++++++ src/core/NEON/wrapper/intrinsics/svdup_n.h | 57 ++++++++++++++++++ src/core/NEON/wrapper/intrinsics/svexp.h | 49 ++++++++++++++++ src/core/NEON/wrapper/intrinsics/svlog.h | 47 +++++++++++++++ src/core/NEON/wrapper/intrinsics/svpow.h | 47 +++++++++++++++ src/core/NEON/wrapper/intrinsics/svptrue.h | 68 ++++++++++++++++++++++ src/core/NEON/wrapper/intrinsics/svreinterpret.h | 57 ++++++++++++++++++ src/core/NEON/wrapper/intrinsics/svsin.h | 47 +++++++++++++++ src/core/NEON/wrapper/intrinsics/svwhilelt.h | 73 +++++++++++++++++++++++ 11 files changed, 598 insertions(+) create mode 100644 src/core/NEON/wrapper/intrinsics/svcnt.h create mode 100644 src/core/NEON/wrapper/intrinsics/svcvt.h create mode 100644 src/core/NEON/wrapper/intrinsics/svdup_n.h create mode 100644 src/core/NEON/wrapper/intrinsics/svexp.h create mode 100644 src/core/NEON/wrapper/intrinsics/svlog.h create mode 100644 src/core/NEON/wrapper/intrinsics/svpow.h create mode 100644 src/core/NEON/wrapper/intrinsics/svptrue.h create mode 100644 src/core/NEON/wrapper/intrinsics/svreinterpret.h create mode 100644 src/core/NEON/wrapper/intrinsics/svsin.h create mode 100644 src/core/NEON/wrapper/intrinsics/svwhilelt.h (limited to 'src/core/NEON/wrapper') 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 +namespace arm_compute +{ +namespace wrapper +{ +template +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 +inline uint64_t svcnt() +{ + return svcnt_size(); +} +} // 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 +namespace arm_compute +{ +namespace wrapper +{ +#define SVCVT_Z_TO_F32_IMPL(vtype) \ + template \ + inline typename std::enable_if::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 \ + inline typename std::enable_if::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 \ + inline typename std::enable_if::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 +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 + +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 + +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 +namespace arm_compute +{ +namespace wrapper +{ +template +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 +svbool_t svptrue() +{ + return svptrue_size(); +} +} // 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 +namespace arm_compute +{ +namespace wrapper +{ +#define SVREINTERPRET_TO_F32_IMPL(vtype) \ + template \ + inline typename std::enable_if::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 \ + inline typename std::enable_if::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 +namespace arm_compute +{ +namespace wrapper +{ +#define SVWHILELT_IMPL(type) \ + template \ + 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 +inline svbool_t svwhilelt(IndexType a, IndexType b) +{ + return svwhilelt_size(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 -- cgit v1.2.1