From 421405b6a21b124288a750e2da26dc01eb7391cb Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 26 Oct 2018 19:05:32 +0100 Subject: COMPMID-1675: Add SVE support Change-Id: I86679adff556b6ffc9929b35cbf1b59b3958bdb1 --- src/core/NEON/kernels/arm_gemm/gemm_fp16.cpp | 18 +- src/core/NEON/kernels/arm_gemm/gemm_fp32.cpp | 14 +- src/core/NEON/kernels/arm_gemm/gemm_int16.cpp | 2 +- src/core/NEON/kernels/arm_gemm/gemm_int8.cpp | 14 + src/core/NEON/kernels/arm_gemm/gemm_uint8.cpp | 12 + .../kernels/sve_interleaved_fp16_mla_3VLx8.hpp | 72 + .../sve_interleaved_fp16_mla_3VLx8/generic.cpp | 324 ++++ .../kernels/sve_interleaved_fp32_mla_3VLx8.hpp | 72 + .../sve_interleaved_fp32_mla_3VLx8/generic.cpp | 333 +++++ .../kernels/sve_interleaved_s8s32_dot_3VLx8.hpp | 72 + .../sve_interleaved_s8s32_dot_3VLx8/generic.cpp | 334 +++++ .../kernels/sve_interleaved_u8u32_dot_3VLx8.hpp | 72 + .../sve_interleaved_u8u32_dot_3VLx8/generic.cpp | 328 ++++ .../kernels/arm_gemm/kernels/sve_sgemm_3VLx8.hpp | 75 + .../arm_gemm/kernels/sve_sgemm_3VLx8/generic.cpp | 366 +++++ src/core/NEON/kernels/arm_gemm/merges/list.hpp | 2 + .../arm_gemm/merges/sve_merge_fp32_2VLx8.hpp | 1208 +++++++++++++++ .../arm_gemm/merges/sve_merge_fp32_3VLx8.hpp | 1564 ++++++++++++++++++++ .../NEON/kernels/arm_gemm/std_transforms_sve.hpp | 71 + src/core/NEON/kernels/arm_gemm/transform.hpp | 2 +- src/core/NEON/kernels/arm_gemm/transforms/list.hpp | 10 +- .../transforms/sve_interleave_8way_32bit.hpp | 596 ++++++++ .../sve_interleave_8way_block2_16bit.hpp | 632 ++++++++ .../sve_interleave_8way_block2_32bit.hpp | 632 ++++++++ .../sve_interleave_8way_block4_16bit.hpp | 632 ++++++++ .../transforms/sve_interleave_8way_block4_8bit.hpp | 596 ++++++++ src/core/NEON/kernels/arm_gemm/utils.hpp | 24 +- 27 files changed, 8058 insertions(+), 19 deletions(-) create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp16_mla_3VLx8.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp16_mla_3VLx8/generic.cpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp32_mla_3VLx8.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp32_mla_3VLx8/generic.cpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_s8s32_dot_3VLx8.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_s8s32_dot_3VLx8/generic.cpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_u8u32_dot_3VLx8.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_u8u32_dot_3VLx8/generic.cpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_sgemm_3VLx8.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/kernels/sve_sgemm_3VLx8/generic.cpp create mode 100644 src/core/NEON/kernels/arm_gemm/merges/sve_merge_fp32_2VLx8.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/merges/sve_merge_fp32_3VLx8.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/std_transforms_sve.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_32bit.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block2_16bit.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block2_32bit.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block4_16bit.hpp create mode 100644 src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block4_8bit.hpp (limited to 'src/core/NEON/kernels/arm_gemm') diff --git a/src/core/NEON/kernels/arm_gemm/gemm_fp16.cpp b/src/core/NEON/kernels/arm_gemm/gemm_fp16.cpp index 4579ebd307..9194bdd4d4 100644 --- a/src/core/NEON/kernels/arm_gemm/gemm_fp16.cpp +++ b/src/core/NEON/kernels/arm_gemm/gemm_fp16.cpp @@ -34,10 +34,22 @@ #include "kernels/a64_hgemm_24x8.hpp" #include "kernels/a64_sgemm_12x8.hpp" #include "kernels/a32_sgemm_8x6.hpp" +#include "kernels/sve_interleaved_fp16_mla_3VLx8.hpp" namespace arm_gemm { -#ifdef __aarch64__ +#ifdef __ARM_FEATURE_SVE +class GemmImpl_gemm_fp16_interleaved_fp16 : public GemmImplementation<__fp16, __fp16> { +public: + + UniqueGemmCommon<__fp16, __fp16> instantiate(const GemmArgs<__fp16> &args) override { + return UniqueGemmCommon<__fp16, __fp16>(new GemmInterleaved(args)); + } + + GemmImpl_gemm_fp16_interleaved_fp16() : GemmImplementation<__fp16, __fp16>(GemmMethod::GEMM_INTERLEAVED_FP16) { } +}; + +#elif defined(__aarch64__) #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) || defined(FP16_KERNELS) class GemmImpl_gemm_fp16_interleaved_fp16 : public GemmImplementation<__fp16, __fp16> { @@ -73,13 +85,13 @@ public: GemmImpl_gemm_fp16_interleaved() : GemmImplementation<__fp16, __fp16>(GemmMethod::GEMM_INTERLEAVED) { } }; -#if defined(__aarch64__) && (defined(__ARM_FEATURE_VECTOR_ARITHMETIC) || defined(FP16_KERNELS)) +#if defined(__aarch64__) && (defined(__ARM_FEATURE_VECTOR_ARITHMETIC) || defined(FP16_KERNELS) || defined(__ARM_FEATURE_SVE)) static GemmImpl_gemm_fp16_interleaved_fp16 gemm_fp16_interleaved_fp16_impl{}; #endif static GemmImpl_gemm_fp16_interleaved gemm_fp16_interleaved_impl{}; static std::vector *> gemm_fp16_methods = { -#if defined(__aarch64__) && (defined(__ARM_FEATURE_VECTOR_ARITHMETIC) || defined(FP16_KERNELS)) +#if defined(__aarch64__) && (defined(__ARM_FEATURE_VECTOR_ARITHMETIC) || defined(FP16_KERNELS) || defined(__ARM_FEATURE_SVE)) &gemm_fp16_interleaved_fp16_impl, #endif &gemm_fp16_interleaved_impl diff --git a/src/core/NEON/kernels/arm_gemm/gemm_fp32.cpp b/src/core/NEON/kernels/arm_gemm/gemm_fp32.cpp index e840e90eec..7d14971b70 100644 --- a/src/core/NEON/kernels/arm_gemm/gemm_fp32.cpp +++ b/src/core/NEON/kernels/arm_gemm/gemm_fp32.cpp @@ -36,10 +36,12 @@ #include "kernels/a64_sgemv_pretransposed.hpp" #include "kernels/a64_sgemm_native_16x4.hpp" +#include "kernels/sve_interleaved_fp32_mla_3VLx8.hpp" + namespace arm_gemm { -#ifdef __aarch64__ -// SGEMM implementations for AArch64 +#if defined(__aarch64__) && !defined(__ARM_FEATURE_SVE) +// SGEMM implementations for AArch64 without SVE // Pretransposed GEMV class GemmImpl_sgemm_gemv_pretransposed : public GemmImplementation { @@ -92,7 +94,9 @@ public: class GemmImpl_sgemm_gemm_interleaved : public GemmImplementation { public: UniqueGemmCommon instantiate(const GemmArgs &args) override { -#ifdef __aarch64__ +#ifdef __ARM_FEATURE_SVE + return UniqueGemmCommon (new GemmInterleaved(args)); +#elif defined(__aarch64__) return UniqueGemmCommon (new GemmInterleaved(args)); #elif defined(__arm__) return UniqueGemmCommon (new GemmInterleaved(args)); @@ -105,7 +109,7 @@ public: }; static GemmImpl_gemv_batched gemv_batched_impl{}; -#ifdef __aarch64__ +#if defined(__aarch64__) && !defined(__ARM_FEATURE_SVE) static GemmImpl_sgemm_gemv_pretransposed sgemm_gemv_pretransposed_impl{}; static GemmImpl_sgemm_gemv_native_transposed sgemm_gemv_native_transposed_impl{}; static GemmImpl_sgemm_gemm_native sgemm_gemm_native_impl{}; @@ -115,7 +119,7 @@ static GemmImpl_sgemm_gemm_interleaved sgemm_gemm_interleaved_impl{}; /* List of implementations (order matters) */ static std::vector *> SGemmMethods = { &gemv_batched_impl, -#ifdef __aarch64__ +#if defined(__aarch64__) && !defined(__ARM_FEATURE_SVE) &sgemm_gemv_pretransposed_impl, &sgemm_gemv_native_transposed_impl, &sgemm_gemm_native_impl, diff --git a/src/core/NEON/kernels/arm_gemm/gemm_int16.cpp b/src/core/NEON/kernels/arm_gemm/gemm_int16.cpp index b7e8fa21af..ad171a7f9a 100644 --- a/src/core/NEON/kernels/arm_gemm/gemm_int16.cpp +++ b/src/core/NEON/kernels/arm_gemm/gemm_int16.cpp @@ -59,4 +59,4 @@ template bool method_is_compatible(GemmMethod method, GemmArgs } // namespace arm_gemm -#endif // __aarch64__ +#endif // __aarch64__ \ No newline at end of file diff --git a/src/core/NEON/kernels/arm_gemm/gemm_int8.cpp b/src/core/NEON/kernels/arm_gemm/gemm_int8.cpp index dffa056adc..627d8abdb9 100644 --- a/src/core/NEON/kernels/arm_gemm/gemm_int8.cpp +++ b/src/core/NEON/kernels/arm_gemm/gemm_int8.cpp @@ -31,9 +31,21 @@ #include "kernels/a64_gemm_s16_12x8.hpp" #include "kernels/a64_gemm_s8_12x8.hpp" #include "kernels/a64_gemm_s8_4x4.hpp" +#include "kernels/sve_interleaved_s8s32_dot_3VLx8.hpp" namespace arm_gemm { +#ifdef __ARM_FEATURE_SVE +class GemmImpl_gemm_s8_interleaved_dot : public GemmImplementation { +public: + UniqueGemmCommon instantiate(const GemmArgs &args) override { + return UniqueGemmCommon(new GemmInterleaved(args)); + } + + GemmImpl_gemm_s8_interleaved_dot() : GemmImplementation(GemmMethod::GEMM_INTERLEAVED_DOT) { } +}; +#else + class GemmImpl_gemm_s8_interleaved_dot : public GemmImplementation { public: bool is_supported(const GemmArgs &args) override { @@ -47,6 +59,8 @@ public: GemmImpl_gemm_s8_interleaved_dot() : GemmImplementation(GemmMethod::GEMM_INTERLEAVED_DOT) { } }; +#endif + class GemmImpl_gemm_s8_interleaved : public GemmImplementation { public: UniqueGemmCommon instantiate(const GemmArgs &args) override { diff --git a/src/core/NEON/kernels/arm_gemm/gemm_uint8.cpp b/src/core/NEON/kernels/arm_gemm/gemm_uint8.cpp index 60b7954db3..b7c1bab6bd 100644 --- a/src/core/NEON/kernels/arm_gemm/gemm_uint8.cpp +++ b/src/core/NEON/kernels/arm_gemm/gemm_uint8.cpp @@ -31,9 +31,20 @@ #include "kernels/a64_gemm_u16_12x8.hpp" #include "kernels/a64_gemm_u8_12x8.hpp" #include "kernels/a64_gemm_u8_4x4.hpp" +#include "kernels/sve_interleaved_u8u32_dot_3VLx8.hpp" namespace arm_gemm { +#ifdef __ARM_FEATURE_SVE +class GemmImpl_gemm_u8_interleaved_dot : public GemmImplementation { +public: + UniqueGemmCommon instantiate(const GemmArgs &args) override { + return UniqueGemmCommon(new GemmInterleaved(args)); + } + + GemmImpl_gemm_u8_interleaved_dot() : GemmImplementation(GemmMethod::GEMM_INTERLEAVED_DOT) { } +}; +#else class GemmImpl_gemm_u8_interleaved_dot : public GemmImplementation { public: bool is_supported(const GemmArgs &args) override { @@ -46,6 +57,7 @@ public: GemmImpl_gemm_u8_interleaved_dot() : GemmImplementation(GemmMethod::GEMM_INTERLEAVED_DOT) { } }; +#endif class GemmImpl_gemm_u8_interleaved : public GemmImplementation { public: diff --git a/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp16_mla_3VLx8.hpp b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp16_mla_3VLx8.hpp new file mode 100644 index 0000000000..3fd738e673 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp16_mla_3VLx8.hpp @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2018 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. + */ +#pragma once + +#ifdef __ARM_FEATURE_SVE + + +#include "../std_transforms_sve.hpp" + +namespace arm_gemm { + +// Actual kernel implementations +void sve_interleaved_fp16_mla_3VLx8(const __fp16 *, const __fp16 *, __fp16 *, int, int, int); + +class interleaved_fp16_mla_3VLx8 { +public: + typedef __fp16 operand_type; + typedef __fp16 result_type; + + typedef void (*kern_type)(const __fp16 *, const __fp16 *, __fp16 *, int, int, int); + + /* Kernel blocking parameters */ + static int out_width() + { + return svcnth() * 3; + } + + static int out_height() + { + return 8; + } + + static int k_unroll() + { + return 1; + } + + // Use the standard fixed size transforms. + StdTransformsSVE transforms = {}; + + kern_type kernel=sve_interleaved_fp16_mla_3VLx8; + + interleaved_fp16_mla_3VLx8(const CPUInfo *ci) + { + + } +}; + +} // namespace arm_gemm + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp16_mla_3VLx8/generic.cpp b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp16_mla_3VLx8/generic.cpp new file mode 100644 index 0000000000..92ec888244 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp16_mla_3VLx8/generic.cpp @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2018 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. + */ +#ifdef __ARM_FEATURE_SVE + + +#include "../../asmlib.hpp" + +namespace arm_gemm { + +void sve_interleaved_fp16_mla_3VLx8(const __fp16 *Apanel, const __fp16 *Bpanel, __fp16 *Cpanel, int ablocks, int bblocks, int K) { + const __fp16 *a_ptr = Apanel; + __fp16 *c_ptr = Cpanel; + + const long loops_count = (K / 2) - 1; + const long tails_count = K % 2; + + for (int yb=0; yb transforms = {}; + + kern_type kernel=sve_interleaved_fp32_mla_3VLx8; + + interleaved_fp32_mla_3VLx8(const CPUInfo *ci) + { + + } +}; + +} // namespace arm_gemm + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp32_mla_3VLx8/generic.cpp b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp32_mla_3VLx8/generic.cpp new file mode 100644 index 0000000000..bb08fc7cb0 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_fp32_mla_3VLx8/generic.cpp @@ -0,0 +1,333 @@ +/* + * Copyright (c) 2018 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. + */ +#ifdef __ARM_FEATURE_SVE + + +#include "../../asmlib.hpp" + +namespace arm_gemm { + +void sve_interleaved_fp32_mla_3VLx8(const float *Apanel, const float *Bpanel, float *Cpanel, int ablocks, int bblocks, int K) { + const float *a_ptr = Apanel; + float *c_ptr = Cpanel; + + const long loops_count = (K / 2) - 1; + const long tails_count = K % 2; + + for (int yb=0; yb +#include "../std_transforms_sve.hpp" + +namespace arm_gemm { + +// Actual kernel implementations +void sve_interleaved_s8s32_dot_3VLx8(const int8_t *, const int8_t *, int32_t *, int, int, int); + +class interleaved_s8s32_dot_3VLx8 { +public: + typedef int8_t operand_type; + typedef int32_t result_type; + + typedef void (*kern_type)(const int8_t *, const int8_t *, int32_t *, int, int, int); + + /* Kernel blocking parameters */ + static int out_width() + { + return svcntw() * 3; + } + + static int out_height() + { + return 8; + } + + static int k_unroll() + { + return 4; + } + + // Use the standard fixed size transforms. + StdTransformsSVE transforms = {}; + + kern_type kernel=sve_interleaved_s8s32_dot_3VLx8; + + interleaved_s8s32_dot_3VLx8(const CPUInfo *ci) + { + + } +}; + +} // namespace arm_gemm + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_s8s32_dot_3VLx8/generic.cpp b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_s8s32_dot_3VLx8/generic.cpp new file mode 100644 index 0000000000..2e994a13f3 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_s8s32_dot_3VLx8/generic.cpp @@ -0,0 +1,334 @@ +/* + * Copyright (c) 2018 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. + */ +#ifdef __ARM_FEATURE_SVE + +#include +#include "../../asmlib.hpp" + +namespace arm_gemm { + +void sve_interleaved_s8s32_dot_3VLx8(const int8_t *Apanel, const int8_t *Bpanel, int32_t *Cpanel, int ablocks, int bblocks, int K) { + const int8_t *a_ptr = Apanel; + int32_t *c_ptr = Cpanel; + + K /= 4; + const long loops_count = (K / 2) - 1; + const long tails_count = K % 2; + + for (int yb=0; yb +#include "../std_transforms_sve.hpp" + +namespace arm_gemm { + +// Actual kernel implementations +void sve_interleaved_u8u32_dot_3VLx8(const uint8_t *, const uint8_t *, uint32_t *, int, int, int); + +class interleaved_u8u32_dot_3VLx8 { +public: + typedef uint8_t operand_type; + typedef uint32_t result_type; + + typedef void (*kern_type)(const uint8_t *, const uint8_t *, uint32_t *, int, int, int); + + /* Kernel blocking parameters */ + static int out_width() + { + return svcntw() * 3; + } + + static int out_height() + { + return 8; + } + + static int k_unroll() + { + return 4; + } + + // Use the standard fixed size transforms. + StdTransformsSVE transforms = {}; + + kern_type kernel=sve_interleaved_u8u32_dot_3VLx8; + + interleaved_u8u32_dot_3VLx8(const CPUInfo *ci) + { + + } +}; + +} // namespace arm_gemm + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_u8u32_dot_3VLx8/generic.cpp b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_u8u32_dot_3VLx8/generic.cpp new file mode 100644 index 0000000000..f4d33a9efa --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/kernels/sve_interleaved_u8u32_dot_3VLx8/generic.cpp @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2018 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. + */ +#ifdef __ARM_FEATURE_SVE + +#include +#include "../../asmlib.hpp" + +namespace arm_gemm { + +void sve_interleaved_u8u32_dot_3VLx8(const uint8_t *Apanel, const uint8_t *Bpanel, uint32_t *Cpanel, int ablocks, int bblocks, int K) { + const uint8_t *a_ptr = Apanel; + uint32_t *c_ptr = Cpanel; + + K /= 4; + const long loops_count = (K / 2) - 1; + const long tails_count = K % 2; + + for (int yb=0; yb transforms; + + kern_type kernel=sve_sgemm_3VLx8; + + sgemm_3VLx8(const CPUInfo *ci) { } +}; + +} // namespace arm_gemm + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/kernels/sve_sgemm_3VLx8/generic.cpp b/src/core/NEON/kernels/arm_gemm/kernels/sve_sgemm_3VLx8/generic.cpp new file mode 100644 index 0000000000..fd6f0b7f98 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/kernels/sve_sgemm_3VLx8/generic.cpp @@ -0,0 +1,366 @@ +/* + * Copyright (c) 2017-2018 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. + */ +#ifdef __ARM_FEATURE_SVE + +#include +#include + +#include "../../asmlib.hpp" + +// Kernel implementation. +// +// Assume that "Apanel" points to a chunk of A blocks (each size 8xK) in read-order. +// Assume that "Bpanel" points to a chunk of B blocks (each size 3VLxK) in read-order. +// Assume that "Cpanel" points to a chunk of C output blocks (each size +// 3VLx8), the chunks being arranged in a row major fashion. +// +// Note that the intent of this is that either ablocks or bblocks will be 1 +// - this construction allows the output loop to proceed in either order. + +namespace arm_gemm { + +void sve_sgemm_3VLx8(const float *Apanel, const float *Bpanel, float *Cpanel, int ablocks, int bblocks, int K) { + const float *a_ptr = Apanel; + float *c_ptr = Cpanel; + + // There's no predication inside the kernel, so get a true predicate to use everywhere. + svbool_t ptrue = svptrue_b32(); + + for (int yb=0; yb +inline void MergeResults<2, 8, true>(float *out, const float *in, const int ldout, const int y0, const int ymax, const int x0, const int xmax, const float alpha, const float beta) +{ + const float *inptr = in; + + for (int y=y0; y())) { + if (beta==0.0f) + { + switch(height) { + case 1: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z5.s, p0/z, [%[inptr], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x40]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr0], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 2: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z6.s, p0/z, [%[inptr], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x40]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #3, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x40]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 3: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z7.s, p0/z, [%[inptr], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x40]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [%[inptr], #3, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x40]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr2], #1, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "prfm PSTL1KEEP, [%[outptr2], #0x40]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 4: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x40]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [%[inptr], #5, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x40]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #7, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x40]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "prfm PSTL1KEEP, [%[outptr3], #0x40]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 5: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z5.s, p0/z, [%[inptr], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x40]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [%[inptr], #3, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #5, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x40]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [%[inptr], #7, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #-7, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x40]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr4], #1, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "prfm PSTL1KEEP, [%[outptr3], #0x40]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "prfm PSTL1KEEP, [%[outptr4], #0x40]\n" + "addvl %[outptr4], %[outptr4], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 6: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z5.s, p0/z, [x8, #-6, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z6.s, p0/z, [%[inptr], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x40]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #3, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [%[inptr], #5, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x40]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #7, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-7, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x40]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-5, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr5], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr3], #0x40]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "prfm PSTL1KEEP, [%[outptr4], #0x40]\n" + "addvl %[outptr4], %[outptr4], #2\n" + "prfm PSTL1KEEP, [%[outptr5], #0x40]\n" + "addvl %[outptr5], %[outptr5], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 7: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z5.s, p0/z, [x8, #-6, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "ld1w z6.s, p0/z, [x8, #-4, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z7.s, p0/z, [%[inptr], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x40]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [%[inptr], #3, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x40]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [%[inptr], #7, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x40]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-5, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr5], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #-3, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr3], #0x40]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr6], #1, MUL VL]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "prfm PSTL1KEEP, [%[outptr4], #0x40]\n" + "addvl %[outptr4], %[outptr4], #2\n" + "prfm PSTL1KEEP, [%[outptr5], #0x40]\n" + "addvl %[outptr5], %[outptr5], #2\n" + "prfm PSTL1KEEP, [%[outptr6], #0x40]\n" + "addvl %[outptr6], %[outptr6], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + default: + case 8: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z5.s, p0/z, [x8, #-6, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "ld1w z6.s, p0/z, [x8, #-4, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6]]\n" + "ld1w z7.s, p0/z, [x8, #-2, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x40]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [%[inptr], #5, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x40]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #7, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-7, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x40]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #-5, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-3, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr3], #0x40]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-1, MUL VL]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7], #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr4], #0x40]\n" + "addvl %[outptr4], %[outptr4], #2\n" + "prfm PSTL1KEEP, [%[outptr5], #0x40]\n" + "addvl %[outptr5], %[outptr5], #2\n" + "prfm PSTL1KEEP, [%[outptr6], #0x40]\n" + "addvl %[outptr6], %[outptr6], #2\n" + "prfm PSTL1KEEP, [%[outptr7], #0x40]\n" + "addvl %[outptr7], %[outptr7], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + + } + } + else + { + switch(height) { + case 1: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z9.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x40]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr0], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 2: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z10.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x40]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x40]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 3: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z11.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x40]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x40]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr2], #1, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "prfm PLDL1KEEP, [%[outptr2], #0x40]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 4: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x40]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x40]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x40]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "prfm PLDL1KEEP, [%[outptr3], #0x40]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 5: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z8.s, p0/z, [%[outptr4]]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z9.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x40]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x40]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr4], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x40]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr4], #1, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "prfm PLDL1KEEP, [%[outptr3], #0x40]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "prfm PLDL1KEEP, [%[outptr4], #0x40]\n" + "addvl %[outptr4], %[outptr4], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 6: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z8.s, p0/z, [%[outptr4]]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z9.s, p0/z, [%[outptr5]]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-6, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z10.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x40]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x40]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr4], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x40]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr5], #1, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr5], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr3], #0x40]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "prfm PLDL1KEEP, [%[outptr4], #0x40]\n" + "addvl %[outptr4], %[outptr4], #2\n" + "prfm PLDL1KEEP, [%[outptr5], #0x40]\n" + "addvl %[outptr5], %[outptr5], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 7: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z8.s, p0/z, [%[outptr4]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z9.s, p0/z, [%[outptr5]]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-6, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "ld1w z10.s, p0/z, [%[outptr6]]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z11.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x40]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x40]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr4], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x40]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr5], #1, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-5, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr5], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr6], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr3], #0x40]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr6], #1, MUL VL]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "prfm PLDL1KEEP, [%[outptr4], #0x40]\n" + "addvl %[outptr4], %[outptr4], #2\n" + "prfm PLDL1KEEP, [%[outptr5], #0x40]\n" + "addvl %[outptr5], %[outptr5], #2\n" + "prfm PLDL1KEEP, [%[outptr6], #0x40]\n" + "addvl %[outptr6], %[outptr6], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + default: + case 8: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x100]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x140]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z8.s, p0/z, [%[outptr4]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z9.s, p0/z, [%[outptr5]]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-6, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "ld1w z10.s, p0/z, [%[outptr6]]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6]]\n" + "ld1w z11.s, p0/z, [%[outptr7]]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-2, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x40]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #2\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x40]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #2\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr4], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x40]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr5], #1, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #2\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr6], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr3], #0x40]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-3, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr7], #1, MUL VL]\n" + "addvl %[outptr3], %[outptr3], #2\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-1, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr4], #0x40]\n" + "addvl %[outptr4], %[outptr4], #2\n" + "prfm PLDL1KEEP, [%[outptr5], #0x40]\n" + "addvl %[outptr5], %[outptr5], #2\n" + "prfm PLDL1KEEP, [%[outptr6], #0x40]\n" + "addvl %[outptr6], %[outptr6], #2\n" + "prfm PLDL1KEEP, [%[outptr7], #0x40]\n" + "addvl %[outptr7], %[outptr7], #2\n" + "1:\n" + "addvl %[inptr], %[inptr], #16\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + + } + } + } + } +} + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/merges/sve_merge_fp32_3VLx8.hpp b/src/core/NEON/kernels/arm_gemm/merges/sve_merge_fp32_3VLx8.hpp new file mode 100644 index 0000000000..27084c3598 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/merges/sve_merge_fp32_3VLx8.hpp @@ -0,0 +1,1564 @@ +/* + * Copyright (c) 2018 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. + */ +#pragma once + +#ifdef __ARM_FEATURE_SVE + +template<> +inline void MergeResults<3, 8, true>(float *out, const float *in, const int ldout, const int y0, const int ymax, const int x0, const int xmax, const float alpha, const float beta) +{ + const float *inptr = in; + + for (int y=y0; y())) { + if (beta==0.0f) + { + switch(height) { + case 1: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z5.s, p0/z, [%[inptr], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr0], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z6.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x60]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 2: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z6.s, p0/z, [%[inptr], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x60]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x60]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 3: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z7.s, p0/z, [%[inptr], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr2], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z6.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x60]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #5, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x60]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #2, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x60]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 4: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-6, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x60]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-8, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x60]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-5, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x60]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "prfm PSTL1KEEP, [%[outptr3], #0x60]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 5: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x240]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z4.s, p0/z, [x8, #-4, MUL VL]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z5.s, p0/z, [%[inptr], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-6, MUL VL]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #-3, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr4], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z6.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x60]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #5, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x60]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #-5, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr3], #2, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr4], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x60]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "prfm PSTL1KEEP, [%[outptr3], #0x60]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "prfm PSTL1KEEP, [%[outptr4], #0x60]\n" + "addvl %[outptr4], %[outptr4], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 6: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x240]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z4.s, p0/z, [x8, #-4, MUL VL]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z5.s, p0/z, [x8, #-1, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z6.s, p0/z, [%[inptr], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [%[inptr], #7, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x280]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #-6, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-3, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [x8]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr5], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x60]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-8, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x60]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-5, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #2, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4], #2, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x60]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5], #2, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "prfm PSTL1KEEP, [%[outptr3], #0x60]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "prfm PSTL1KEEP, [%[outptr4], #0x60]\n" + "addvl %[outptr4], %[outptr4], #3\n" + "prfm PSTL1KEEP, [%[outptr5], #0x60]\n" + "addvl %[outptr5], %[outptr5], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 7: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x240]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z4.s, p0/z, [x8, #-4, MUL VL]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z5.s, p0/z, [x8, #-1, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "ld1w z6.s, p0/z, [x8, #2, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z7.s, p0/z, [%[inptr], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #7, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x280]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-6, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-3, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [x8]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr5], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #3, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr6], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z6.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x60]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z7.s, p0/z, [%[inptr], #5, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x60]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #-5, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr3], #2, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr4], #2, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x60]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr5], #2, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #4, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr6], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr3], #0x60]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "prfm PSTL1KEEP, [%[outptr4], #0x60]\n" + "addvl %[outptr4], %[outptr4], #3\n" + "prfm PSTL1KEEP, [%[outptr5], #0x60]\n" + "addvl %[outptr5], %[outptr5], #3\n" + "prfm PLDL1KEEP, [%[inptr], #0x2c0]\n" + "prfm PSTL1KEEP, [%[outptr6], #0x60]\n" + "addvl %[outptr6], %[outptr6], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + default: + case 8: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x240]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z4.s, p0/z, [x8, #-4, MUL VL]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z5.s, p0/z, [x8, #-1, MUL VL]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "ld1w z6.s, p0/z, [x8, #2, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6]]\n" + "ld1w z7.s, p0/z, [x8, #5, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #4, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [%[inptr], #7, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x280]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-6, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-3, MUL VL]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z5.s, p0/z, [x8]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5], #1, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #3, MUL VL]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6], #1, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #6, MUL VL]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z4.s, p0/z, [%[inptr], #2, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr0], #0x60]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #-8, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr1], #0x60]\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #-5, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #2, MUL VL]\n" + "ld1w z4.s, p0/z, [x8, #-2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "fmul z8.s, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4], #2, MUL VL]\n" + "ld1w z5.s, p0/z, [x8, #1, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr2], #0x60]\n" + "fmul z9.s, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5], #2, MUL VL]\n" + "ld1w z6.s, p0/z, [x8, #4, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "fmul z10.s, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6], #2, MUL VL]\n" + "ld1w z7.s, p0/z, [x8, #7, MUL VL]\n" + "prfm PSTL1KEEP, [%[outptr3], #0x60]\n" + "fmul z11.s, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7], #2, MUL VL]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "prfm PSTL1KEEP, [%[outptr4], #0x60]\n" + "addvl %[outptr4], %[outptr4], #3\n" + "prfm PSTL1KEEP, [%[outptr5], #0x60]\n" + "addvl %[outptr5], %[outptr5], #3\n" + "prfm PLDL1KEEP, [%[inptr], #0x2c0]\n" + "prfm PSTL1KEEP, [%[outptr6], #0x60]\n" + "addvl %[outptr6], %[outptr6], #3\n" + "prfm PSTL1KEEP, [%[outptr7], #0x60]\n" + "addvl %[outptr7], %[outptr7], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + + } + } + else + { + switch(height) { + case 1: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z9.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr0], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z10.s, p0/z, [%[outptr0], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x60]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 2: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z10.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x60]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr1], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x60]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 3: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z11.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr2], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z10.s, p0/z, [%[outptr0], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x60]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr1], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr2], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x60]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #2, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x60]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 4: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-6, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x60]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr1], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr2], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x60]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr3], #2, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x60]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "prfm PLDL1KEEP, [%[outptr3], #0x60]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 5: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x240]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z8.s, p0/z, [%[outptr4]]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-4, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z9.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-6, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr4], #1, MUL VL]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr4], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z10.s, p0/z, [%[outptr0], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x60]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr1], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr2], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x60]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr3], #2, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr3], #2, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr4], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-2, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr4], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x60]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "prfm PLDL1KEEP, [%[outptr3], #0x60]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "prfm PLDL1KEEP, [%[outptr4], #0x60]\n" + "addvl %[outptr4], %[outptr4], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 6: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x240]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z8.s, p0/z, [%[outptr4]]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-4, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z9.s, p0/z, [%[outptr5]]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z10.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x280]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-6, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr4], #1, MUL VL]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-3, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr5], #1, MUL VL]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr5], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x60]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr1], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr2], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x60]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr3], #2, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #2, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr4], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-2, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4], #2, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr5], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x60]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5], #2, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "prfm PLDL1KEEP, [%[outptr3], #0x60]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "prfm PLDL1KEEP, [%[outptr4], #0x60]\n" + "addvl %[outptr4], %[outptr4], #3\n" + "prfm PLDL1KEEP, [%[outptr5], #0x60]\n" + "addvl %[outptr5], %[outptr5], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + case 7: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x240]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z8.s, p0/z, [%[outptr4]]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-4, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z9.s, p0/z, [%[outptr5]]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "ld1w z10.s, p0/z, [%[outptr6]]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #2, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z11.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x280]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-6, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr4], #1, MUL VL]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-3, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr5], #1, MUL VL]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr5], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr6], #1, MUL VL]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr6], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z10.s, p0/z, [%[outptr0], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x60]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr1], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr2], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x60]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr3], #2, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr3], #2, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr4], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-2, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr4], #2, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr5], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x60]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #1, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr5], #2, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr6], #2, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #4, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr6], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr3], #0x60]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "prfm PLDL1KEEP, [%[outptr4], #0x60]\n" + "addvl %[outptr4], %[outptr4], #3\n" + "prfm PLDL1KEEP, [%[outptr5], #0x60]\n" + "addvl %[outptr5], %[outptr5], #3\n" + "prfm PLDL1KEEP, [%[inptr], #0x2c0]\n" + "prfm PLDL1KEEP, [%[outptr6], #0x60]\n" + "addvl %[outptr6], %[outptr6], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + default: + case 8: + { + long w = xmax - i; + long p = 0; + /* Optimized routine to copy an entire block */ + __asm __volatile ( + "mov z2.s, %s[alpha]\n" + "addvl x8, %[inptr], #16\n" + "mov z3.s, %s[beta]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0]]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr]]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0]]\n" + "ld1w z9.s, p0/z, [%[outptr1]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x180]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #3, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1]]\n" + "ld1w z10.s, p0/z, [%[outptr2]]\n" + "prfm PLDL1KEEP, [%[inptr], #0x240]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #6, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2]]\n" + "ld1w z11.s, p0/z, [%[outptr3]]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3]]\n" + "ld1w z8.s, p0/z, [%[outptr4]]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-4, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4]]\n" + "ld1w z9.s, p0/z, [%[outptr5]]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #-1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5]]\n" + "ld1w z10.s, p0/z, [%[outptr6]]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #2, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6]]\n" + "ld1w z11.s, p0/z, [%[outptr7]]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7]]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0], #1, MUL VL]\n" + "incw %[p], all, mul #1\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #1, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr1], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x1c0]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #4, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr2], #1, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x280]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [%[inptr], #7, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr3], #1, MUL VL]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-6, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #1, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr4], #1, MUL VL]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-3, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4], #1, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr5], #1, MUL VL]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5], #1, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr6], #1, MUL VL]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #3, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6], #1, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr7], #1, MUL VL]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #6, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7], #1, MUL VL]\n" + "whilelt p0.s, %[p], %[w]\n" + "b.none 1f\n" + "ld1w z8.s, p0/z, [%[outptr0], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr0], #0x60]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [%[inptr], #2, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr0], #2, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr1], #2, MUL VL]\n" + "addvl %[outptr0], %[outptr0], #3\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [%[inptr], #5, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr1], #2, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr2], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr1], #0x60]\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #-8, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr2], #2, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr3], #2, MUL VL]\n" + "addvl %[outptr1], %[outptr1], #3\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #-5, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr3], #2, MUL VL]\n" + "ld1w z8.s, p0/z, [%[outptr4], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[inptr], #0x200]\n" + "fmul z8.s, z8.s, z3.s\n" + "ld1w z4.s, p0/z, [x8, #-2, MUL VL]\n" + "fmla z8.s, p0/m, z4.s, z2.s\n" + "st1w z8.s, p0, [%[outptr4], #2, MUL VL]\n" + "ld1w z9.s, p0/z, [%[outptr5], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr2], #0x60]\n" + "fmul z9.s, z9.s, z3.s\n" + "ld1w z5.s, p0/z, [x8, #1, MUL VL]\n" + "fmla z9.s, p0/m, z5.s, z2.s\n" + "st1w z9.s, p0, [%[outptr5], #2, MUL VL]\n" + "ld1w z10.s, p0/z, [%[outptr6], #2, MUL VL]\n" + "addvl %[outptr2], %[outptr2], #3\n" + "fmul z10.s, z10.s, z3.s\n" + "ld1w z6.s, p0/z, [x8, #4, MUL VL]\n" + "fmla z10.s, p0/m, z6.s, z2.s\n" + "st1w z10.s, p0, [%[outptr6], #2, MUL VL]\n" + "ld1w z11.s, p0/z, [%[outptr7], #2, MUL VL]\n" + "prfm PLDL1KEEP, [%[outptr3], #0x60]\n" + "fmul z11.s, z11.s, z3.s\n" + "ld1w z7.s, p0/z, [x8, #7, MUL VL]\n" + "fmla z11.s, p0/m, z7.s, z2.s\n" + "st1w z11.s, p0, [%[outptr7], #2, MUL VL]\n" + "addvl %[outptr3], %[outptr3], #3\n" + "prfm PLDL1KEEP, [%[outptr4], #0x60]\n" + "addvl %[outptr4], %[outptr4], #3\n" + "prfm PLDL1KEEP, [%[outptr5], #0x60]\n" + "addvl %[outptr5], %[outptr5], #3\n" + "prfm PLDL1KEEP, [%[inptr], #0x2c0]\n" + "prfm PLDL1KEEP, [%[outptr6], #0x60]\n" + "addvl %[outptr6], %[outptr6], #3\n" + "prfm PLDL1KEEP, [%[outptr7], #0x60]\n" + "addvl %[outptr7], %[outptr7], #3\n" + "1:\n" + "addvl %[inptr], %[inptr], #24\n" + : [outptr0] "+r" (outptr0), [outptr1] "+r" (outptr1), [outptr2] "+r" (outptr2), [outptr3] "+r" (outptr3), [outptr4] "+r" (outptr4), [outptr5] "+r" (outptr5), [outptr6] "+r" (outptr6), [outptr7] "+r" (outptr7), + [inptr] "+r" (inptr), [p] "+r" (p) + : [alpha] "w" (alpha), [beta] "w" (beta), [w] "r" (w) + : "x8", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "memory", "cc" + ); + } + break; + + + } + } + } + } +} + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/std_transforms_sve.hpp b/src/core/NEON/kernels/arm_gemm/std_transforms_sve.hpp new file mode 100644 index 0000000000..b7323ebaea --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/std_transforms_sve.hpp @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2017-2018 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. + */ +#pragma once + +#include "mergeresults.hpp" +#include "transform.hpp" + +namespace arm_gemm { + +/* + * Define "standard" transforms for the blocked GEMMs for SVE. + * + * This assumes that A is interleaved 'height' ways, B is interleaved + * 'width'xVL ways and transposed, and that the merge needs to work in + * 'height' x 'width'xVL blocks. + * + * The optional 'block' parameter is for kernels using dot-product type + * instructions like UDOT and SDOT. + */ +template +class StdTransformsSVE +{ +public: + template + void PrepareA(TOperand *out, const TIn *in, const int stride, const int y0, + const int ymax, const int k0, const int kmax, bool transposed) { + if (transposed) { + Transform(out, in, stride, y0, ymax, k0, kmax); + } else { + Transform(out, in, stride, y0, ymax, k0, kmax); + } + } + + template + void PrepareB(TOperand *out, const TIn *in, const int stride, const int x0, + const int xmax, const int k0, const int kmax, bool transposed) { + if (transposed) { + Transform(out, in, stride, x0, xmax, k0, kmax); + } else { + Transform(out, in, stride, x0, xmax, k0, kmax); + } + } + + template + void Merge(TOut *out, const TResult *in, int stride, int y0, int ymax, int x0, int xmax, const TOut alpha, const TOut beta) { + MergeResults(out, in, stride, y0, ymax, x0, xmax, alpha, beta); + } +}; + +} // namespace arm_gemm diff --git a/src/core/NEON/kernels/arm_gemm/transform.hpp b/src/core/NEON/kernels/arm_gemm/transform.hpp index 77d0d87a4d..e422b91c83 100644 --- a/src/core/NEON/kernels/arm_gemm/transform.hpp +++ b/src/core/NEON/kernels/arm_gemm/transform.hpp @@ -40,7 +40,7 @@ struct TransformImpl { static void Transform(TOut* out, const TIn* const in, const int stride, const int y0, const int ymax, const int x0, const int xmax) { // For SVE cases we multiply the interleave factor by the vector length. - const unsigned int IntBy = tIntBy * (sve ? get_vector_length() : 1); + const unsigned int IntBy = tIntBy * (sve ? get_vector_length() / BlockBy : 1); const int n_whole_y_blocks = (ymax - y0) / IntBy; const int y_remainders = (ymax - y0) % IntBy; diff --git a/src/core/NEON/kernels/arm_gemm/transforms/list.hpp b/src/core/NEON/kernels/arm_gemm/transforms/list.hpp index 8ad5b857fb..17328a5d6a 100644 --- a/src/core/NEON/kernels/arm_gemm/transforms/list.hpp +++ b/src/core/NEON/kernels/arm_gemm/transforms/list.hpp @@ -23,9 +23,17 @@ */ #include "a32_interleave_6way_32bit.hpp" #include "a32_transpose_interleave_8way_32bit.hpp" +#ifdef __ARM_FEATURE_SVE +#include "sve_interleave_8way_32bit.hpp" +#include "sve_interleave_8way_block2_16bit.hpp" +#include "sve_interleave_8way_block2_32bit.hpp" +#include "sve_interleave_8way_block4_16bit.hpp" +#include "sve_interleave_8way_block4_8bit.hpp" +#else +#include "a64_interleave_8way_32bit.hpp" +#endif #include "a64_block16_interleave4_8bit.hpp" #include "a64_interleave_8way_16bit.hpp" -#include "a64_interleave_8way_32bit.hpp" #include "a64_interleave_8way_half_to_float.hpp" #include "a64_transpose_interleave_12way_16bit.hpp" #include "a64_transpose_interleave_12way_half_to_float.hpp" diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_32bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_32bit.hpp new file mode 100644 index 0000000000..752e837f8d --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_32bit.hpp @@ -0,0 +1,596 @@ +/* + * Copyright (c) 2018 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. + */ +#pragma once + +#ifdef __ARM_FEATURE_SVE + +template<> +template +inline void TransformImpl<8, 1, false, 4, 4, false>::Transform(T *out, const T *in, int ldin, int y0, int ymax, int k0, int kmax) +{ + uint32_t *master_outptr = reinterpret_cast(out); + const uint32_t *inptr = reinterpret_cast(in); + + for (int y=y0; y +template +inline void TransformImpl<8, 2, false, 2, 2, false>::Transform(T *out, const T *in, int ldin, int y0, int ymax, int k0, int kmax) +{ + uint16_t *master_outptr = reinterpret_cast(out); + const uint16_t *inptr = reinterpret_cast(in); + + for (int y=y0; y +template +inline void TransformImpl<8, 2, false, 4, 4, false>::Transform(T *out, const T *in, int ldin, int y0, int ymax, int k0, int kmax) +{ + uint32_t *master_outptr = reinterpret_cast(out); + const uint32_t *inptr = reinterpret_cast(in); + + for (int y=y0; y +template +inline void TransformImpl<8, 4, false, 2, 2, false>::Transform(T *out, const T *in, int ldin, int y0, int ymax, int k0, int kmax) +{ + uint16_t *master_outptr = reinterpret_cast(out); + const uint16_t *inptr = reinterpret_cast(in); + + for (int y=y0; y +template +inline void TransformImpl<8, 4, false, 1, 1, false>::Transform(T *out, const T *in, int ldin, int y0, int ymax, int k0, int kmax) +{ + uint8_t *master_outptr = reinterpret_cast(out); + const uint8_t *inptr = reinterpret_cast(in); + + for (int y=y0; y +#endif + // Macro for unreachable code (e.g. impossible default cases on switch) #define UNREACHABLE(why) __builtin_unreachable() @@ -31,23 +35,27 @@ // #define UNREACHABLE(why) assert(0 && why) inline int iceildiv(const int a, const int b) { - return (a + b - 1) / b; + return (a + b - 1) / b; } template inline T roundup(const T a, const T b) { - T rem = a % b; + T rem = a % b; - if (rem) { - return a + b - rem; - } else { - return a; - } + if (rem) { + return a + b - rem; + } else { + return a; + } } template inline unsigned long get_vector_length() { +#ifdef __ARM_FEATURE_SVE + const unsigned long length = svcntb(); +#else const unsigned long length = 16; +#endif return length / sizeof(T); -} +} \ No newline at end of file -- cgit v1.2.1