diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2020-01-22 18:36:27 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2020-01-31 11:36:14 +0000 |
commit | 94672fb2af6535adc6ea7fe8b8498580ad8cf3f4 (patch) | |
tree | 189c68e7ff2c29d7800e09239da6d9a6364d5b05 /src/core/NEON/kernels/arm_gemm/transforms | |
parent | 6a342648ae50beb8457871862f14fc9baef6b74f (diff) | |
download | ComputeLibrary-94672fb2af6535adc6ea7fe8b8498580ad8cf3f4.tar.gz |
COMPMID-3003: Integrate assembly kernels utilizing MMLA instruction.
MMLA is a matrix-multiply instruction introduced on armv8.6-A
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I572a54981d48f5a1e0e9e51102cb7ae28ad87806
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2663
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/NEON/kernels/arm_gemm/transforms')
5 files changed, 1939 insertions, 0 deletions
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_8way_32bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_8way_32bit.hpp new file mode 100644 index 0000000000..0080c91b18 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_8way_32bit.hpp @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2017-2019 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 __aarch64__ + +#include "transpose_interleave_common.hpp" + +// Generic unblocked transposed 8x32-bit sized specialisation +template <> +template <typename T> +inline void TransformImpl<8, 1, true, 4, 4, false>::Transform( + T* out, const T* const in, const int stride, + const int x0, const int xmax, const int k0, const int kmax +) { + // Redirect to a 16 x uint16_t specialisation + TransformImpl<16, 1, true, 2, 2, false>::Transform( + reinterpret_cast<uint16_t *>(out), + reinterpret_cast<const uint16_t *>(in), + stride*2, x0*2, xmax*2, k0, kmax + ); +} + +// Generic 16x16-bit sized specialisation +template <> +template <typename T> +inline void TransformImpl<16, 1, true, 2, 2, false>::Transform( + T* out, const T* const in, const int stride, + const int x0, const int xmax, const int k0, const int kmax +) { + // Redirect to a uint16_t specialisation + Transform( + reinterpret_cast<uint16_t *>(out), + reinterpret_cast<const uint16_t *>(in), + stride, x0, xmax, k0, kmax + ); +} + +// Specialised 16 x uint16_t version +template <> +inline void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x1(const uint16_t *&in0, uint16_t *const out) { + __asm volatile ( + "LDR q0, [%[in0]]\n" + "STR q0, [%[out]]\n" + "LDR q1, [%[in0], #0x10]\n" + "STR q1, [%[out], #0x10]\n" + "ADD %x[in0], %x[in0], #0x20\n" + ASM_PREFETCH("[%[in0], #192]") + : [in0] "+r" (in0) + : [out] "r" (out) + : "v0", "v1", "memory" + ); +} + +template <> +inline void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x2(const uint16_t *&in0, const uint16_t *&in1, uint16_t *const out) { + __asm volatile ( + "LDR q0, [%[in0]]\n" + "STR q0, [%[out]]\n" + "LDR q1, [%[in0], #0x10]\n" + "STR q1, [%[out], #0x10]\n" + "ADD %x[in0], %x[in0], #0x20\n" + ASM_PREFETCH("[%[in0], #192]") + + "LDR q2, [%[in1]]\n" + "STR q2, [%[out], #0x20]\n" + "LDR q3, [%[in1], #0x10]\n" + "STR q3, [%[out], #0x30]\n" + "ADD %x[in1], %x[in1], #0x20\n" + ASM_PREFETCH("[%[in1], #192]") + : [in0] "+r" (in0), + [in1] "+r" (in1) + : [out] "r" (out) + : "v0", "v1", "v2", "v3", "memory" + ); +} + +template <> +inline void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x4(const uint16_t *&in0, const uint16_t *&in1, const uint16_t *&in2, const uint16_t *&in3, uint16_t *const out) { + __asm __volatile ( + "LDR q0, [%[in0]]\n" + "STR q0, [%[out]]\n" + "LDR q1, [%[in0], #0x10]\n" + "STR q1, [%[out], #0x10]\n" + "ADD %x[in0], %x[in0], #0x20\n" + ASM_PREFETCH("[%[in0], #192]") + + "LDR q2, [%[in1]]\n" + "STR q2, [%[out], #0x20]\n" + "LDR q3, [%[in1], #0x10]\n" + "STR q3, [%[out], #0x30]\n" + "ADD %x[in1], %x[in1], #0x20\n" + ASM_PREFETCH("[%[in1], #192]") + + "LDR q0, [%[in2]]\n" + "STR q0, [%[out], #0x40]\n" + "LDR q1, [%[in2], #0x10]\n" + "STR q1, [%[out], #0x50]\n" + "ADD %x[in2], %x[in2], #0x20\n" + ASM_PREFETCH("[%[in2], #192]") + + "LDR q2, [%[in3]]\n" + "STR q2, [%[out], #0x60]\n" + "LDR q3, [%[in3], #0x10]\n" + "STR q3, [%[out], #0x70]\n" + "ADD %x[in3], %x[in3], #0x20\n" + ASM_PREFETCH("[%[in3], #192]") + : [in0] "+r" (in0), + [in1] "+r" (in1), + [in2] "+r" (in2), + [in3] "+r" (in3) + : [out] "r" (out) + : "v0", "v1", "v2", "v3", "memory" + ); +} + +template <> +template <> +inline void TransformImpl<16, 1, true, 2, 2, false>::Transform( + uint16_t* out, const uint16_t* const in, const int stride, + const int x0, const int xmax, const int k0, const int kmax +) { + TransposeInterleaveCommon<16, uint16_t, uint16_t>::Transform(out, in, stride, x0, xmax, k0, kmax); +} + +#endif // __aarch64__ diff --git a/src/core/NEON/kernels/arm_gemm/transforms/list.hpp b/src/core/NEON/kernels/arm_gemm/transforms/list.hpp index c0c2ca19d7..be66cd42ff 100644 --- a/src/core/NEON/kernels/arm_gemm/transforms/list.hpp +++ b/src/core/NEON/kernels/arm_gemm/transforms/list.hpp @@ -31,5 +31,9 @@ #include "a64_transpose_interleave_12way_16bit.hpp" #include "a64_transpose_interleave_12way_half_to_float.hpp" #include "a64_transpose_interleave_24way_16bit.hpp" +#include "a64_transpose_interleave_8way_32bit.hpp" #include "sve_interleave_8way_32bit.hpp" +#include "sve_interleave_8way_block2_16bit.hpp" +#include "sve_interleave_8way_block4_16bit.hpp" #include "sve_interleave_8way_block4_8bit.hpp" +#include "sve_interleave_8way_block8_8bit.hpp" diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block2_16bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block2_16bit.hpp new file mode 100644 index 0000000000..234433a0f1 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block2_16bit.hpp @@ -0,0 +1,596 @@ +/* + * Copyright (c) 2019 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<typename T> +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<uint16_t *>(out); + const uint16_t *inptr = reinterpret_cast<const uint16_t *>(in); + + for (int y=y0; y<ymax; y+=8) + { + const int height = ymax-y; + const long inwidth = (kmax - k0); + const long outwidth = ((inwidth + 1) / 2) * 16; + long inpos = 0; + long outpos = 0; + + uint16_t *outptr = master_outptr; + master_outptr += outwidth; + + const uint16_t *inptr0 = inptr + y * ldin + k0; + const uint16_t *inptr1 = inptr0 + ldin; + const uint16_t *inptr2 = inptr1 + ldin; + const uint16_t *inptr3 = inptr2 + ldin; + const uint16_t *inptr4 = inptr3 + ldin; + const uint16_t *inptr5 = inptr4 + ldin; + const uint16_t *inptr6 = inptr5 + ldin; + const uint16_t *inptr7 = inptr6 + ldin; + + switch(height) + { + case 1: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "zip1 z8.s, z0.s, z4.s\n" + "zip2 z9.s, z0.s, z4.s\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip1 z0.s, z8.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z1.s, z8.s, z4.s\n" + "zip1 z2.s, z9.s, z4.s\n" + "zip2 z3.s, z9.s, z4.s\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip1 z8.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.s, z0.s, z4.s\n" + "zip1 z10.s, z1.s, z4.s\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.s, z1.s, z4.s\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip1 z12.s, z2.s, z4.s\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip2 z13.s, z2.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.s, z3.s, z4.s\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "zip2 z15.s, z3.s, z4.s\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 2: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.h, #0\n" + "mov z14.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip1 z8.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.s, z0.s, z4.s\n" + "zip1 z10.s, z1.s, z4.s\n" + "zip2 z11.s, z1.s, z4.s\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip1 z0.s, z8.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z1.s, z8.s, z4.s\n" + "zip1 z2.s, z9.s, z4.s\n" + "zip2 z3.s, z9.s, z4.s\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip1 z4.s, z10.s, z14.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z5.s, z10.s, z14.s\n" + "zip1 z6.s, z11.s, z14.s\n" + "zip2 z7.s, z11.s, z14.s\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip1 z8.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.s, z0.s, z4.s\n" + "zip1 z10.s, z1.s, z5.s\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.s, z1.s, z5.s\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip1 z12.s, z2.s, z6.s\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip2 z13.s, z2.s, z6.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.s, z3.s, z7.s\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "zip2 z15.s, z3.s, z7.s\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 3: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.h, #0\n" + "mov z14.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z4.s\n" + "zip2 z11.s, z1.s, z4.s\n" + "zip1 z12.s, z2.s, z4.s\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z0.s, z8.s, z12.s\n" + "zip2 z1.s, z8.s, z12.s\n" + "zip1 z2.s, z9.s, z13.s\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z3.s, z9.s, z13.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z4.s, z10.s, z14.s\n" + "zip2 z5.s, z10.s, z14.s\n" + "zip1 z6.s, z11.s, z14.s\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z7.s, z11.s, z14.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z8.s, z0.s, z4.s\n" + "zip2 z9.s, z0.s, z4.s\n" + "zip1 z10.s, z1.s, z5.s\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z11.s, z1.s, z5.s\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip1 z12.s, z2.s, z6.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z13.s, z2.s, z6.s\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.s, z3.s, z7.s\n" + "zip2 z15.s, z3.s, z7.s\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 4: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z4.s\n" + "zip2 z11.s, z1.s, z4.s\n" + "zip1 z12.s, z2.s, z4.s\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.s, z3.s, z4.s\n" + "zip2 z15.s, z3.s, z4.s\n" + "zip1 z0.s, z8.s, z12.s\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.s, z8.s, z12.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.s, z9.s, z13.s\n" + "zip2 z3.s, z9.s, z13.s\n" + "zip1 z4.s, z10.s, z14.s\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.s, z10.s, z14.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.s, z11.s, z15.s\n" + "zip2 z7.s, z11.s, z15.s\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z5.s\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.s, z1.s, z5.s\n" + "zip1 z12.s, z2.s, z6.s\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z6.s\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.s, z3.s, z7.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.s, z3.s, z7.s\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 5: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z5.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "ld1h z4.h, p0/z, [%[inptr4], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z10.s, z1.s, z5.s\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip1 z8.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.s, z0.s, z4.s\n" + "zip2 z11.s, z1.s, z5.s\n" + "zip1 z12.s, z2.s, z5.s\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z5.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.s, z3.s, z5.s\n" + "zip2 z15.s, z3.s, z5.s\n" + "zip1 z0.s, z8.s, z12.s\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.s, z8.s, z12.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.s, z9.s, z13.s\n" + "zip2 z3.s, z9.s, z13.s\n" + "zip1 z4.s, z10.s, z14.s\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.s, z10.s, z14.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.s, z11.s, z15.s\n" + "zip2 z7.s, z11.s, z15.s\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z5.s\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.s, z1.s, z5.s\n" + "zip1 z12.s, z2.s, z6.s\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z6.s\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.s, z3.s, z7.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.s, z3.s, z7.s\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 6: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z6.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "ld1h z4.h, p0/z, [%[inptr4], %[inpos], LSL #1]\n" + "ld1h z5.h, p0/z, [%[inptr5], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z12.s, z2.s, z6.s\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip1 z8.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.s, z0.s, z4.s\n" + "zip1 z10.s, z1.s, z5.s\n" + "zip2 z11.s, z1.s, z5.s\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z6.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.s, z3.s, z6.s\n" + "zip2 z15.s, z3.s, z6.s\n" + "zip1 z0.s, z8.s, z12.s\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.s, z8.s, z12.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.s, z9.s, z13.s\n" + "zip2 z3.s, z9.s, z13.s\n" + "zip1 z4.s, z10.s, z14.s\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.s, z10.s, z14.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.s, z11.s, z15.s\n" + "zip2 z7.s, z11.s, z15.s\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z5.s\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.s, z1.s, z5.s\n" + "zip1 z12.s, z2.s, z6.s\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z6.s\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.s, z3.s, z7.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.s, z3.s, z7.s\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 7: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z7.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "ld1h z4.h, p0/z, [%[inptr4], %[inpos], LSL #1]\n" + "ld1h z5.h, p0/z, [%[inptr5], %[inpos], LSL #1]\n" + "ld1h z6.h, p0/z, [%[inptr6], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z5.s\n" + "zip2 z11.s, z1.s, z5.s\n" + "zip1 z12.s, z2.s, z6.s\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z6.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.s, z3.s, z7.s\n" + "zip2 z15.s, z3.s, z7.s\n" + "zip1 z0.s, z8.s, z12.s\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.s, z8.s, z12.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.s, z9.s, z13.s\n" + "zip2 z3.s, z9.s, z13.s\n" + "zip1 z4.s, z10.s, z14.s\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.s, z10.s, z14.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.s, z11.s, z15.s\n" + "zip2 z7.s, z11.s, z15.s\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z5.s\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.s, z1.s, z5.s\n" + "zip1 z12.s, z2.s, z6.s\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z6.s\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.s, z3.s, z7.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.s, z3.s, z7.s\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5), [inptr6] "+r" (inptr6) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + default: + case 8: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "ld1h z4.h, p0/z, [%[inptr4], %[inpos], LSL #1]\n" + "ld1h z5.h, p0/z, [%[inptr5], %[inpos], LSL #1]\n" + "ld1h z6.h, p0/z, [%[inptr6], %[inpos], LSL #1]\n" + "ld1h z7.h, p0/z, [%[inptr7], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z5.s\n" + "zip2 z11.s, z1.s, z5.s\n" + "zip1 z12.s, z2.s, z6.s\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z6.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.s, z3.s, z7.s\n" + "zip2 z15.s, z3.s, z7.s\n" + "zip1 z0.s, z8.s, z12.s\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.s, z8.s, z12.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.s, z9.s, z13.s\n" + "zip2 z3.s, z9.s, z13.s\n" + "zip1 z4.s, z10.s, z14.s\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.s, z10.s, z14.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.s, z11.s, z15.s\n" + "zip2 z7.s, z11.s, z15.s\n" + "zip1 z8.s, z0.s, z4.s\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.s, z0.s, z4.s\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.s, z1.s, z5.s\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.s, z1.s, z5.s\n" + "zip1 z12.s, z2.s, z6.s\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.s, z2.s, z6.s\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.s, z3.s, z7.s\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.s, z3.s, z7.s\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5), [inptr6] "+r" (inptr6), [inptr7] "+r" (inptr7) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + + } + } +} + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block4_16bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block4_16bit.hpp new file mode 100644 index 0000000000..26e10511a6 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block4_16bit.hpp @@ -0,0 +1,596 @@ +/* + * Copyright (c) 2019 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<typename T> +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<uint16_t *>(out); + const uint16_t *inptr = reinterpret_cast<const uint16_t *>(in); + + for (int y=y0; y<ymax; y+=8) + { + const int height = ymax-y; + const long inwidth = (kmax - k0); + const long outwidth = ((inwidth + 3) / 4) * 32; + long inpos = 0; + long outpos = 0; + + uint16_t *outptr = master_outptr; + master_outptr += outwidth; + + const uint16_t *inptr0 = inptr + y * ldin + k0; + const uint16_t *inptr1 = inptr0 + ldin; + const uint16_t *inptr2 = inptr1 + ldin; + const uint16_t *inptr3 = inptr2 + ldin; + const uint16_t *inptr4 = inptr3 + ldin; + const uint16_t *inptr5 = inptr4 + ldin; + const uint16_t *inptr6 = inptr5 + ldin; + const uint16_t *inptr7 = inptr6 + ldin; + + switch(height) + { + case 1: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "zip2 z9.d, z0.d, z4.d\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip1 z0.d, z8.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z1.d, z8.d, z4.d\n" + "zip1 z2.d, z9.d, z4.d\n" + "zip2 z3.d, z9.d, z4.d\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z4.d\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z4.d\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip1 z12.d, z2.d, z4.d\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip2 z13.d, z2.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z4.d\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "zip2 z15.d, z3.d, z4.d\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 2: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.h, #0\n" + "mov z14.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z4.d\n" + "zip2 z11.d, z1.d, z4.d\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip1 z0.d, z8.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z1.d, z8.d, z4.d\n" + "zip1 z2.d, z9.d, z4.d\n" + "zip2 z3.d, z9.d, z4.d\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip1 z4.d, z10.d, z14.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z5.d, z10.d, z14.d\n" + "zip1 z6.d, z11.d, z14.d\n" + "zip2 z7.d, z11.d, z14.d\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip1 z12.d, z2.d, z6.d\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip2 z13.d, z2.d, z6.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z7.d\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "zip2 z15.d, z3.d, z7.d\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 3: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.h, #0\n" + "mov z14.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z4.d\n" + "zip2 z11.d, z1.d, z4.d\n" + "zip1 z12.d, z2.d, z4.d\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z0.d, z8.d, z12.d\n" + "zip2 z1.d, z8.d, z12.d\n" + "zip1 z2.d, z9.d, z13.d\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z3.d, z9.d, z13.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z4.d, z10.d, z14.d\n" + "zip2 z5.d, z10.d, z14.d\n" + "zip1 z6.d, z11.d, z14.d\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z7.d, z11.d, z14.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z5.d\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z11.d, z1.d, z5.d\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip1 z12.d, z2.d, z6.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "zip2 z15.d, z3.d, z7.d\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 4: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z4.d\n" + "zip2 z11.d, z1.d, z4.d\n" + "zip1 z12.d, z2.d, z4.d\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z4.d\n" + "zip2 z15.d, z3.d, z4.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 5: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z5.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "ld1h z4.h, p0/z, [%[inptr4], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z5.d\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z5.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z5.d\n" + "zip2 z15.d, z3.d, z5.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 6: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z6.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "ld1h z4.h, p0/z, [%[inptr4], %[inpos], LSL #1]\n" + "ld1h z5.h, p0/z, [%[inptr5], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z5.d\n" + "zip2 z11.d, z1.d, z5.d\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z6.d\n" + "zip2 z15.d, z3.d, z6.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 7: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z7.h, #0\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "ld1h z4.h, p0/z, [%[inptr4], %[inpos], LSL #1]\n" + "ld1h z5.h, p0/z, [%[inptr5], %[inpos], LSL #1]\n" + "ld1h z6.h, p0/z, [%[inptr6], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z7.d\n" + "zip2 z15.d, z3.d, z7.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5), [inptr6] "+r" (inptr6) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + default: + case 8: + __asm __volatile( + "1:\n" + "whilelt p0.h, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "ld1h z0.h, p0/z, [%[inptr0], %[inpos], LSL #1]\n" + "ld1h z1.h, p0/z, [%[inptr1], %[inpos], LSL #1]\n" + "ld1h z2.h, p0/z, [%[inptr2], %[inpos], LSL #1]\n" + "ld1h z3.h, p0/z, [%[inptr3], %[inpos], LSL #1]\n" + "ld1h z4.h, p0/z, [%[inptr4], %[inpos], LSL #1]\n" + "ld1h z5.h, p0/z, [%[inptr5], %[inpos], LSL #1]\n" + "ld1h z6.h, p0/z, [%[inptr6], %[inpos], LSL #1]\n" + "ld1h z7.h, p0/z, [%[inptr7], %[inpos], LSL #1]\n" + "inch %[inpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p0.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p1.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z7.d\n" + "zip2 z15.d, z3.d, z7.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.h, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.h, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.h, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "inch %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1h z8.h, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.h, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1h z9.h, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "inch %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1h z10.h, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.h, %[outpos], %[outwidth]\n" + "st1h z11.h, p3, [%[outptr], #3, MUL VL]\n" + "inch %[outpos], all, mul #1\n" + "st1h z12.h, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.h, %[outpos], %[outwidth]\n" + "inch %[outpos], all, mul #1\n" + "st1h z13.h, p5, [%[outptr], #5, MUL VL]\n" + "st1h z14.h, p6, [%[outptr], #6, MUL VL]\n" + "st1h z15.h, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5), [inptr6] "+r" (inptr6), [inptr7] "+r" (inptr7) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + + } + } +} + +#endif // __ARM_FEATURE_SVE diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block8_8bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block8_8bit.hpp new file mode 100644 index 0000000000..b4935e6417 --- /dev/null +++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_interleave_8way_block8_8bit.hpp @@ -0,0 +1,596 @@ +/* + * Copyright (c) 2019 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<typename T> +inline void TransformImpl<8, 8, 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<uint8_t *>(out); + const uint8_t *inptr = reinterpret_cast<const uint8_t *>(in); + + for (int y=y0; y<ymax; y+=8) + { + const int height = ymax-y; + const long inwidth = (kmax - k0); + const long outwidth = ((inwidth + 7) / 8) * 64; + long inpos = 0; + long outpos = 0; + + uint8_t *outptr = master_outptr; + master_outptr += outwidth; + + const uint8_t *inptr0 = inptr + y * ldin + k0; + const uint8_t *inptr1 = inptr0 + ldin; + const uint8_t *inptr2 = inptr1 + ldin; + const uint8_t *inptr3 = inptr2 + ldin; + const uint8_t *inptr4 = inptr3 + ldin; + const uint8_t *inptr5 = inptr4 + ldin; + const uint8_t *inptr6 = inptr5 + ldin; + const uint8_t *inptr7 = inptr6 + ldin; + + switch(height) + { + case 1: + __asm __volatile( + "1:\n" + "whilelt p0.b, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.b, #0\n" + "ld1b z0.b, p0/z, [%[inptr0], %[inpos]]\n" + "incb %[inpos], all, mul #1\n" + "whilelt p0.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "zip2 z9.d, z0.d, z4.d\n" + "whilelt p1.b, %[outpos], %[outwidth]\n" + "zip1 z0.d, z8.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z1.d, z8.d, z4.d\n" + "zip1 z2.d, z9.d, z4.d\n" + "zip2 z3.d, z9.d, z4.d\n" + "whilelt p2.b, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z4.d\n" + "st1b z8.b, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z4.d\n" + "whilelt p3.b, %[outpos], %[outwidth]\n" + "zip1 z12.d, z2.d, z4.d\n" + "st1b z9.b, p1, [%[outptr], #1, MUL VL]\n" + "zip2 z13.d, z2.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z4.d\n" + "st1b z10.b, p2, [%[outptr], #2, MUL VL]\n" + "zip2 z15.d, z3.d, z4.d\n" + "whilelt p4.b, %[outpos], %[outwidth]\n" + "st1b z11.b, p3, [%[outptr], #3, MUL VL]\n" + "incb %[outpos], all, mul #1\n" + "st1b z12.b, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p5.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z13.b, p5, [%[outptr], #5, MUL VL]\n" + "whilelt p6.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z14.b, p6, [%[outptr], #6, MUL VL]\n" + "whilelt p7.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z15.b, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 2: + __asm __volatile( + "1:\n" + "whilelt p0.b, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.b, #0\n" + "mov z14.b, #0\n" + "ld1b z0.b, p0/z, [%[inptr0], %[inpos]]\n" + "ld1b z1.b, p0/z, [%[inptr1], %[inpos]]\n" + "incb %[inpos], all, mul #1\n" + "whilelt p0.b, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z4.d\n" + "zip2 z11.d, z1.d, z4.d\n" + "whilelt p1.b, %[outpos], %[outwidth]\n" + "zip1 z0.d, z8.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z1.d, z8.d, z4.d\n" + "zip1 z2.d, z9.d, z4.d\n" + "zip2 z3.d, z9.d, z4.d\n" + "whilelt p2.b, %[outpos], %[outwidth]\n" + "zip1 z4.d, z10.d, z14.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z5.d, z10.d, z14.d\n" + "zip1 z6.d, z11.d, z14.d\n" + "zip2 z7.d, z11.d, z14.d\n" + "whilelt p3.b, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1b z8.b, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "whilelt p4.b, %[outpos], %[outwidth]\n" + "zip1 z12.d, z2.d, z6.d\n" + "st1b z9.b, p1, [%[outptr], #1, MUL VL]\n" + "zip2 z13.d, z2.d, z6.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z7.d\n" + "st1b z10.b, p2, [%[outptr], #2, MUL VL]\n" + "zip2 z15.d, z3.d, z7.d\n" + "whilelt p5.b, %[outpos], %[outwidth]\n" + "st1b z11.b, p3, [%[outptr], #3, MUL VL]\n" + "incb %[outpos], all, mul #1\n" + "st1b z12.b, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p6.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z13.b, p5, [%[outptr], #5, MUL VL]\n" + "whilelt p7.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z14.b, p6, [%[outptr], #6, MUL VL]\n" + "st1b z15.b, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 3: + __asm __volatile( + "1:\n" + "whilelt p0.b, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.b, #0\n" + "mov z14.b, #0\n" + "ld1b z0.b, p0/z, [%[inptr0], %[inpos]]\n" + "ld1b z1.b, p0/z, [%[inptr1], %[inpos]]\n" + "ld1b z2.b, p0/z, [%[inptr2], %[inpos]]\n" + "incb %[inpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p0.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z4.d\n" + "zip2 z11.d, z1.d, z4.d\n" + "zip1 z12.d, z2.d, z4.d\n" + "whilelt p1.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z0.d, z8.d, z12.d\n" + "zip2 z1.d, z8.d, z12.d\n" + "zip1 z2.d, z9.d, z13.d\n" + "whilelt p2.b, %[outpos], %[outwidth]\n" + "zip2 z3.d, z9.d, z13.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z4.d, z10.d, z14.d\n" + "zip2 z5.d, z10.d, z14.d\n" + "zip1 z6.d, z11.d, z14.d\n" + "whilelt p3.b, %[outpos], %[outwidth]\n" + "zip2 z7.d, z11.d, z14.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z5.d\n" + "whilelt p4.b, %[outpos], %[outwidth]\n" + "zip2 z11.d, z1.d, z5.d\n" + "st1b z8.b, p0, [%[outptr]]\n" + "zip1 z12.d, z2.d, z6.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1b z9.b, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "zip2 z15.d, z3.d, z7.d\n" + "whilelt p5.b, %[outpos], %[outwidth]\n" + "st1b z10.b, p2, [%[outptr], #2, MUL VL]\n" + "incb %[outpos], all, mul #1\n" + "st1b z11.b, p3, [%[outptr], #3, MUL VL]\n" + "whilelt p6.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z12.b, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z13.b, p5, [%[outptr], #5, MUL VL]\n" + "st1b z14.b, p6, [%[outptr], #6, MUL VL]\n" + "st1b z15.b, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 4: + __asm __volatile( + "1:\n" + "whilelt p0.b, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z4.b, #0\n" + "ld1b z0.b, p0/z, [%[inptr0], %[inpos]]\n" + "ld1b z1.b, p0/z, [%[inptr1], %[inpos]]\n" + "ld1b z2.b, p0/z, [%[inptr2], %[inpos]]\n" + "ld1b z3.b, p0/z, [%[inptr3], %[inpos]]\n" + "incb %[inpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p0.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z4.d\n" + "zip2 z11.d, z1.d, z4.d\n" + "zip1 z12.d, z2.d, z4.d\n" + "whilelt p1.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z4.d\n" + "zip2 z15.d, z3.d, z4.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.b, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.b, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1b z8.b, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1b z9.b, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1b z10.b, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.b, %[outpos], %[outwidth]\n" + "st1b z11.b, p3, [%[outptr], #3, MUL VL]\n" + "incb %[outpos], all, mul #1\n" + "st1b z12.b, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z13.b, p5, [%[outptr], #5, MUL VL]\n" + "st1b z14.b, p6, [%[outptr], #6, MUL VL]\n" + "st1b z15.b, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 5: + __asm __volatile( + "1:\n" + "whilelt p0.b, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z5.b, #0\n" + "ld1b z0.b, p0/z, [%[inptr0], %[inpos]]\n" + "ld1b z1.b, p0/z, [%[inptr1], %[inpos]]\n" + "ld1b z2.b, p0/z, [%[inptr2], %[inpos]]\n" + "ld1b z3.b, p0/z, [%[inptr3], %[inpos]]\n" + "ld1b z4.b, p0/z, [%[inptr4], %[inpos]]\n" + "incb %[inpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "whilelt p0.b, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z5.d\n" + "whilelt p1.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z5.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z5.d\n" + "zip2 z15.d, z3.d, z5.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.b, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.b, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1b z8.b, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1b z9.b, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1b z10.b, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.b, %[outpos], %[outwidth]\n" + "st1b z11.b, p3, [%[outptr], #3, MUL VL]\n" + "incb %[outpos], all, mul #1\n" + "st1b z12.b, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z13.b, p5, [%[outptr], #5, MUL VL]\n" + "st1b z14.b, p6, [%[outptr], #6, MUL VL]\n" + "st1b z15.b, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 6: + __asm __volatile( + "1:\n" + "whilelt p0.b, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z6.b, #0\n" + "ld1b z0.b, p0/z, [%[inptr0], %[inpos]]\n" + "ld1b z1.b, p0/z, [%[inptr1], %[inpos]]\n" + "ld1b z2.b, p0/z, [%[inptr2], %[inpos]]\n" + "ld1b z3.b, p0/z, [%[inptr3], %[inpos]]\n" + "ld1b z4.b, p0/z, [%[inptr4], %[inpos]]\n" + "ld1b z5.b, p0/z, [%[inptr5], %[inpos]]\n" + "incb %[inpos], all, mul #1\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p0.b, %[outpos], %[outwidth]\n" + "zip1 z8.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z9.d, z0.d, z4.d\n" + "zip1 z10.d, z1.d, z5.d\n" + "zip2 z11.d, z1.d, z5.d\n" + "whilelt p1.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z6.d\n" + "zip2 z15.d, z3.d, z6.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.b, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.b, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1b z8.b, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1b z9.b, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1b z10.b, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.b, %[outpos], %[outwidth]\n" + "st1b z11.b, p3, [%[outptr], #3, MUL VL]\n" + "incb %[outpos], all, mul #1\n" + "st1b z12.b, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z13.b, p5, [%[outptr], #5, MUL VL]\n" + "st1b z14.b, p6, [%[outptr], #6, MUL VL]\n" + "st1b z15.b, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + case 7: + __asm __volatile( + "1:\n" + "whilelt p0.b, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "mov z7.b, #0\n" + "ld1b z0.b, p0/z, [%[inptr0], %[inpos]]\n" + "ld1b z1.b, p0/z, [%[inptr1], %[inpos]]\n" + "ld1b z2.b, p0/z, [%[inptr2], %[inpos]]\n" + "ld1b z3.b, p0/z, [%[inptr3], %[inpos]]\n" + "ld1b z4.b, p0/z, [%[inptr4], %[inpos]]\n" + "ld1b z5.b, p0/z, [%[inptr5], %[inpos]]\n" + "ld1b z6.b, p0/z, [%[inptr6], %[inpos]]\n" + "incb %[inpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p0.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p1.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z7.d\n" + "zip2 z15.d, z3.d, z7.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.b, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.b, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1b z8.b, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1b z9.b, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1b z10.b, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.b, %[outpos], %[outwidth]\n" + "st1b z11.b, p3, [%[outptr], #3, MUL VL]\n" + "incb %[outpos], all, mul #1\n" + "st1b z12.b, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z13.b, p5, [%[outptr], #5, MUL VL]\n" + "st1b z14.b, p6, [%[outptr], #6, MUL VL]\n" + "st1b z15.b, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5), [inptr6] "+r" (inptr6) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + default: + case 8: + __asm __volatile( + "1:\n" + "whilelt p0.b, %[inpos], %[inwidth]\n" + "b.none 2f\n" + "ld1b z0.b, p0/z, [%[inptr0], %[inpos]]\n" + "ld1b z1.b, p0/z, [%[inptr1], %[inpos]]\n" + "ld1b z2.b, p0/z, [%[inptr2], %[inpos]]\n" + "ld1b z3.b, p0/z, [%[inptr3], %[inpos]]\n" + "ld1b z4.b, p0/z, [%[inptr4], %[inpos]]\n" + "ld1b z5.b, p0/z, [%[inptr5], %[inpos]]\n" + "ld1b z6.b, p0/z, [%[inptr6], %[inpos]]\n" + "ld1b z7.b, p0/z, [%[inptr7], %[inpos]]\n" + "incb %[inpos], all, mul #1\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p0.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p1.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z14.d, z3.d, z7.d\n" + "zip2 z15.d, z3.d, z7.d\n" + "zip1 z0.d, z8.d, z12.d\n" + "whilelt p2.b, %[outpos], %[outwidth]\n" + "zip2 z1.d, z8.d, z12.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z2.d, z9.d, z13.d\n" + "zip2 z3.d, z9.d, z13.d\n" + "zip1 z4.d, z10.d, z14.d\n" + "whilelt p3.b, %[outpos], %[outwidth]\n" + "zip2 z5.d, z10.d, z14.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z6.d, z11.d, z15.d\n" + "zip2 z7.d, z11.d, z15.d\n" + "zip1 z8.d, z0.d, z4.d\n" + "whilelt p4.b, %[outpos], %[outwidth]\n" + "zip2 z9.d, z0.d, z4.d\n" + "incb %[outpos], all, mul #1\n" + "zip1 z10.d, z1.d, z5.d\n" + "st1b z8.b, p0, [%[outptr]]\n" + "zip2 z11.d, z1.d, z5.d\n" + "zip1 z12.d, z2.d, z6.d\n" + "whilelt p5.b, %[outpos], %[outwidth]\n" + "zip2 z13.d, z2.d, z6.d\n" + "st1b z9.b, p1, [%[outptr], #1, MUL VL]\n" + "zip1 z14.d, z3.d, z7.d\n" + "incb %[outpos], all, mul #1\n" + "zip2 z15.d, z3.d, z7.d\n" + "st1b z10.b, p2, [%[outptr], #2, MUL VL]\n" + "whilelt p6.b, %[outpos], %[outwidth]\n" + "st1b z11.b, p3, [%[outptr], #3, MUL VL]\n" + "incb %[outpos], all, mul #1\n" + "st1b z12.b, p4, [%[outptr], #4, MUL VL]\n" + "whilelt p7.b, %[outpos], %[outwidth]\n" + "incb %[outpos], all, mul #1\n" + "st1b z13.b, p5, [%[outptr], #5, MUL VL]\n" + "st1b z14.b, p6, [%[outptr], #6, MUL VL]\n" + "st1b z15.b, p7, [%[outptr], #7, MUL VL]\n" + "addvl %[outptr], %[outptr], #8\n" + "b 1b\n" + "2:\n" + : [inpos] "+r" (inpos), [outpos] "+r" (outpos), [outptr] "+r" (outptr), [inptr0] "+r" (inptr0), [inptr1] "+r" (inptr1), [inptr2] "+r" (inptr2), [inptr3] "+r" (inptr3), [inptr4] "+r" (inptr4), [inptr5] "+r" (inptr5), [inptr6] "+r" (inptr6), [inptr7] "+r" (inptr7) + : [outwidth] "r" (outwidth), [inwidth] "r" (inwidth) + : "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "cc", "memory" + ); + break; + + + } + } +} + +#endif // __ARM_FEATURE_SVE |