aboutsummaryrefslogtreecommitdiff
path: root/src/core/NEON/kernels/arm_gemm/transforms
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-07-16 16:16:43 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-07-22 02:25:50 +0000
commit4ee8b1599dbaf7634d25607fa5ac96ba3dc6b0f2 (patch)
tree2f8362d33cdad4212f4b96995681c68184c759e1 /src/core/NEON/kernels/arm_gemm/transforms
parent59fd7a722e5bc7e85309d6200bc37a772721a719 (diff)
downloadComputeLibrary-4ee8b1599dbaf7634d25607fa5ac96ba3dc6b0f2.tar.gz
Update GEMM assembly kernels
- Introduce Fp32 kernels with internal calculations in Bfloat16 when fast_mode is enabled - Improve kernel selection heuristics Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I68a9e7e862b6fd2721b46e0d7cc791091c4ab279 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5965 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/NEON/kernels/arm_gemm/transforms')
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a32_transpose_interleave_8way_32bit.hpp14
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_128.hpp289
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_1x4.hpp432
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_1x8.hpp335
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x2.hpp344
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x4.hpp445
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x4_fp32bf16.hpp735
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_s8s16.hpp275
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_u8u16.hpp275
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12way_16bit.hpp145
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12way_half_to_float.hpp120
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16.hpp137
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_1x4.hpp332
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_1x8.hpp291
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x2.hpp246
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x4.hpp511
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x4_fp32bf16.hpp447
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24.hpp272
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_2x4_fp32bf16.hpp787
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_bf16fp32.hpp295
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_fp16fp32.hpp295
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24way_16bit.hpp130
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_32_1x4.hpp508
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_32_2x2.hpp452
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_48.hpp245
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_4_1x16.hpp319
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_4_1x4.hpp338
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_64.hpp255
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_8way_32bit.hpp147
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_96.hpp269
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/list-sve.hpp42
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/list.hpp29
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_12VL_2x4_fp32bf16.hpp376
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_1VL.hpp163
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_1VL_1x4.hpp310
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL.hpp174
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL_1x4.hpp368
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL_2x2.hpp318
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL.hpp188
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL_1x4.hpp322
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL_2x2.hpp348
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_1x8.hpp295
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_2x4.hpp411
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_2x4_fp32bf16.hpp238
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_4x2.hpp322
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL.hpp307
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_1x4.hpp286
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_1x8.hpp259
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x2.hpp380
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x4.hpp465
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x4_fp32bf16.hpp282
-rw-r--r--src/core/NEON/kernels/arm_gemm/transforms/transpose_interleave_common.hpp4
52 files changed, 15017 insertions, 555 deletions
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a32_transpose_interleave_8way_32bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a32_transpose_interleave_8way_32bit.hpp
index 3ce1d328a7..b50c240a3a 100644
--- a/src/core/NEON/kernels/arm_gemm/transforms/a32_transpose_interleave_8way_32bit.hpp
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a32_transpose_interleave_8way_32bit.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 Arm Limited.
+ * Copyright (c) 2017-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -30,7 +30,7 @@
// Generic unblocked transposed 8x32-bit sized specialisation
template <>
template <typename T>
-inline void TransformImpl<8, 1, true, 4, 4, VLType::None>::Transform(
+void TransformImpl<8, 1, true, 4, 4, VLType::None>::Transform(
T* out, const T* const in, const int stride,
const int x0, const int xmax, const int k0, const int kmax
) {
@@ -45,7 +45,7 @@ inline void TransformImpl<8, 1, true, 4, 4, VLType::None>::Transform(
// Generic 16x16-bit sized specialisation
template <>
template <typename T>
-inline void TransformImpl<16, 1, true, 2, 2, VLType::None>::Transform(
+void TransformImpl<16, 1, true, 2, 2, VLType::None>::Transform(
T* out, const T* const in, const int stride,
const int x0, const int xmax, const int k0, const int kmax
) {
@@ -59,7 +59,7 @@ inline void TransformImpl<16, 1, true, 2, 2, VLType::None>::Transform(
// Specialised 16 x uint16_t version
template <>
-inline void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x1(const uint16_t *&in0, uint16_t *out) {
+void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x1(const uint16_t *&in0, uint16_t *out) {
__asm volatile (
"VLD1.32 {d0-d3}, [%[in0]]!\n"
"VST1.32 {d0-d3}, [%[out]]\n"
@@ -72,7 +72,7 @@ inline void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x1(con
}
template <>
-inline void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x2(const uint16_t *&in0, const uint16_t *&in1, uint16_t *out) {
+void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x2(const uint16_t *&in0, const uint16_t *&in1, uint16_t *out) {
__asm volatile (
"VLD1.32 {d0-d3}, [%[in0]]!\n"
"VST1.32 {d0-d3}, [%[out]]!\n"
@@ -90,7 +90,7 @@ inline void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x2(con
}
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 *out) {
+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 *out) {
__asm __volatile (
"VLD1.32 {d0-d3}, [%[in0]]!\n"
"VST1.32 {d0-d3}, [%[out]]!\n"
@@ -117,7 +117,7 @@ inline void TransposeInterleaveCommon<16, uint16_t, uint16_t>::moveblock_1x4(con
template <>
template <>
-inline void TransformImpl<16, 1, true, 2, 2, VLType::None>::Transform(
+void TransformImpl<16, 1, true, 2, 2, VLType::None>::Transform(
uint16_t* out, const uint16_t* const in, const int stride,
const int x0, const int xmax, const int k0, const int kmax
) {
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_128.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_128.hpp
new file mode 100644
index 0000000000..41c1c282e5
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_128.hpp
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_128(uint32_t *out, const uint32_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 32 * height * sizeof(uint32_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q15, [x24], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "ldr q14, [x22], #0x10\n"
+ "cmp x19, #0x20\n"
+ "ldr q13, [x21], #0x10\n"
+ "ldr q12, [x20], #0x10\n"
+ "ldr q11, [x24], #0x10\n"
+ "ldr q10, [x22], #0x10\n"
+ "ldr q9, [x21], #0x10\n"
+ "ldr q8, [x20], #0x10\n"
+ "ldr q7, [x24], #0x10\n"
+ "ldr q6, [x22], #0x10\n"
+ "ldr q5, [x21], #0x10\n"
+ "ldr q4, [x20], #0x10\n"
+ "ldr q3, [x24], #0x10\n"
+ "ldr q2, [x22], #0x10\n"
+ "ldr q1, [x21], #0x10\n"
+ "ldr q0, [x20], #0x10\n"
+ "ldr q31, [x24], #0x10\n"
+ "ldr q30, [x22], #0x10\n"
+ "ldr q29, [x21], #0x10\n"
+ "ldr q28, [x20], #0x10\n"
+ "ldr q27, [x24], #0x10\n"
+ "ldr q26, [x22], #0x10\n"
+ "ldr q25, [x21], #0x10\n"
+ "ldr q24, [x20], #0x10\n"
+ "ldr q23, [x24], #0x10\n"
+ "ldr q22, [x22], #0x10\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x20], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q15, [x23, #0x0]\n"
+ "str q11, [x23, #0x10]\n"
+ "str q7, [x23, #0x20]\n"
+ "str q3, [x23, #0x30]\n"
+ "str q31, [x23, #0x40]\n"
+ "str q27, [x23, #0x50]\n"
+ "str q23, [x23, #0x60]\n"
+ "str q19, [x23, #0x70]\n"
+ "str q14, [x23, #0x80]\n"
+ "str q10, [x23, #0x90]\n"
+ "str q6, [x23, #0xa0]\n"
+ "str q2, [x23, #0xb0]\n"
+ "str q30, [x23, #0xc0]\n"
+ "str q26, [x23, #0xd0]\n"
+ "str q22, [x23, #0xe0]\n"
+ "str q18, [x23, #0xf0]\n"
+ "str q13, [x23, #0x100]\n"
+ "str q9, [x23, #0x110]\n"
+ "str q5, [x23, #0x120]\n"
+ "str q1, [x23, #0x130]\n"
+ "str q29, [x23, #0x140]\n"
+ "str q25, [x23, #0x150]\n"
+ "str q21, [x23, #0x160]\n"
+ "str q17, [x23, #0x170]\n"
+ "str q12, [x23, #0x180]\n"
+ "str q8, [x23, #0x190]\n"
+ "str q4, [x23, #0x1a0]\n"
+ "str q0, [x23, #0x1b0]\n"
+ "str q28, [x23, #0x1c0]\n"
+ "str q24, [x23, #0x1d0]\n"
+ "str q20, [x23, #0x1e0]\n"
+ "str q16, [x23, #0x1f0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 16 loop: loop
+ "ldr q31, [x24], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q30, [x22], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q29, [x21], #0x10\n"
+ "ldr q28, [x20], #0x10\n"
+ "ldr q27, [x24], #0x10\n"
+ "ldr q26, [x22], #0x10\n"
+ "ldr q25, [x21], #0x10\n"
+ "ldr q24, [x20], #0x10\n"
+ "ldr q23, [x24], #0x10\n"
+ "ldr q22, [x22], #0x10\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x20], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q31, [x23, #0x0]\n"
+ "str q27, [x23, #0x10]\n"
+ "str q23, [x23, #0x20]\n"
+ "str q19, [x23, #0x30]\n"
+ "str q30, [x23, #0x80]\n"
+ "str q26, [x23, #0x90]\n"
+ "str q22, [x23, #0xa0]\n"
+ "str q18, [x23, #0xb0]\n"
+ "str q29, [x23, #0x100]\n"
+ "str q25, [x23, #0x110]\n"
+ "str q21, [x23, #0x120]\n"
+ "str q17, [x23, #0x130]\n"
+ "str q28, [x23, #0x180]\n"
+ "str q24, [x23, #0x190]\n"
+ "str q20, [x23, #0x1a0]\n"
+ "str q16, [x23, #0x1b0]\n"
+ "add x23, x23, #0x40\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr q19, [x24], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x22], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q19, [x23, #0x0]\n"
+ "str q18, [x23, #0x80]\n"
+ "str q17, [x23, #0x100]\n"
+ "str q16, [x23, #0x180]\n"
+ "add x23, x23, #0x10\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr s19, [x24], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s18, [x22], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s17, [x21], #0x4\n"
+ "ldr s16, [x20], #0x4\n"
+ "str s19, [x23, #0x0]\n"
+ "str s18, [x23, #0x80]\n"
+ "str s17, [x23, #0x100]\n"
+ "str s16, [x23, #0x180]\n"
+ "add x23, x23, #0x4\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x200\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Column loop
+ "ldr q23, [x24], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "cmp x19, #0x20\n"
+ "ldr q22, [x24], #0x10\n"
+ "ldr q21, [x24], #0x10\n"
+ "ldr q20, [x24], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "str q23, [x23, #0x0]\n"
+ "str q22, [x23, #0x10]\n"
+ "str q21, [x23, #0x20]\n"
+ "str q20, [x23, #0x30]\n"
+ "str q19, [x23, #0x40]\n"
+ "str q18, [x23, #0x50]\n"
+ "str q17, [x23, #0x60]\n"
+ "str q16, [x23, #0x70]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 16 loop: loop
+ "ldr q19, [x24], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "str q19, [x23, #0x0]\n"
+ "str q18, [x23, #0x10]\n"
+ "str q17, [x23, #0x20]\n"
+ "str q16, [x23, #0x30]\n"
+ "add x23, x23, #0x40\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr q16, [x24], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "cmp x19, #0x4\n"
+ "str q16, [x23, #0x0]\n"
+ "add x23, x23, #0x10\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr s16, [x24], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "cmp x19, #0x1\n"
+ "str s16, [x23, #0x0]\n"
+ "add x23, x23, #0x4\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x80\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<32, 1, true, VLType::None>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_128(
+ reinterpret_cast<uint32_t *>(out),
+ reinterpret_cast<const uint32_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 4,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_1x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_1x4.hpp
new file mode 100644
index 0000000000..ec3273a526
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_1x4.hpp
@@ -0,0 +1,432 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_12_1x4(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 12 * roundup<size_t>(height, 4) * sizeof(uint8_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x8\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x30\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0x30\n"
+ "ldr q23, [x26], #0x10\n"
+ "cmp x19, #0x30\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v22.16b, v18.16b, v16.16b\n"
+ "ldr q11, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v21.16b, v17.16b, v16.16b\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v10.16b, v17.16b, v16.16b\n"
+ "ldr q9, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v8.16b, v18.16b, v17.16b\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v7.16b, v18.16b, v17.16b\n"
+ "ldr q20, [x23], #0x10\n"
+ "ldr q6, [x22], #0x10\n"
+ "zip1 v17.16b, v23.16b, v16.16b\n"
+ "ldr q5, [x24], #0x10\n"
+ "zip2 v16.16b, v23.16b, v16.16b\n"
+ "ldr q4, [x23], #0x10\n"
+ "zip1 v3.16b, v19.16b, v17.16b\n"
+ "ldr q2, [x22], #0x10\n"
+ "zip2 v1.16b, v19.16b, v17.16b\n"
+ "ldr q19, [x21], #0x10\n"
+ "zip1 v0.16b, v22.16b, v16.16b\n"
+ "ldr q31, [x24], #0x10\n"
+ "zip2 v30.16b, v22.16b, v16.16b\n"
+ "ldr q29, [x23], #0x10\n"
+ "zip1 v16.16b, v11.16b, v5.16b\n"
+ "ldr q28, [x22], #0x10\n"
+ "zip1 v27.16b, v21.16b, v16.16b\n"
+ "ldr q26, [x21], #0x10\n"
+ "zip1 v18.16b, v20.16b, v19.16b\n"
+ "ldr q17, [x20], #0x10\n"
+ "zip2 v20.16b, v20.16b, v19.16b\n"
+ "ldr q25, [x21], #0x10\n"
+ "zip2 v24.16b, v21.16b, v16.16b\n"
+ "zip1 v23.16b, v4.16b, v26.16b\n"
+ "ldr q22, [x20], #0x10\n"
+ "zip1 v16.16b, v6.16b, v17.16b\n"
+ "ldr q21, [x20], #0x10\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "zip2 v18.16b, v18.16b, v16.16b\n"
+ "str q3, [x27, #0x0]\n"
+ "zip2 v16.16b, v6.16b, v17.16b\n"
+ "str q1, [x27, #0x10]\n"
+ "zip1 v17.16b, v20.16b, v16.16b\n"
+ "str q0, [x27, #0x20]\n"
+ "zip2 v20.16b, v20.16b, v16.16b\n"
+ "str q19, [x27, #0x30]\n"
+ "zip1 v16.16b, v2.16b, v22.16b\n"
+ "str q18, [x27, #0x40]\n"
+ "zip1 v19.16b, v23.16b, v16.16b\n"
+ "str q17, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v18.16b, v23.16b, v16.16b\n"
+ "str q30, [x27, #0x0]\n"
+ "zip2 v17.16b, v11.16b, v5.16b\n"
+ "str q27, [x27, #0x10]\n"
+ "zip1 v16.16b, v10.16b, v17.16b\n"
+ "str q24, [x27, #0x20]\n"
+ "zip2 v17.16b, v10.16b, v17.16b\n"
+ "str q20, [x27, #0x30]\n"
+ "zip1 v20.16b, v9.16b, v31.16b\n"
+ "str q19, [x27, #0x40]\n"
+ "zip1 v19.16b, v8.16b, v20.16b\n"
+ "str q18, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v18.16b, v4.16b, v26.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v2.16b, v22.16b\n"
+ "str q17, [x27, #0x10]\n"
+ "zip1 v17.16b, v18.16b, v16.16b\n"
+ "str q19, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v16.16b\n"
+ "str q17, [x27, #0x30]\n"
+ "zip1 v19.16b, v29.16b, v25.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip1 v17.16b, v28.16b, v21.16b\n"
+ "zip1 v16.16b, v19.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v16.16b, v8.16b, v20.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v18.16b, v9.16b, v31.16b\n"
+ "zip2 v17.16b, v19.16b, v17.16b\n"
+ "zip1 v16.16b, v7.16b, v18.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v16.16b, v7.16b, v18.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v18.16b, v29.16b, v25.16b\n"
+ "str q17, [x27, #0x30]\n"
+ "zip2 v17.16b, v28.16b, v21.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr d19, [x28], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "ldr d18, [x26], #0x8\n"
+ "cmp x19, #0xc\n"
+ "ldr d17, [x25], #0x8\n"
+ "ldr d16, [x24], #0x8\n"
+ "ldr d24, [x23], #0x8\n"
+ "ld1 { v19.s }[2], [x28], #0x4\n"
+ "ld1 { v18.s }[2], [x26], #0x4\n"
+ "ld1 { v17.s }[2], [x25], #0x4\n"
+ "zip1 v23.16b, v19.16b, v17.16b\n"
+ "ld1 { v16.s }[2], [x24], #0x4\n"
+ "zip2 v20.16b, v19.16b, v17.16b\n"
+ "ld1 { v24.s }[2], [x23], #0x4\n"
+ "ldr d22, [x22], #0x8\n"
+ "zip1 v17.16b, v18.16b, v16.16b\n"
+ "ldr d19, [x21], #0x8\n"
+ "zip2 v16.16b, v18.16b, v16.16b\n"
+ "ld1 { v22.s }[2], [x22], #0x4\n"
+ "zip1 v18.16b, v23.16b, v17.16b\n"
+ "ldr d21, [x20], #0x8\n"
+ "zip2 v17.16b, v23.16b, v17.16b\n"
+ "ld1 { v19.s }[2], [x21], #0x4\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "ld1 { v21.s }[2], [x20], #0x4\n"
+ "zip1 v20.16b, v24.16b, v19.16b\n"
+ "str q18, [x27, #0x0]\n"
+ "zip2 v19.16b, v24.16b, v19.16b\n"
+ "str q17, [x27, #0x10]\n"
+ "str q16, [x27, #0x20]\n"
+ "zip1 v18.16b, v22.16b, v21.16b\n"
+ "zip2 v17.16b, v22.16b, v21.16b\n"
+ "zip1 v16.16b, v20.16b, v18.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v16.16b, v20.16b, v18.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip1 v16.16b, v19.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr s18, [x28], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s17, [x26], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x24], #0x4\n"
+ "ldr s20, [x23], #0x4\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "ldr s19, [x22], #0x4\n"
+ "ldr s17, [x21], #0x4\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x20], #0x4\n"
+ "zip1 v17.16b, v20.16b, v17.16b\n"
+ "str q18, [x27, #0x0]\n"
+ "zip1 v16.16b, v19.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "add x27, x27, #0x10\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr b18, [x28], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b17, [x26], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b16, [x25], #0x1\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr b16, [x24], #0x1\n"
+ "ldr b20, [x23], #0x1\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "ldr b19, [x22], #0x1\n"
+ "ldr b17, [x21], #0x1\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr b16, [x20], #0x1\n"
+ "zip1 v17.16b, v20.16b, v17.16b\n"
+ "str s18, [x27, #0x0]\n"
+ "zip1 v16.16b, v19.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str s16, [x27, #0x30]\n"
+ "add x27, x27, #0x4\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x60\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x30\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0x30\n"
+ "ldr q19, [x26], #0x10\n"
+ "cmp x19, #0x30\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v28.16b, v18.16b, v16.16b\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v27.16b, v18.16b, v16.16b\n"
+ "ldr q26, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v25.16b, v17.16b, v16.16b\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v24.16b, v17.16b, v16.16b\n"
+ "ldr q23, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v22.16b, v18.16b, v16.16b\n"
+ "ldr q17, [x24], #0x10\n"
+ "zip2 v21.16b, v18.16b, v16.16b\n"
+ "ldr q20, [x24], #0x10\n"
+ "zip1 v16.16b, v19.16b, v17.16b\n"
+ "zip2 v18.16b, v19.16b, v17.16b\n"
+ "ldr q19, [x24], #0x10\n"
+ "zip1 v17.16b, v28.16b, v16.16b\n"
+ "zip2 v16.16b, v28.16b, v16.16b\n"
+ "str q17, [x27, #0x0]\n"
+ "zip1 v17.16b, v27.16b, v18.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v16.16b, v27.16b, v18.16b\n"
+ "str q17, [x27, #0x20]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip1 v18.16b, v26.16b, v20.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v17.16b, v26.16b, v20.16b\n"
+ "zip1 v16.16b, v25.16b, v18.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v16.16b, v25.16b, v18.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip1 v16.16b, v24.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v24.16b, v17.16b\n"
+ "zip1 v17.16b, v23.16b, v19.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip1 v16.16b, v22.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v16.16b, v22.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v17.16b, v23.16b, v19.16b\n"
+ "zip1 v16.16b, v21.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v16.16b, v21.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr d18, [x28], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "ldr d21, [x26], #0x8\n"
+ "cmp x19, #0xc\n"
+ "ldr d17, [x25], #0x8\n"
+ "ldr d16, [x24], #0x8\n"
+ "ld1 { v18.s }[2], [x28], #0x4\n"
+ "ld1 { v21.s }[2], [x26], #0x4\n"
+ "ld1 { v17.s }[2], [x25], #0x4\n"
+ "zip1 v20.16b, v18.16b, v17.16b\n"
+ "ld1 { v16.s }[2], [x24], #0x4\n"
+ "zip2 v19.16b, v18.16b, v17.16b\n"
+ "zip1 v18.16b, v21.16b, v16.16b\n"
+ "zip2 v17.16b, v21.16b, v16.16b\n"
+ "zip1 v16.16b, v20.16b, v18.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v20.16b, v18.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip1 v16.16b, v19.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr s17, [x28], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s18, [x26], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr s16, [x24], #0x4\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "add x27, x27, #0x10\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr b17, [x28], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b18, [x26], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b16, [x25], #0x1\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr b16, [x24], #0x1\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str s16, [x27, #0x0]\n"
+ "add x27, x27, #0x4\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x30\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<12, 4, true, VLType::None>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<12, 4, true, VLType::None>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_1x8.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_1x8.hpp
new file mode 100644
index 0000000000..1603be2ef8
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_1x8.hpp
@@ -0,0 +1,335 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_12_1x8(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 8) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 12 * roundup<size_t>(height, 8) * sizeof(uint8_t);
+
+ __asm__ __volatile__(
+
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "cmp %x[height], #0x7\n"
+ "csel x20, x20, %x[pad_row], GT\n"
+ "csel x21, x21, %x[pad_row], GE\n"
+ "cmp %x[height], #0x5\n"
+ "csel x22, x22, %x[pad_row], GT\n"
+ "csel x23, x23, %x[pad_row], GE\n"
+ "cmp %x[height], #0x3\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x30\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0x30\n"
+ "ldr q19, [x26], #0x10\n"
+ "cmp x19, #0x30\n"
+ "ldr q11, [x25], #0x10\n"
+ "ldr q10, [x24], #0x10\n"
+ "ldr q16, [x23], #0x10\n"
+ "zip1 v22.16b, v18.16b, v16.16b\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v9.16b, v18.16b, v16.16b\n"
+ "ldr q8, [x26], #0x10\n"
+ "ldr q7, [x25], #0x10\n"
+ "ldr q6, [x24], #0x10\n"
+ "ldr q16, [x23], #0x10\n"
+ "zip1 v5.16b, v17.16b, v16.16b\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v4.16b, v17.16b, v16.16b\n"
+ "ldr q3, [x26], #0x10\n"
+ "ldr q2, [x25], #0x10\n"
+ "ldr q1, [x24], #0x10\n"
+ "ldr q17, [x23], #0x10\n"
+ "zip1 v0.16b, v18.16b, v17.16b\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip2 v31.16b, v18.16b, v17.16b\n"
+ "ldr q30, [x21], #0x10\n"
+ "ldr q29, [x20], #0x10\n"
+ "zip1 v28.16b, v19.16b, v16.16b\n"
+ "ldr q27, [x22], #0x10\n"
+ "zip2 v21.16b, v19.16b, v16.16b\n"
+ "ldr q26, [x21], #0x10\n"
+ "zip1 v16.16b, v11.16b, v30.16b\n"
+ "ldr q25, [x20], #0x10\n"
+ "zip1 v20.16b, v22.16b, v16.16b\n"
+ "ldr q24, [x22], #0x10\n"
+ "zip1 v19.16b, v10.16b, v29.16b\n"
+ "zip2 v18.16b, v22.16b, v16.16b\n"
+ "ldr q23, [x21], #0x10\n"
+ "zip1 v17.16b, v28.16b, v19.16b\n"
+ "ldr q22, [x20], #0x10\n"
+ "zip1 v16.16b, v20.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v20.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v17.16b, v28.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v20.16b, v11.16b, v30.16b\n"
+ "zip1 v18.16b, v9.16b, v20.16b\n"
+ "zip2 v19.16b, v10.16b, v29.16b\n"
+ "zip1 v17.16b, v21.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v18.16b, v9.16b, v20.16b\n"
+ "zip2 v17.16b, v21.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip1 v21.16b, v7.16b, v26.16b\n"
+ "zip1 v18.16b, v5.16b, v21.16b\n"
+ "zip1 v20.16b, v8.16b, v27.16b\n"
+ "zip1 v19.16b, v6.16b, v25.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v18.16b, v5.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v21.16b, v7.16b, v26.16b\n"
+ "zip2 v20.16b, v8.16b, v27.16b\n"
+ "zip1 v18.16b, v4.16b, v21.16b\n"
+ "zip2 v19.16b, v6.16b, v25.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v18.16b, v4.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip1 v21.16b, v2.16b, v23.16b\n"
+ "zip1 v18.16b, v0.16b, v21.16b\n"
+ "zip1 v20.16b, v3.16b, v24.16b\n"
+ "zip1 v19.16b, v1.16b, v22.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v18.16b, v0.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v21.16b, v2.16b, v23.16b\n"
+ "zip1 v18.16b, v31.16b, v21.16b\n"
+ "zip2 v20.16b, v3.16b, v24.16b\n"
+ "zip2 v19.16b, v1.16b, v22.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v18.16b, v31.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr d20, [x28], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "ldr d19, [x26], #0x8\n"
+ "cmp x19, #0xc\n"
+ "ldr d18, [x25], #0x8\n"
+ "ldr d27, [x24], #0x8\n"
+ "ldr d16, [x23], #0x8\n"
+ "ld1 { v20.s }[2], [x28], #0x4\n"
+ "ld1 { v19.s }[2], [x26], #0x4\n"
+ "ld1 { v18.s }[2], [x25], #0x4\n"
+ "ld1 { v27.s }[2], [x24], #0x4\n"
+ "ld1 { v16.s }[2], [x23], #0x4\n"
+ "zip1 v26.16b, v20.16b, v16.16b\n"
+ "ldr d17, [x22], #0x8\n"
+ "zip2 v25.16b, v20.16b, v16.16b\n"
+ "ldr d16, [x21], #0x8\n"
+ "ldr d24, [x20], #0x8\n"
+ "ld1 { v17.s }[2], [x22], #0x4\n"
+ "zip1 v23.16b, v19.16b, v17.16b\n"
+ "ld1 { v16.s }[2], [x21], #0x4\n"
+ "zip2 v22.16b, v19.16b, v17.16b\n"
+ "ld1 { v24.s }[2], [x20], #0x4\n"
+ "zip1 v21.16b, v18.16b, v16.16b\n"
+ "zip2 v20.16b, v18.16b, v16.16b\n"
+ "zip1 v18.16b, v26.16b, v21.16b\n"
+ "zip1 v19.16b, v27.16b, v24.16b\n"
+ "zip1 v17.16b, v23.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v18.16b, v26.16b, v21.16b\n"
+ "zip2 v17.16b, v23.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip1 v18.16b, v25.16b, v20.16b\n"
+ "zip2 v16.16b, v27.16b, v24.16b\n"
+ "zip1 v17.16b, v22.16b, v16.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr s17, [x28], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s21, [x26], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s18, [x25], #0x4\n"
+ "ldr s20, [x24], #0x4\n"
+ "ldr s16, [x23], #0x4\n"
+ "zip1 v19.16b, v17.16b, v16.16b\n"
+ "ldr s17, [x22], #0x4\n"
+ "ldr s16, [x21], #0x4\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x20], #0x4\n"
+ "zip1 v17.16b, v21.16b, v17.16b\n"
+ "zip1 v18.16b, v19.16b, v18.16b\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "add x27, x27, #0x20\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr b18, [x28], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b21, [x26], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b17, [x25], #0x1\n"
+ "ldr b20, [x24], #0x1\n"
+ "ldr b16, [x23], #0x1\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr b18, [x22], #0x1\n"
+ "ldr b16, [x21], #0x1\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr b16, [x20], #0x1\n"
+ "zip1 v18.16b, v21.16b, v18.16b\n"
+ "zip1 v17.16b, v19.16b, v17.16b\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str d16, [x27, #0x0]\n"
+ "add x27, x27, #0x8\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x60\n"
+ "cmp %x[height], #0x1\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<12, 8, true, VLType::None>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_1x8(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<12, 8, true, VLType::None>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_1x8(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x2.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x2.hpp
new file mode 100644
index 0000000000..78301353fd
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x2.hpp
@@ -0,0 +1,344 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_12_2x2(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 2) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 12 * roundup<size_t>(height, 2) * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x8\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q16, [x26], #0x10\n"
+ "zip1 v9.8h, v17.8h, v16.8h\n"
+ "ldr q19, [x28], #0x10\n"
+ "cmp x19, #0x18\n"
+ "zip2 v8.8h, v17.8h, v16.8h\n"
+ "ldr q16, [x26], #0x10\n"
+ "ldr q18, [x25], #0x10\n"
+ "zip1 v7.8h, v19.8h, v16.8h\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v6.8h, v19.8h, v16.8h\n"
+ "ldr q16, [x26], #0x10\n"
+ "ldr q20, [x25], #0x10\n"
+ "zip1 v5.8h, v17.8h, v16.8h\n"
+ "ldr q22, [x25], #0x10\n"
+ "zip2 v4.8h, v17.8h, v16.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "ldr q19, [x23], #0x10\n"
+ "zip1 v3.8h, v18.8h, v16.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "zip2 v2.8h, v18.8h, v16.8h\n"
+ "ldr q21, [x23], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "zip1 v1.8h, v20.8h, v17.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v0.8h, v20.8h, v17.8h\n"
+ "ldr q31, [x23], #0x10\n"
+ "zip1 v30.8h, v19.8h, v18.8h\n"
+ "ldr q17, [x22], #0x10\n"
+ "zip2 v29.8h, v19.8h, v18.8h\n"
+ "ldr q20, [x21], #0x10\n"
+ "ldr q19, [x20], #0x10\n"
+ "zip1 v28.8h, v22.8h, v16.8h\n"
+ "zip2 v27.8h, v22.8h, v16.8h\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v26.8h, v21.8h, v17.8h\n"
+ "zip2 v25.8h, v21.8h, v17.8h\n"
+ "ldr q18, [x21], #0x10\n"
+ "zip1 v24.8h, v20.8h, v19.8h\n"
+ "ldr q17, [x20], #0x10\n"
+ "zip2 v23.8h, v20.8h, v19.8h\n"
+ "ldr q22, [x21], #0x10\n"
+ "zip1 v21.8h, v31.8h, v16.8h\n"
+ "zip2 v20.8h, v31.8h, v16.8h\n"
+ "ldr q16, [x20], #0x10\n"
+ "zip1 v19.8h, v18.8h, v17.8h\n"
+ "str q9, [x27, #0x0]\n"
+ "zip2 v18.8h, v18.8h, v17.8h\n"
+ "str q8, [x27, #0x10]\n"
+ "str q7, [x27, #0x20]\n"
+ "zip1 v17.8h, v22.8h, v16.8h\n"
+ "str q3, [x27, #0x30]\n"
+ "zip2 v16.8h, v22.8h, v16.8h\n"
+ "str q2, [x27, #0x40]\n"
+ "str q1, [x27, #0x50]\n"
+ "str q30, [x27, #0x60]\n"
+ "str q29, [x27, #0x70]\n"
+ "str q26, [x27, #0x80]\n"
+ "str q24, [x27, #0x90]\n"
+ "str q23, [x27, #0xa0]\n"
+ "str q19, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "str q6, [x27, #0x0]\n"
+ "str q5, [x27, #0x10]\n"
+ "str q4, [x27, #0x20]\n"
+ "str q0, [x27, #0x30]\n"
+ "str q28, [x27, #0x40]\n"
+ "str q27, [x27, #0x50]\n"
+ "str q25, [x27, #0x60]\n"
+ "str q21, [x27, #0x70]\n"
+ "str q20, [x27, #0x80]\n"
+ "str q18, [x27, #0x90]\n"
+ "str q17, [x27, #0xa0]\n"
+ "str q16, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0xc\n"
+ "ldr q16, [x26], #0x10\n"
+ "zip1 v29.8h, v18.8h, v16.8h\n"
+ "ldr d17, [x28], #0x8\n"
+ "cmp x19, #0xc\n"
+ "zip2 v28.8h, v18.8h, v16.8h\n"
+ "ldr d16, [x26], #0x8\n"
+ "ldr q19, [x25], #0x10\n"
+ "zip1 v27.8h, v17.8h, v16.8h\n"
+ "ldr d18, [x25], #0x8\n"
+ "ldr q17, [x24], #0x10\n"
+ "zip1 v26.8h, v19.8h, v17.8h\n"
+ "ldr d16, [x24], #0x8\n"
+ "zip2 v25.8h, v19.8h, v17.8h\n"
+ "ldr q19, [x23], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "zip1 v24.8h, v18.8h, v16.8h\n"
+ "ldr q18, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "zip1 v23.8h, v19.8h, v17.8h\n"
+ "zip2 v22.8h, v19.8h, v17.8h\n"
+ "ldr d21, [x23], #0x8\n"
+ "ldr d17, [x22], #0x8\n"
+ "zip1 v20.8h, v18.8h, v16.8h\n"
+ "ldr d19, [x21], #0x8\n"
+ "zip2 v18.8h, v18.8h, v16.8h\n"
+ "ldr d16, [x20], #0x8\n"
+ "str q29, [x27, #0x0]\n"
+ "zip1 v17.8h, v21.8h, v17.8h\n"
+ "str q28, [x27, #0x10]\n"
+ "zip1 v16.8h, v19.8h, v16.8h\n"
+ "str q27, [x27, #0x20]\n"
+ "str q26, [x27, #0x30]\n"
+ "str q25, [x27, #0x40]\n"
+ "str q24, [x27, #0x50]\n"
+ "str q23, [x27, #0x60]\n"
+ "str q22, [x27, #0x70]\n"
+ "str q17, [x27, #0x80]\n"
+ "str q20, [x27, #0x90]\n"
+ "str q18, [x27, #0xa0]\n"
+ "str q16, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr d17, [x28], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d16, [x26], #0x8\n"
+ "zip1 v20.8h, v17.8h, v16.8h\n"
+ "ldr d17, [x25], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d16, [x24], #0x8\n"
+ "zip1 v19.8h, v17.8h, v16.8h\n"
+ "ldr d17, [x23], #0x8\n"
+ "ldr d16, [x22], #0x8\n"
+ "zip1 v18.8h, v17.8h, v16.8h\n"
+ "ldr d17, [x21], #0x8\n"
+ "ldr d16, [x20], #0x8\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str q20, [x27, #0x0]\n"
+ "str q19, [x27, #0x30]\n"
+ "str q18, [x27, #0x60]\n"
+ "str q16, [x27, #0x90]\n"
+ "add x27, x27, #0x10\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr h17, [x28], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h16, [x26], #0x2\n"
+ "zip1 v20.8h, v17.8h, v16.8h\n"
+ "ldr h17, [x25], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h16, [x24], #0x2\n"
+ "zip1 v19.8h, v17.8h, v16.8h\n"
+ "ldr h17, [x23], #0x2\n"
+ "ldr h16, [x22], #0x2\n"
+ "zip1 v18.8h, v17.8h, v16.8h\n"
+ "ldr h17, [x21], #0x2\n"
+ "ldr h16, [x20], #0x2\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str s20, [x27, #0x0]\n"
+ "str s19, [x27, #0x30]\n"
+ "str s18, [x27, #0x60]\n"
+ "str s16, [x27, #0x90]\n"
+ "add x27, x27, #0x4\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0xc0\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add %x[in], x26, %x[in_stride]\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x2\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q16, [x26], #0x10\n"
+ "zip1 v22.8h, v17.8h, v16.8h\n"
+ "ldr q18, [x28], #0x10\n"
+ "cmp x19, #0x18\n"
+ "zip2 v21.8h, v17.8h, v16.8h\n"
+ "ldr q17, [x26], #0x10\n"
+ "ldr q20, [x28], #0x10\n"
+ "zip1 v19.8h, v18.8h, v17.8h\n"
+ "ldr q16, [x26], #0x10\n"
+ "zip2 v18.8h, v18.8h, v17.8h\n"
+ "str q22, [x27, #0x0]\n"
+ "str q21, [x27, #0x10]\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "str q19, [x27, #0x20]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v16.8h, v20.8h, v16.8h\n"
+ "str q18, [x27, #0x0]\n"
+ "str q17, [x27, #0x10]\n"
+ "str q16, [x27, #0x20]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0xc\n"
+ "ldr q16, [x26], #0x10\n"
+ "zip1 v19.8h, v17.8h, v16.8h\n"
+ "ldr d18, [x28], #0x8\n"
+ "cmp x19, #0xc\n"
+ "zip2 v17.8h, v17.8h, v16.8h\n"
+ "ldr d16, [x26], #0x8\n"
+ "str q19, [x27, #0x0]\n"
+ "zip1 v16.8h, v18.8h, v16.8h\n"
+ "str q17, [x27, #0x10]\n"
+ "str q16, [x27, #0x20]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr d17, [x28], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d16, [x26], #0x8\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "add x27, x27, #0x10\n"
+ "cmp x19, #0x4\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr h17, [x28], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h16, [x26], #0x2\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str s16, [x27, #0x0]\n"
+ "add x27, x27, #0x4\n"
+ "cmp x19, #0x1\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x30\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<12, 2, true, VLType::None>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_2x2(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x4.hpp
new file mode 100644
index 0000000000..7e8ca6648d
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x4.hpp
@@ -0,0 +1,445 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_12_2x4(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 12 * roundup<size_t>(height, 4) * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x8\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q23, [x26], #0x10\n"
+ "cmp x19, #0x18\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v22.8h, v18.8h, v16.8h\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v21.8h, v18.8h, v16.8h\n"
+ "ldr q12, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v20.8h, v17.8h, v16.8h\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v11.8h, v17.8h, v16.8h\n"
+ "ldr q10, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v9.8h, v18.8h, v17.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v8.8h, v18.8h, v17.8h\n"
+ "ldr q19, [x23], #0x10\n"
+ "ldr q7, [x22], #0x10\n"
+ "zip1 v17.8h, v23.8h, v16.8h\n"
+ "ldr q6, [x24], #0x10\n"
+ "zip2 v16.8h, v23.8h, v16.8h\n"
+ "ldr q5, [x23], #0x10\n"
+ "zip1 v4.8h, v22.8h, v17.8h\n"
+ "ldr q3, [x22], #0x10\n"
+ "zip2 v2.8h, v22.8h, v17.8h\n"
+ "ldr q18, [x21], #0x10\n"
+ "zip1 v1.8h, v21.8h, v16.8h\n"
+ "ldr q0, [x24], #0x10\n"
+ "zip2 v31.8h, v21.8h, v16.8h\n"
+ "ldr q30, [x23], #0x10\n"
+ "zip1 v16.8h, v12.8h, v6.8h\n"
+ "ldr q29, [x22], #0x10\n"
+ "zip1 v28.8h, v20.8h, v16.8h\n"
+ "ldr q27, [x21], #0x10\n"
+ "zip2 v26.8h, v20.8h, v16.8h\n"
+ "ldr q21, [x20], #0x10\n"
+ "zip1 v17.8h, v19.8h, v18.8h\n"
+ "ldr q25, [x21], #0x10\n"
+ "zip2 v19.8h, v19.8h, v18.8h\n"
+ "zip1 v18.8h, v5.8h, v27.8h\n"
+ "ldr q24, [x20], #0x10\n"
+ "zip1 v16.8h, v7.8h, v21.8h\n"
+ "ldr q23, [x20], #0x10\n"
+ "zip1 v22.8h, v17.8h, v16.8h\n"
+ "zip2 v20.8h, v17.8h, v16.8h\n"
+ "str q4, [x27, #0x0]\n"
+ "zip2 v16.8h, v7.8h, v21.8h\n"
+ "str q2, [x27, #0x10]\n"
+ "zip1 v17.8h, v19.8h, v16.8h\n"
+ "str q1, [x27, #0x20]\n"
+ "zip2 v21.8h, v19.8h, v16.8h\n"
+ "str q31, [x27, #0x30]\n"
+ "zip1 v16.8h, v3.8h, v24.8h\n"
+ "str q28, [x27, #0x40]\n"
+ "zip1 v19.8h, v18.8h, v16.8h\n"
+ "str q26, [x27, #0x50]\n"
+ "zip2 v18.8h, v18.8h, v16.8h\n"
+ "str q22, [x27, #0x60]\n"
+ "zip2 v16.8h, v12.8h, v6.8h\n"
+ "str q20, [x27, #0x70]\n"
+ "zip1 v20.8h, v11.8h, v16.8h\n"
+ "str q17, [x27, #0x80]\n"
+ "zip2 v17.8h, v11.8h, v16.8h\n"
+ "str q21, [x27, #0x90]\n"
+ "zip1 v16.8h, v10.8h, v0.8h\n"
+ "str q19, [x27, #0xa0]\n"
+ "zip1 v19.8h, v9.8h, v16.8h\n"
+ "str q18, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v18.8h, v9.8h, v16.8h\n"
+ "str q20, [x27, #0x0]\n"
+ "zip2 v16.8h, v10.8h, v0.8h\n"
+ "str q17, [x27, #0x10]\n"
+ "zip1 v17.8h, v8.8h, v16.8h\n"
+ "str q19, [x27, #0x20]\n"
+ "zip2 v16.8h, v8.8h, v16.8h\n"
+ "str q18, [x27, #0x30]\n"
+ "zip2 v18.8h, v5.8h, v27.8h\n"
+ "str q17, [x27, #0x40]\n"
+ "zip2 v17.8h, v3.8h, v24.8h\n"
+ "str q16, [x27, #0x50]\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x60]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x70]\n"
+ "zip1 v18.8h, v30.8h, v25.8h\n"
+ "zip1 v17.8h, v29.8h, v23.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x80]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x90]\n"
+ "zip2 v18.8h, v30.8h, v25.8h\n"
+ "zip2 v17.8h, v29.8h, v23.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xa0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0xc\n"
+ "ldr q20, [x26], #0x10\n"
+ "cmp x19, #0xc\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.8h, v18.8h, v16.8h\n"
+ "ldr d17, [x28], #0x8\n"
+ "zip2 v23.8h, v18.8h, v16.8h\n"
+ "ldr d22, [x26], #0x8\n"
+ "ldr d16, [x25], #0x8\n"
+ "zip1 v21.8h, v17.8h, v16.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "ldr q31, [x23], #0x10\n"
+ "zip1 v18.8h, v20.8h, v16.8h\n"
+ "ldr d17, [x24], #0x8\n"
+ "zip2 v16.8h, v20.8h, v16.8h\n"
+ "ldr d30, [x23], #0x8\n"
+ "zip1 v29.8h, v19.8h, v18.8h\n"
+ "ldr q28, [x22], #0x10\n"
+ "zip2 v20.8h, v19.8h, v18.8h\n"
+ "ldr q27, [x21], #0x10\n"
+ "zip1 v19.8h, v23.8h, v16.8h\n"
+ "ldr q26, [x20], #0x10\n"
+ "zip2 v18.8h, v23.8h, v16.8h\n"
+ "ldr d25, [x22], #0x8\n"
+ "zip1 v16.8h, v22.8h, v17.8h\n"
+ "zip1 v24.8h, v21.8h, v16.8h\n"
+ "ldr d23, [x21], #0x8\n"
+ "zip2 v22.8h, v21.8h, v16.8h\n"
+ "ldr d21, [x20], #0x8\n"
+ "zip1 v17.8h, v31.8h, v27.8h\n"
+ "str q29, [x27, #0x0]\n"
+ "zip1 v16.8h, v28.8h, v26.8h\n"
+ "str q20, [x27, #0x10]\n"
+ "zip1 v20.8h, v17.8h, v16.8h\n"
+ "str q19, [x27, #0x20]\n"
+ "zip2 v19.8h, v17.8h, v16.8h\n"
+ "str q18, [x27, #0x30]\n"
+ "zip2 v18.8h, v31.8h, v27.8h\n"
+ "str q24, [x27, #0x40]\n"
+ "zip2 v16.8h, v28.8h, v26.8h\n"
+ "str q22, [x27, #0x50]\n"
+ "zip1 v17.8h, v18.8h, v16.8h\n"
+ "str q20, [x27, #0x60]\n"
+ "zip2 v16.8h, v18.8h, v16.8h\n"
+ "str q19, [x27, #0x70]\n"
+ "zip1 v18.8h, v30.8h, v23.8h\n"
+ "str q17, [x27, #0x80]\n"
+ "zip1 v17.8h, v25.8h, v21.8h\n"
+ "str q16, [x27, #0x90]\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xa0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr d17, [x28], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d18, [x26], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d16, [x25], #0x8\n"
+ "zip1 v17.8h, v17.8h, v16.8h\n"
+ "ldr d16, [x24], #0x8\n"
+ "ldr d21, [x23], #0x8\n"
+ "zip1 v16.8h, v18.8h, v16.8h\n"
+ "ldr d20, [x22], #0x8\n"
+ "ldr d19, [x21], #0x8\n"
+ "zip1 v18.8h, v17.8h, v16.8h\n"
+ "zip2 v17.8h, v17.8h, v16.8h\n"
+ "ldr d16, [x20], #0x8\n"
+ "str q18, [x27, #0x0]\n"
+ "zip1 v18.8h, v21.8h, v19.8h\n"
+ "str q17, [x27, #0x10]\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x60]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x70]\n"
+ "add x27, x27, #0x20\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr h18, [x28], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h17, [x26], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h16, [x25], #0x2\n"
+ "zip1 v18.8h, v18.8h, v16.8h\n"
+ "ldr h16, [x24], #0x2\n"
+ "ldr h20, [x23], #0x2\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "ldr h19, [x22], #0x2\n"
+ "ldr h17, [x21], #0x2\n"
+ "zip1 v18.8h, v18.8h, v16.8h\n"
+ "ldr h16, [x20], #0x2\n"
+ "zip1 v17.8h, v20.8h, v17.8h\n"
+ "str d18, [x27, #0x0]\n"
+ "zip1 v16.8h, v19.8h, v16.8h\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str d16, [x27, #0x60]\n"
+ "add x27, x27, #0x8\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0xc0\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q19, [x26], #0x10\n"
+ "cmp x19, #0x18\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v28.8h, v18.8h, v16.8h\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v27.8h, v18.8h, v16.8h\n"
+ "ldr q26, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v25.8h, v17.8h, v16.8h\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v24.8h, v17.8h, v16.8h\n"
+ "ldr q23, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v22.8h, v18.8h, v16.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "zip2 v21.8h, v18.8h, v16.8h\n"
+ "ldr q20, [x24], #0x10\n"
+ "zip1 v16.8h, v19.8h, v17.8h\n"
+ "zip2 v18.8h, v19.8h, v17.8h\n"
+ "ldr q19, [x24], #0x10\n"
+ "zip1 v17.8h, v28.8h, v16.8h\n"
+ "zip2 v16.8h, v28.8h, v16.8h\n"
+ "str q17, [x27, #0x0]\n"
+ "zip1 v17.8h, v27.8h, v18.8h\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v16.8h, v27.8h, v18.8h\n"
+ "str q17, [x27, #0x20]\n"
+ "zip1 v17.8h, v26.8h, v20.8h\n"
+ "str q16, [x27, #0x30]\n"
+ "zip1 v16.8h, v25.8h, v17.8h\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.8h, v25.8h, v17.8h\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v18.8h, v26.8h, v20.8h\n"
+ "zip1 v17.8h, v23.8h, v19.8h\n"
+ "zip1 v16.8h, v24.8h, v18.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.8h, v24.8h, v18.8h\n"
+ "str q16, [x27, #0x10]\n"
+ "zip1 v16.8h, v22.8h, v17.8h\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.8h, v22.8h, v17.8h\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v17.8h, v23.8h, v19.8h\n"
+ "zip1 v16.8h, v21.8h, v17.8h\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.8h, v21.8h, v17.8h\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0xc\n"
+ "ldr q24, [x26], #0x10\n"
+ "cmp x19, #0xc\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v23.8h, v18.8h, v16.8h\n"
+ "ldr d17, [x28], #0x8\n"
+ "zip2 v22.8h, v18.8h, v16.8h\n"
+ "ldr d21, [x26], #0x8\n"
+ "ldr d16, [x25], #0x8\n"
+ "zip1 v20.8h, v17.8h, v16.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip1 v19.8h, v24.8h, v16.8h\n"
+ "ldr d18, [x24], #0x8\n"
+ "zip2 v17.8h, v24.8h, v16.8h\n"
+ "zip1 v16.8h, v23.8h, v19.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.8h, v23.8h, v19.8h\n"
+ "str q16, [x27, #0x10]\n"
+ "zip1 v16.8h, v22.8h, v17.8h\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.8h, v22.8h, v17.8h\n"
+ "str q16, [x27, #0x30]\n"
+ "zip1 v17.8h, v21.8h, v18.8h\n"
+ "zip1 v16.8h, v20.8h, v17.8h\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.8h, v20.8h, v17.8h\n"
+ "str q16, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr d18, [x28], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d17, [x26], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d16, [x25], #0x8\n"
+ "zip1 v18.8h, v18.8h, v16.8h\n"
+ "ldr d16, [x24], #0x8\n"
+ "zip1 v17.8h, v17.8h, v16.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x10]\n"
+ "add x27, x27, #0x20\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr h17, [x28], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h18, [x26], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h16, [x25], #0x2\n"
+ "zip1 v17.8h, v17.8h, v16.8h\n"
+ "ldr h16, [x24], #0x2\n"
+ "zip1 v16.8h, v18.8h, v16.8h\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str d16, [x27, #0x0]\n"
+ "add x27, x27, #0x8\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x60\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<12, 4, true, VLType::None>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_2x4(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x4_fp32bf16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x4_fp32bf16.hpp
new file mode 100644
index 0000000000..efb1c742ed
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_2x4_fp32bf16.hpp
@@ -0,0 +1,735 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_12_2x4_fp32bf16(bfloat16 *out, const float *in, size_t width, size_t in_stride, size_t height)
+{
+ float *pad_row = reinterpret_cast<float *>(alloca(width * sizeof(float)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(float));
+ }
+
+ size_t out_stride = 12 * roundup<size_t>(height, 4) * sizeof(bfloat16);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x8\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q12, [x28], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q20, [x26], #0x10\n"
+ "cmp x19, #0x18\n"
+ "ldr q11, [x25], #0x10\n"
+ "zip1 v29.4s, v12.4s, v11.4s\n"
+ "ldr q5, [x28], #0x10\n"
+ "zip2 v0.4s, v12.4s, v11.4s\n"
+ "ldr q28, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v23.4s, v5.4s, v17.4s\n"
+ "ldr q25, [x28], #0x10\n"
+ "zip2 v18.4s, v5.4s, v17.4s\n"
+ "ldr q6, [x26], #0x10\n"
+ "ldr q31, [x25], #0x10\n"
+ "zip1 v21.4s, v25.4s, v31.4s\n"
+ "ldr q16, [x28], #0x10\n"
+ "zip2 v10.4s, v25.4s, v31.4s\n"
+ "ldr q11, [x26], #0x10\n"
+ "ldr q1, [x25], #0x10\n"
+ "zip1 v13.4s, v16.4s, v1.4s\n"
+ "ldr q14, [x28], #0x10\n"
+ "zip2 v24.4s, v16.4s, v1.4s\n"
+ "ldr q4, [x26], #0x10\n"
+ "ldr q22, [x25], #0x10\n"
+ "zip1 v1.4s, v14.4s, v22.4s\n"
+ "ldr q15, [x28], #0x10\n"
+ "zip2 v8.4s, v14.4s, v22.4s\n"
+ "ldr q31, [x26], #0x10\n"
+ "ldr q3, [x25], #0x10\n"
+ "zip1 v27.4s, v15.4s, v3.4s\n"
+ "ldr q30, [x24], #0x10\n"
+ "zip2 v22.4s, v15.4s, v3.4s\n"
+ "ldr q15, [x23], #0x10\n"
+ "ldr q5, [x22], #0x10\n"
+ "zip1 v16.4s, v20.4s, v30.4s\n"
+ "ldr q3, [x24], #0x10\n"
+ "zip2 v7.4s, v20.4s, v30.4s\n"
+ "ldr q26, [x23], #0x10\n"
+ "zip1 v12.4s, v29.4s, v16.4s\n"
+ "ldr q25, [x22], #0x10\n"
+ ".inst 0x0ea16994 // bfcvtn v20.4h, v12.4s\n"
+ "ldr q2, [x21], #0x10\n"
+ "zip2 v16.4s, v29.4s, v16.4s\n"
+ "ldr q19, [x24], #0x10\n"
+ "zip1 v12.4s, v0.4s, v7.4s\n"
+ "ldr q9, [x23], #0x10\n"
+ ".inst 0x4ea16a14 // bfcvtn2 v20.8h, v16.4s\n"
+ "ldr q14, [x22], #0x10\n"
+ ".inst 0x0ea1699e // bfcvtn v30.4h, v12.4s\n"
+ "ldr q12, [x21], #0x10\n"
+ "zip2 v16.4s, v0.4s, v7.4s\n"
+ "ldr q7, [x24], #0x10\n"
+ "zip1 v29.4s, v28.4s, v3.4s\n"
+ "ldr q0, [x23], #0x10\n"
+ ".inst 0x4ea16a1e // bfcvtn2 v30.8h, v16.4s\n"
+ "ldr q17, [x22], #0x10\n"
+ "zip1 v16.4s, v23.4s, v29.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v23.4s, v23.4s, v29.4s\n"
+ "ldr q29, [x24], #0x10\n"
+ "zip2 v28.4s, v28.4s, v3.4s\n"
+ "ldr q3, [x23], #0x10\n"
+ ".inst 0x4ea16af0 // bfcvtn2 v16.8h, v23.4s\n"
+ "zip1 v23.4s, v18.4s, v28.4s\n"
+ ".inst 0x0ea16af7 // bfcvtn v23.4h, v23.4s\n"
+ "zip2 v28.4s, v18.4s, v28.4s\n"
+ "ldr q18, [x24], #0x10\n"
+ ".inst 0x4ea16b97 // bfcvtn2 v23.8h, v28.4s\n"
+ "zip1 v28.4s, v6.4s, v19.4s\n"
+ "zip2 v6.4s, v6.4s, v19.4s\n"
+ "zip1 v19.4s, v21.4s, v28.4s\n"
+ ".inst 0x0ea16a73 // bfcvtn v19.4h, v19.4s\n"
+ "zip2 v28.4s, v21.4s, v28.4s\n"
+ "ldr q21, [x23], #0x10\n"
+ ".inst 0x4ea16b93 // bfcvtn2 v19.8h, v28.4s\n"
+ "zip1 v28.4s, v10.4s, v6.4s\n"
+ ".inst 0x0ea16b9c // bfcvtn v28.4h, v28.4s\n"
+ "zip2 v6.4s, v10.4s, v6.4s\n"
+ "ldr q10, [x22], #0x10\n"
+ ".inst 0x4ea168dc // bfcvtn2 v28.8h, v6.4s\n"
+ "zip1 v6.4s, v11.4s, v7.4s\n"
+ "zip2 v7.4s, v11.4s, v7.4s\n"
+ "zip1 v11.4s, v13.4s, v6.4s\n"
+ ".inst 0x0ea1696b // bfcvtn v11.4h, v11.4s\n"
+ "zip2 v13.4s, v13.4s, v6.4s\n"
+ "ldr q6, [x22], #0x10\n"
+ ".inst 0x4ea169ab // bfcvtn2 v11.8h, v13.4s\n"
+ "zip1 v13.4s, v24.4s, v7.4s\n"
+ ".inst 0x0ea169ad // bfcvtn v13.4h, v13.4s\n"
+ "zip2 v7.4s, v24.4s, v7.4s\n"
+ "ldr q24, [x21], #0x10\n"
+ ".inst 0x4ea168ed // bfcvtn2 v13.8h, v7.4s\n"
+ "zip1 v7.4s, v4.4s, v29.4s\n"
+ "zip2 v29.4s, v4.4s, v29.4s\n"
+ "zip1 v4.4s, v1.4s, v7.4s\n"
+ ".inst 0x0ea16884 // bfcvtn v4.4h, v4.4s\n"
+ "zip2 v7.4s, v1.4s, v7.4s\n"
+ "ldr q1, [x21], #0x10\n"
+ ".inst 0x4ea168e4 // bfcvtn2 v4.8h, v7.4s\n"
+ "zip1 v7.4s, v8.4s, v29.4s\n"
+ ".inst 0x0ea168e7 // bfcvtn v7.4h, v7.4s\n"
+ "zip2 v8.4s, v8.4s, v29.4s\n"
+ "ldr q29, [x21], #0x10\n"
+ ".inst 0x4ea16907 // bfcvtn2 v7.8h, v8.4s\n"
+ "zip1 v8.4s, v31.4s, v18.4s\n"
+ "zip2 v31.4s, v31.4s, v18.4s\n"
+ "zip1 v18.4s, v27.4s, v8.4s\n"
+ ".inst 0x0ea16a52 // bfcvtn v18.4h, v18.4s\n"
+ "zip2 v27.4s, v27.4s, v8.4s\n"
+ "ldr q8, [x21], #0x10\n"
+ ".inst 0x4ea16b72 // bfcvtn2 v18.8h, v27.4s\n"
+ "zip1 v27.4s, v22.4s, v31.4s\n"
+ ".inst 0x0ea16b7b // bfcvtn v27.4h, v27.4s\n"
+ "zip2 v31.4s, v22.4s, v31.4s\n"
+ "ldr q22, [x20], #0x10\n"
+ ".inst 0x4ea16bfb // bfcvtn2 v27.8h, v31.4s\n"
+ "zip1 v31.4s, v15.4s, v2.4s\n"
+ "zip2 v2.4s, v15.4s, v2.4s\n"
+ "zip1 v15.4s, v26.4s, v12.4s\n"
+ "zip2 v26.4s, v26.4s, v12.4s\n"
+ "zip1 v12.4s, v5.4s, v22.4s\n"
+ "zip2 v22.4s, v5.4s, v22.4s\n"
+ "zip1 v5.4s, v31.4s, v12.4s\n"
+ ".inst 0x0ea168a5 // bfcvtn v5.4h, v5.4s\n"
+ "zip2 v31.4s, v31.4s, v12.4s\n"
+ "ldr q12, [x20], #0x10\n"
+ ".inst 0x4ea16be5 // bfcvtn2 v5.8h, v31.4s\n"
+ "zip1 v31.4s, v2.4s, v22.4s\n"
+ ".inst 0x0ea16bff // bfcvtn v31.4h, v31.4s\n"
+ "zip2 v2.4s, v2.4s, v22.4s\n"
+ "ldr q22, [x20], #0x10\n"
+ ".inst 0x4ea1685f // bfcvtn2 v31.8h, v2.4s\n"
+ "zip1 v2.4s, v25.4s, v12.4s\n"
+ "zip2 v25.4s, v25.4s, v12.4s\n"
+ "zip1 v12.4s, v15.4s, v2.4s\n"
+ ".inst 0x0ea1698c // bfcvtn v12.4h, v12.4s\n"
+ "zip2 v15.4s, v15.4s, v2.4s\n"
+ "ldr q2, [x20], #0x10\n"
+ ".inst 0x4ea169ec // bfcvtn2 v12.8h, v15.4s\n"
+ "zip1 v15.4s, v26.4s, v25.4s\n"
+ ".inst 0x0ea169ef // bfcvtn v15.4h, v15.4s\n"
+ "zip2 v25.4s, v26.4s, v25.4s\n"
+ "ldr q26, [x20], #0x10\n"
+ ".inst 0x4ea16b2f // bfcvtn2 v15.8h, v25.4s\n"
+ "ldr q25, [x20], #0x10\n"
+ "str q20, [x27, #0x0]\n"
+ "zip1 v20.4s, v9.4s, v24.4s\n"
+ "zip2 v24.4s, v9.4s, v24.4s\n"
+ "str q30, [x27, #0x10]\n"
+ "zip1 v9.4s, v14.4s, v22.4s\n"
+ "str q16, [x27, #0x20]\n"
+ "zip1 v16.4s, v20.4s, v9.4s\n"
+ "str q23, [x27, #0x30]\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "str q19, [x27, #0x40]\n"
+ "zip2 v9.4s, v20.4s, v9.4s\n"
+ "str q28, [x27, #0x50]\n"
+ "zip2 v22.4s, v14.4s, v22.4s\n"
+ "str q5, [x27, #0x60]\n"
+ ".inst 0x4ea16930 // bfcvtn2 v16.8h, v9.4s\n"
+ "str q31, [x27, #0x70]\n"
+ "zip1 v19.4s, v24.4s, v22.4s\n"
+ "str q12, [x27, #0x80]\n"
+ ".inst 0x0ea16a6c // bfcvtn v12.4h, v19.4s\n"
+ "str q15, [x27, #0x90]\n"
+ "zip2 v9.4s, v24.4s, v22.4s\n"
+ "str q16, [x27, #0xa0]\n"
+ "zip1 v15.4s, v0.4s, v1.4s\n"
+ ".inst 0x4ea1692c // bfcvtn2 v12.8h, v9.4s\n"
+ "str q12, [x27, #0xb0]\n"
+ "zip1 v20.4s, v17.4s, v2.4s\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip1 v16.4s, v15.4s, v20.4s\n"
+ "str q11, [x27, #0x0]\n"
+ "zip2 v9.4s, v15.4s, v20.4s\n"
+ "str q13, [x27, #0x10]\n"
+ ".inst 0x0ea16a0f // bfcvtn v15.4h, v16.4s\n"
+ "str q4, [x27, #0x20]\n"
+ "zip2 v14.4s, v0.4s, v1.4s\n"
+ "str q7, [x27, #0x30]\n"
+ "zip2 v31.4s, v17.4s, v2.4s\n"
+ "str q18, [x27, #0x40]\n"
+ ".inst 0x4ea1692f // bfcvtn2 v15.8h, v9.4s\n"
+ "str q27, [x27, #0x50]\n"
+ "zip1 v22.4s, v14.4s, v31.4s\n"
+ "str q15, [x27, #0x60]\n"
+ ".inst 0x0ea16ac9 // bfcvtn v9.4h, v22.4s\n"
+ "zip2 v11.4s, v14.4s, v31.4s\n"
+ "zip1 v18.4s, v3.4s, v29.4s\n"
+ "zip1 v27.4s, v10.4s, v26.4s\n"
+ ".inst 0x4ea16969 // bfcvtn2 v9.8h, v11.4s\n"
+ "str q9, [x27, #0x70]\n"
+ "zip1 v13.4s, v18.4s, v27.4s\n"
+ "zip2 v9.4s, v18.4s, v27.4s\n"
+ ".inst 0x0ea169b3 // bfcvtn v19.4h, v13.4s\n"
+ "zip2 v18.4s, v3.4s, v29.4s\n"
+ "zip2 v1.4s, v10.4s, v26.4s\n"
+ ".inst 0x4ea16933 // bfcvtn2 v19.8h, v9.4s\n"
+ "str q19, [x27, #0x80]\n"
+ "zip1 v16.4s, v18.4s, v1.4s\n"
+ "zip2 v20.4s, v18.4s, v1.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v21.4s, v8.4s\n"
+ "zip1 v2.4s, v6.4s, v25.4s\n"
+ ".inst 0x4ea16a90 // bfcvtn2 v16.8h, v20.4s\n"
+ "str q16, [x27, #0x90]\n"
+ "zip1 v16.4s, v18.4s, v2.4s\n"
+ "zip2 v20.4s, v18.4s, v2.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v21.4s, v8.4s\n"
+ "zip2 v17.4s, v6.4s, v25.4s\n"
+ ".inst 0x4ea16a90 // bfcvtn2 v16.8h, v20.4s\n"
+ "str q16, [x27, #0xa0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v17.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ ".inst 0x4ea16a30 // bfcvtn2 v16.8h, v17.4s\n"
+ "str q16, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0xc\n"
+ "ldr q21, [x26], #0x10\n"
+ "cmp x19, #0xc\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v20.4s, v18.4s, v16.4s\n"
+ "ldr q8, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v7.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v6.4s, v17.4s, v16.4s\n"
+ "ldr q5, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v4.4s, v18.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v3.4s, v18.4s, v17.4s\n"
+ "ldr q2, [x23], #0x10\n"
+ "ldr q1, [x22], #0x10\n"
+ "zip1 v17.4s, v21.4s, v16.4s\n"
+ "ldr q0, [x24], #0x10\n"
+ "zip2 v18.4s, v21.4s, v16.4s\n"
+ "ldr q31, [x23], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ "ldr q30, [x22], #0x10\n"
+ ".inst 0x0ea16a1d // bfcvtn v29.4h, v16.4s\n"
+ "ldr q28, [x21], #0x10\n"
+ "zip2 v17.4s, v19.4s, v17.4s\n"
+ "ldr q27, [x24], #0x10\n"
+ "zip1 v16.4s, v20.4s, v18.4s\n"
+ "ldr q26, [x23], #0x10\n"
+ ".inst 0x4ea16a3d // bfcvtn2 v29.8h, v17.4s\n"
+ "ldr q25, [x22], #0x10\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "ldr q24, [x21], #0x10\n"
+ "zip2 v16.4s, v20.4s, v18.4s\n"
+ "ldr q23, [x20], #0x10\n"
+ "zip1 v17.4s, v8.4s, v0.4s\n"
+ "ldr q22, [x21], #0x10\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "zip1 v16.4s, v7.4s, v17.4s\n"
+ "ldr q21, [x20], #0x10\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "ldr q20, [x20], #0x10\n"
+ "zip2 v16.4s, v7.4s, v17.4s\n"
+ "zip2 v17.4s, v8.4s, v0.4s\n"
+ "str q29, [x27, #0x0]\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "str q19, [x27, #0x10]\n"
+ "zip1 v16.4s, v6.4s, v17.4s\n"
+ "str q18, [x27, #0x20]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v6.4s, v17.4s\n"
+ "zip1 v17.4s, v5.4s, v27.4s\n"
+ "zip1 v16.4s, v4.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x30]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v4.4s, v17.4s\n"
+ "zip2 v17.4s, v5.4s, v27.4s\n"
+ "zip1 v16.4s, v3.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x40]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v16.4s, v3.4s, v17.4s\n"
+ "zip1 v18.4s, v2.4s, v28.4s\n"
+ "zip1 v17.4s, v1.4s, v23.4s\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "str q19, [x27, #0x50]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v2.4s, v28.4s\n"
+ "zip2 v17.4s, v1.4s, v23.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x60]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v31.4s, v24.4s\n"
+ "zip1 v17.4s, v30.4s, v21.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x70]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v31.4s, v24.4s\n"
+ "zip2 v17.4s, v30.4s, v21.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x80]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v26.4s, v22.4s\n"
+ "zip1 v17.4s, v25.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x90]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v26.4s, v22.4s\n"
+ "zip2 v17.4s, v25.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xa0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v17.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ ".inst 0x4ea16a30 // bfcvtn2 v16.8h, v17.4s\n"
+ "str q16, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr q20, [x28], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x26], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v19.4s, v20.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v25.4s, v20.4s, v17.4s\n"
+ "ldr q24, [x23], #0x10\n"
+ "ldr q23, [x22], #0x10\n"
+ "zip1 v17.4s, v18.4s, v16.4s\n"
+ "ldr q22, [x21], #0x10\n"
+ "zip2 v21.4s, v18.4s, v16.4s\n"
+ "ldr q20, [x20], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v19.4s, v17.4s\n"
+ "zip1 v16.4s, v25.4s, v21.4s\n"
+ ".inst 0x4ea16a32 // bfcvtn2 v18.8h, v17.4s\n"
+ "str q18, [x27, #0x0]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v16.4s, v25.4s, v21.4s\n"
+ "zip1 v18.4s, v24.4s, v22.4s\n"
+ "zip1 v17.4s, v23.4s, v20.4s\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "str q19, [x27, #0x10]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v24.4s, v22.4s\n"
+ "zip2 v17.4s, v23.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x60]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v17.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ ".inst 0x4ea16a30 // bfcvtn2 v16.8h, v17.4s\n"
+ "str q16, [x27, #0x70]\n"
+ "add x27, x27, #0x20\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr s18, [x28], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s17, [x26], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v18.4s, v18.4s, v16.4s\n"
+ "ldr s16, [x24], #0x4\n"
+ "ldr s20, [x23], #0x4\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ "ldr s19, [x22], #0x4\n"
+ "ldr s17, [x21], #0x4\n"
+ "zip1 v16.4s, v18.4s, v16.4s\n"
+ "ldr s18, [x20], #0x4\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v17.4s, v20.4s, v17.4s\n"
+ "str d16, [x27, #0x0]\n"
+ "zip1 v16.4s, v19.4s, v18.4s\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "str d16, [x27, #0x60]\n"
+ "add x27, x27, #0x8\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0xc0\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q20, [x26], #0x10\n"
+ "cmp x19, #0x18\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v9.4s, v17.4s, v16.4s\n"
+ "ldr q8, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v7.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v6.4s, v18.4s, v16.4s\n"
+ "ldr q5, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v4.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v3.4s, v17.4s, v16.4s\n"
+ "ldr q2, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v1.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v0.4s, v18.4s, v16.4s\n"
+ "ldr q31, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v30.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v29.4s, v17.4s, v16.4s\n"
+ "ldr q28, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v27.4s, v18.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v26.4s, v18.4s, v17.4s\n"
+ "ldr q25, [x24], #0x10\n"
+ "zip1 v17.4s, v20.4s, v16.4s\n"
+ "zip2 v24.4s, v20.4s, v16.4s\n"
+ "ldr q23, [x24], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ "zip2 v17.4s, v19.4s, v17.4s\n"
+ "ldr q22, [x24], #0x10\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip1 v16.4s, v9.4s, v24.4s\n"
+ "ldr q21, [x24], #0x10\n"
+ ".inst 0x4ea16a33 // bfcvtn2 v19.8h, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "ldr q20, [x24], #0x10\n"
+ "zip2 v16.4s, v9.4s, v24.4s\n"
+ "zip1 v17.4s, v8.4s, v25.4s\n"
+ "str q19, [x27, #0x0]\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "str q18, [x27, #0x10]\n"
+ "zip1 v16.4s, v7.4s, v17.4s\n"
+ "zip2 v19.4s, v7.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v8.4s, v25.4s\n"
+ "zip1 v16.4s, v6.4s, v17.4s\n"
+ ".inst 0x4ea16a72 // bfcvtn2 v18.8h, v19.4s\n"
+ "str q18, [x27, #0x20]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v6.4s, v17.4s\n"
+ "zip1 v17.4s, v5.4s, v23.4s\n"
+ "zip1 v16.4s, v4.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x30]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v4.4s, v17.4s\n"
+ "zip2 v17.4s, v5.4s, v23.4s\n"
+ "zip1 v16.4s, v3.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x40]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v3.4s, v17.4s\n"
+ "zip1 v17.4s, v2.4s, v22.4s\n"
+ "zip1 v16.4s, v1.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x50]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v18.4s, v1.4s, v17.4s\n"
+ "zip2 v17.4s, v2.4s, v22.4s\n"
+ "zip1 v16.4s, v0.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x0]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v0.4s, v17.4s\n"
+ "zip1 v17.4s, v31.4s, v21.4s\n"
+ "zip1 v16.4s, v30.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x10]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v30.4s, v17.4s\n"
+ "zip2 v17.4s, v31.4s, v21.4s\n"
+ "zip1 v16.4s, v29.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x20]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v29.4s, v17.4s\n"
+ "zip1 v17.4s, v28.4s, v20.4s\n"
+ "zip1 v16.4s, v27.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x30]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v17.4s, v27.4s, v17.4s\n"
+ "zip2 v18.4s, v28.4s, v20.4s\n"
+ "zip1 v16.4s, v26.4s, v18.4s\n"
+ ".inst 0x4ea16a33 // bfcvtn2 v19.8h, v17.4s\n"
+ "str q19, [x27, #0x40]\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip2 v16.4s, v26.4s, v18.4s\n"
+ ".inst 0x4ea16a11 // bfcvtn2 v17.8h, v16.4s\n"
+ "str q17, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0xc\n"
+ "ldr q20, [x26], #0x10\n"
+ "cmp x19, #0xc\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v29.4s, v18.4s, v16.4s\n"
+ "ldr q28, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v27.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v26.4s, v17.4s, v16.4s\n"
+ "ldr q25, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v24.4s, v18.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v23.4s, v18.4s, v17.4s\n"
+ "ldr q22, [x24], #0x10\n"
+ "zip1 v17.4s, v20.4s, v16.4s\n"
+ "zip2 v21.4s, v20.4s, v16.4s\n"
+ "ldr q20, [x24], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ "zip2 v19.4s, v19.4s, v17.4s\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip1 v16.4s, v29.4s, v21.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ ".inst 0x4ea16a71 // bfcvtn2 v17.8h, v19.4s\n"
+ "str q17, [x27, #0x0]\n"
+ "zip2 v16.4s, v29.4s, v21.4s\n"
+ "zip1 v17.4s, v28.4s, v22.4s\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "str q18, [x27, #0x10]\n"
+ "zip1 v16.4s, v27.4s, v17.4s\n"
+ "zip2 v19.4s, v27.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v28.4s, v22.4s\n"
+ "zip1 v16.4s, v26.4s, v17.4s\n"
+ ".inst 0x4ea16a72 // bfcvtn2 v18.8h, v19.4s\n"
+ "str q18, [x27, #0x20]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v26.4s, v17.4s\n"
+ "zip1 v17.4s, v25.4s, v20.4s\n"
+ "zip1 v16.4s, v24.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x30]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v17.4s, v24.4s, v17.4s\n"
+ "zip2 v18.4s, v25.4s, v20.4s\n"
+ "zip1 v16.4s, v23.4s, v18.4s\n"
+ ".inst 0x4ea16a33 // bfcvtn2 v19.8h, v17.4s\n"
+ "str q19, [x27, #0x40]\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip2 v16.4s, v23.4s, v18.4s\n"
+ ".inst 0x4ea16a11 // bfcvtn2 v17.8h, v16.4s\n"
+ "str q17, [x27, #0x50]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr q19, [x28], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x26], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v21.4s, v19.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v20.4s, v19.4s, v17.4s\n"
+ "zip1 v17.4s, v18.4s, v16.4s\n"
+ "zip2 v19.4s, v18.4s, v16.4s\n"
+ "zip1 v16.4s, v21.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v21.4s, v17.4s\n"
+ "zip1 v16.4s, v20.4s, v19.4s\n"
+ ".inst 0x4ea16a32 // bfcvtn2 v18.8h, v17.4s\n"
+ "str q18, [x27, #0x0]\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip2 v16.4s, v20.4s, v19.4s\n"
+ ".inst 0x4ea16a11 // bfcvtn2 v17.8h, v16.4s\n"
+ "str q17, [x27, #0x10]\n"
+ "add x27, x27, #0x20\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr s17, [x28], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s18, [x26], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v17.4s, v17.4s, v16.4s\n"
+ "ldr s16, [x24], #0x4\n"
+ "zip1 v16.4s, v18.4s, v16.4s\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "str d16, [x27, #0x0]\n"
+ "add x27, x27, #0x8\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x60\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<12, 4, true, VLType::None>(
+ bfloat16 *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_2x4_fp32bf16(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_s8s16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_s8s16.hpp
new file mode 100644
index 0000000000..7359eea737
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_s8s16.hpp
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_12_s8s16(int16_t *out, const int8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 12 * height * sizeof(int16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q16, [x24], #0x10\n"
+ "sshll v27.8h, v16.8b, #0x0\n"
+ "ldr d17, [x24], #0x8\n"
+ "sub x19, x19, #0x18\n"
+ "sshll2 v16.8h, v16.16b, #0x0\n"
+ "ldr q26, [x22], #0x10\n"
+ "cmp x19, #0x18\n"
+ "dup v20.2d, v16.d[0]\n"
+ "ldr q25, [x21], #0x10\n"
+ "dup v24.2d, v16.d[1]\n"
+ "ldr q23, [x20], #0x10\n"
+ "sshll v16.8h, v17.8b, #0x0\n"
+ "ldr d19, [x22], #0x8\n"
+ "mov v24.d[1], v16.d[0]\n"
+ "dup v22.2d, v16.d[1]\n"
+ "ldr d18, [x21], #0x8\n"
+ "sshll v16.8h, v26.8b, #0x0\n"
+ "ldr d21, [x20], #0x8\n"
+ "mov v20.d[1], v16.d[0]\n"
+ "str q27, [x23, #0x0]\n"
+ "dup v17.2d, v16.d[1]\n"
+ "str q20, [x23, #0x10]\n"
+ "sshll2 v16.8h, v26.16b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x20]\n"
+ "mov v22.d[1], v16.d[1]\n"
+ "sshll v20.8h, v19.8b, #0x0\n"
+ "sshll v16.8h, v25.8b, #0x0\n"
+ "str q16, [x23, #0x30]\n"
+ "sshll2 v16.8h, v25.16b, #0x0\n"
+ "dup v17.2d, v16.d[0]\n"
+ "dup v19.2d, v16.d[1]\n"
+ "sshll v16.8h, v18.8b, #0x0\n"
+ "mov v19.d[1], v16.d[0]\n"
+ "dup v18.2d, v16.d[1]\n"
+ "sshll v16.8h, v23.8b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x40]\n"
+ "dup v17.2d, v16.d[1]\n"
+ "sshll2 v16.8h, v23.16b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "mov v18.d[1], v16.d[1]\n"
+ "str q24, [x23, #0x0]\n"
+ "sshll v16.8h, v21.8b, #0x0\n"
+ "str q22, [x23, #0x10]\n"
+ "str q20, [x23, #0x20]\n"
+ "str q19, [x23, #0x30]\n"
+ "str q18, [x23, #0x40]\n"
+ "str q16, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "ldr d21, [x22], #0x8\n"
+ "cmp x19, #0xc\n"
+ "ldr d20, [x21], #0x8\n"
+ "ldr d19, [x20], #0x8\n"
+ "ld1 { v16.s }[2], [x24], #0x4\n"
+ "sshll v17.8h, v16.8b, #0x0\n"
+ "ld1 { v21.s }[2], [x22], #0x4\n"
+ "sshll2 v18.8h, v16.16b, #0x0\n"
+ "ld1 { v20.s }[2], [x21], #0x4\n"
+ "ld1 { v19.s }[2], [x20], #0x4\n"
+ "sshll v16.8h, v21.8b, #0x0\n"
+ "str q17, [x23, #0x0]\n"
+ "sshll2 v17.8h, v21.16b, #0x0\n"
+ "mov v18.d[1], v16.d[0]\n"
+ "str q18, [x23, #0x10]\n"
+ "dup v16.2d, v16.d[1]\n"
+ "mov v16.d[1], v17.d[0]\n"
+ "str q16, [x23, #0x20]\n"
+ "sshll v16.8h, v20.8b, #0x0\n"
+ "str q16, [x23, #0x30]\n"
+ "sshll2 v17.8h, v20.16b, #0x0\n"
+ "sshll v16.8h, v19.8b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x40]\n"
+ "dup v17.2d, v16.d[1]\n"
+ "sshll2 v16.8h, v19.16b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr s16, [x24], #0x4\n"
+ "sshll v19.8h, v16.8b, #0x0\n"
+ "ldr s16, [x22], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "sshll v18.8h, v16.8b, #0x0\n"
+ "ldr s16, [x21], #0x4\n"
+ "cmp x19, #0x4\n"
+ "sshll v17.8h, v16.8b, #0x0\n"
+ "ldr s16, [x20], #0x4\n"
+ "str d19, [x23, #0x0]\n"
+ "sshll v16.8h, v16.8b, #0x0\n"
+ "str d18, [x23, #0x18]\n"
+ "str d17, [x23, #0x30]\n"
+ "str d16, [x23, #0x48]\n"
+ "add x23, x23, #0x8\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr b16, [x24], #0x1\n"
+ "sshll v19.8h, v16.8b, #0x0\n"
+ "ldr b16, [x22], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "sshll v18.8h, v16.8b, #0x0\n"
+ "ldr b16, [x21], #0x1\n"
+ "cmp x19, #0x1\n"
+ "sshll v17.8h, v16.8b, #0x0\n"
+ "ldr b16, [x20], #0x1\n"
+ "str h19, [x23, #0x0]\n"
+ "sshll v16.8h, v16.8b, #0x0\n"
+ "str h18, [x23, #0x18]\n"
+ "str h17, [x23, #0x30]\n"
+ "str h16, [x23, #0x48]\n"
+ "add x23, x23, #0x2\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x60\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q17, [x24], #0x10\n"
+ "sshll v16.8h, v17.8b, #0x0\n"
+ "ldr d18, [x24], #0x8\n"
+ "sub x19, x19, #0x18\n"
+ "sshll2 v17.8h, v17.16b, #0x0\n"
+ "str q16, [x23, #0x0]\n"
+ "cmp x19, #0x18\n"
+ "dup v16.2d, v17.d[0]\n"
+ "str d16, [x23, #0x10]\n"
+ "dup v17.2d, v17.d[1]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "sshll v16.8h, v18.8b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x0]\n"
+ "dup v16.2d, v16.d[1]\n"
+ "str d16, [x23, #0x10]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr d17, [x24], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "cmp x19, #0xc\n"
+ "ld1 { v17.s }[2], [x24], #0x4\n"
+ "sshll v16.8h, v17.8b, #0x0\n"
+ "str q16, [x23, #0x0]\n"
+ "sshll2 v16.8h, v17.16b, #0x0\n"
+ "str d16, [x23, #0x10]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr s16, [x24], #0x4\n"
+ "sshll v16.8h, v16.8b, #0x0\n"
+ "str d16, [x23, #0x0]\n"
+ "sub x19, x19, #0x4\n"
+ "add x23, x23, #0x8\n"
+ "cmp x19, #0x4\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr b16, [x24], #0x1\n"
+ "sshll v16.8h, v16.8b, #0x0\n"
+ "str h16, [x23, #0x0]\n"
+ "sub x19, x19, #0x1\n"
+ "add x23, x23, #0x2\n"
+ "cmp x19, #0x1\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x18\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<12, 1, true, VLType::None>(
+ int16_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_s8s16(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_u8u16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_u8u16.hpp
new file mode 100644
index 0000000000..34fb0ed5ac
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12_u8u16.hpp
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_12_u8u16(uint16_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 12 * height * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q16, [x24], #0x10\n"
+ "ushll v27.8h, v16.8b, #0x0\n"
+ "ldr d17, [x24], #0x8\n"
+ "sub x19, x19, #0x18\n"
+ "ushll2 v16.8h, v16.16b, #0x0\n"
+ "ldr q26, [x22], #0x10\n"
+ "cmp x19, #0x18\n"
+ "dup v20.2d, v16.d[0]\n"
+ "ldr q25, [x21], #0x10\n"
+ "dup v24.2d, v16.d[1]\n"
+ "ldr q23, [x20], #0x10\n"
+ "ushll v16.8h, v17.8b, #0x0\n"
+ "ldr d19, [x22], #0x8\n"
+ "mov v24.d[1], v16.d[0]\n"
+ "dup v22.2d, v16.d[1]\n"
+ "ldr d18, [x21], #0x8\n"
+ "ushll v16.8h, v26.8b, #0x0\n"
+ "ldr d21, [x20], #0x8\n"
+ "mov v20.d[1], v16.d[0]\n"
+ "str q27, [x23, #0x0]\n"
+ "dup v17.2d, v16.d[1]\n"
+ "str q20, [x23, #0x10]\n"
+ "ushll2 v16.8h, v26.16b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x20]\n"
+ "mov v22.d[1], v16.d[1]\n"
+ "ushll v20.8h, v19.8b, #0x0\n"
+ "ushll v16.8h, v25.8b, #0x0\n"
+ "str q16, [x23, #0x30]\n"
+ "ushll2 v16.8h, v25.16b, #0x0\n"
+ "dup v17.2d, v16.d[0]\n"
+ "dup v19.2d, v16.d[1]\n"
+ "ushll v16.8h, v18.8b, #0x0\n"
+ "mov v19.d[1], v16.d[0]\n"
+ "dup v18.2d, v16.d[1]\n"
+ "ushll v16.8h, v23.8b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x40]\n"
+ "dup v17.2d, v16.d[1]\n"
+ "ushll2 v16.8h, v23.16b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "mov v18.d[1], v16.d[1]\n"
+ "str q24, [x23, #0x0]\n"
+ "ushll v16.8h, v21.8b, #0x0\n"
+ "str q22, [x23, #0x10]\n"
+ "str q20, [x23, #0x20]\n"
+ "str q19, [x23, #0x30]\n"
+ "str q18, [x23, #0x40]\n"
+ "str q16, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "ldr d21, [x22], #0x8\n"
+ "cmp x19, #0xc\n"
+ "ldr d20, [x21], #0x8\n"
+ "ldr d19, [x20], #0x8\n"
+ "ld1 { v16.s }[2], [x24], #0x4\n"
+ "ushll v17.8h, v16.8b, #0x0\n"
+ "ld1 { v21.s }[2], [x22], #0x4\n"
+ "ushll2 v18.8h, v16.16b, #0x0\n"
+ "ld1 { v20.s }[2], [x21], #0x4\n"
+ "ld1 { v19.s }[2], [x20], #0x4\n"
+ "ushll v16.8h, v21.8b, #0x0\n"
+ "str q17, [x23, #0x0]\n"
+ "ushll2 v17.8h, v21.16b, #0x0\n"
+ "mov v18.d[1], v16.d[0]\n"
+ "str q18, [x23, #0x10]\n"
+ "dup v16.2d, v16.d[1]\n"
+ "mov v16.d[1], v17.d[0]\n"
+ "str q16, [x23, #0x20]\n"
+ "ushll v16.8h, v20.8b, #0x0\n"
+ "str q16, [x23, #0x30]\n"
+ "ushll2 v17.8h, v20.16b, #0x0\n"
+ "ushll v16.8h, v19.8b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x40]\n"
+ "dup v17.2d, v16.d[1]\n"
+ "ushll2 v16.8h, v19.16b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr s16, [x24], #0x4\n"
+ "ushll v19.8h, v16.8b, #0x0\n"
+ "ldr s16, [x22], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ushll v18.8h, v16.8b, #0x0\n"
+ "ldr s16, [x21], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ushll v17.8h, v16.8b, #0x0\n"
+ "ldr s16, [x20], #0x4\n"
+ "str d19, [x23, #0x0]\n"
+ "ushll v16.8h, v16.8b, #0x0\n"
+ "str d18, [x23, #0x18]\n"
+ "str d17, [x23, #0x30]\n"
+ "str d16, [x23, #0x48]\n"
+ "add x23, x23, #0x8\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr b16, [x24], #0x1\n"
+ "ushll v19.8h, v16.8b, #0x0\n"
+ "ldr b16, [x22], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ushll v18.8h, v16.8b, #0x0\n"
+ "ldr b16, [x21], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ushll v17.8h, v16.8b, #0x0\n"
+ "ldr b16, [x20], #0x1\n"
+ "str h19, [x23, #0x0]\n"
+ "ushll v16.8h, v16.8b, #0x0\n"
+ "str h18, [x23, #0x18]\n"
+ "str h17, [x23, #0x30]\n"
+ "str h16, [x23, #0x48]\n"
+ "add x23, x23, #0x2\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x60\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q17, [x24], #0x10\n"
+ "ushll v16.8h, v17.8b, #0x0\n"
+ "ldr d18, [x24], #0x8\n"
+ "sub x19, x19, #0x18\n"
+ "ushll2 v17.8h, v17.16b, #0x0\n"
+ "str q16, [x23, #0x0]\n"
+ "cmp x19, #0x18\n"
+ "dup v16.2d, v17.d[0]\n"
+ "str d16, [x23, #0x10]\n"
+ "dup v17.2d, v17.d[1]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "ushll v16.8h, v18.8b, #0x0\n"
+ "mov v17.d[1], v16.d[0]\n"
+ "str q17, [x23, #0x0]\n"
+ "dup v16.2d, v16.d[1]\n"
+ "str d16, [x23, #0x10]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr d17, [x24], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "cmp x19, #0xc\n"
+ "ld1 { v17.s }[2], [x24], #0x4\n"
+ "ushll v16.8h, v17.8b, #0x0\n"
+ "str q16, [x23, #0x0]\n"
+ "ushll2 v16.8h, v17.16b, #0x0\n"
+ "str d16, [x23, #0x10]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr s16, [x24], #0x4\n"
+ "ushll v16.8h, v16.8b, #0x0\n"
+ "str d16, [x23, #0x0]\n"
+ "sub x19, x19, #0x4\n"
+ "add x23, x23, #0x8\n"
+ "cmp x19, #0x4\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr b16, [x24], #0x1\n"
+ "ushll v16.8h, v16.8b, #0x0\n"
+ "str h16, [x23, #0x0]\n"
+ "sub x19, x19, #0x1\n"
+ "add x23, x23, #0x2\n"
+ "cmp x19, #0x1\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x18\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<12, 1, true, VLType::None>(
+ uint16_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_12_u8u16(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12way_16bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12way_16bit.hpp
deleted file mode 100644
index f6233ef503..0000000000
--- a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12way_16bit.hpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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
-
-#ifdef __aarch64__
-
-#include "transpose_interleave_common.hpp"
-
-// Generic unblocked transposed 6x32-bit sized specialisation
-template <>
-template <typename T>
-inline void TransformImpl<6, 1, true, 4, 4, VLType::None>::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 12 x uint16_t specialisation
- TransformImpl<12, 1, true, 2, 2, VLType::None>::Transform(
- reinterpret_cast<uint16_t *>(out),
- reinterpret_cast<const uint16_t *>(in),
- stride*2, x0*2, xmax*2, k0, kmax
- );
-}
-
-// Generic 12x16-bit sized specialisation
-template <>
-template <typename T>
-inline void TransformImpl<12, 1, true, 2, 2, VLType::None>::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 12 x uint16_t version
-template <>
-inline void TransposeInterleaveCommon<12, uint16_t, uint16_t>::moveblock_1x1(const uint16_t *&in0, uint16_t *out) {
- __asm volatile (
- "LDR q0, [%[in0]]\n"
- "STR q0, [%[out]]\n"
- "LDR d1, [%[in0], #0x10]\n"
- "STR d1, [%[out], #0x10]\n"
- "ADD %x[in0], %x[in0], #0x18\n"
- ASM_PREFETCH("[%[in0], #192]")
- : [in0] "+r" (in0),
- [out] "+r" (out)
- :
- : "v0", "v1", "memory"
- );
-}
-
-template <>
-inline void TransposeInterleaveCommon<12, uint16_t, uint16_t>::moveblock_1x2(const uint16_t *&in0, const uint16_t *&in1, uint16_t *out) {
- __asm volatile (
- "LDR q0, [%[in0]]\n"
- "LDR d1, [%[in0], #0x10]\n"
- "ADD %x[in0], %x[in0], #0x18\n"
- ASM_PREFETCH("[%[in0], #192]")
-
- "LDR x21, [%[in1]]\n"
- "LDR q2, [%[in1], #0x08]\n"
- "INS v1.d[1], x21\n"
- "ADD %x[in1], %x[in1], #0x18\n"
- "STP q0, q1, [%[out]]\n"
- "STR q2, [%x[out], #0x20]\n"
- ASM_PREFETCH("[%[in1], #192]")
- : [in0] "+r" (in0),
- [in1] "+r" (in1),
- [out] "+r" (out)
- :
- : "x21", "v0", "v1", "v2", "memory"
- );
-}
-
-template <>
-inline void TransposeInterleaveCommon<12, uint16_t, uint16_t>::moveblock_1x4(const uint16_t *&in0, const uint16_t *&in1, const uint16_t *&in2, const uint16_t *&in3, uint16_t *out) {
- __asm __volatile (
- "LDR q0, [%x[in0]], #0x10\n"
- "STR q0, [%x[out]]\n"
- "LDR d1, [%x[in0]], #0x08\n"
- ASM_PREFETCH("[%[in0], #192]")
- "STR d1, [%x[out], #0x10]\n"
-
- "LDR q0, [%x[in1]], #0x10\n"
- "STR q0, [%x[out], #0x18]\n"
- "LDR d1, [%x[in1]], #0x08\n"
- ASM_PREFETCH("[%[in1], #192]")
- "STR d1, [%x[out], #0x28]\n"
-
- "LDR q0, [%x[in2]], #0x10\n"
- "STR q0, [%x[out], #0x30]\n"
- "LDR d1, [%x[in2]], #0x08\n"
- ASM_PREFETCH("[%[in2], #192]")
- "STR d1, [%x[out], #0x40]\n"
-
- "LDR q0, [%x[in3]], #0x10\n"
- "STR q0, [%x[out], #0x48]\n"
- "LDR d1, [%x[in3]], #0x08\n"
- ASM_PREFETCH("[%[in3], #192]")
- "STR d1, [%x[out], #0x58]\n"
- : [in0] "+r" (in0),
- [in1] "+r" (in1),
- [in2] "+r" (in2),
- [in3] "+r" (in3),
- [out] "+r" (out)
- :
- : "v0", "v1", "memory"
- );
-}
-
-template <>
-template <>
-inline void TransformImpl<12, 1, true, 2, 2, VLType::None>::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<12, uint16_t, uint16_t>::Transform(out, in, stride, x0, xmax, k0, kmax);
-}
-
-#endif // __aarch64__
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12way_half_to_float.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12way_half_to_float.hpp
deleted file mode 100644
index c0f3e17d31..0000000000
--- a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_12way_half_to_float.hpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2017-2020 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#pragma once
-
-#if defined(__aarch64__) && defined(__ARM_FP16_ARGS)
-
-#include "transpose_interleave_common.hpp"
-
-template <>
-inline void TransposeInterleaveCommon<12, __fp16, float>::moveblock_1x1(const __fp16 *&in0, float *out) {
- __asm __volatile (
- "LDR q0, [%[in0]], #16\n"
- "FCVTL2 v1.4s, v0.8h\n"
- "FCVTL v0.4s, v0.4h\n"
- "STP q0, q1, [%[out]]\n"
- ASM_PREFETCH("[%[in0], #192]")
- "LDR d2, [%[in0]], #8\n"
- "FCVTL v2.4s, v2.4h\n"
- "STR q2, [%[out], #32]\n"
- : [in0] "+r" (in0), [out] "+r" (out)
- :
- : "v0", "v1", "v2", "memory"
- );
-}
-
-template <>
-inline void TransposeInterleaveCommon<12, __fp16, float>::moveblock_1x2(const __fp16 *&in0, const __fp16 *&in1, float *out) {
- __asm __volatile (
- "LDR q0, [%[in0]], #16\n"
- "FCVTL2 v1.4s, v0.8h\n"
- "FCVTL v0.4s, v0.4h\n"
- "STP q0, q1, [%[out]]\n"
- ASM_PREFETCH("[%[in0], #192]")
- "LDR d2, [%[in0]], #8\n"
- "FCVTL v2.4s, v2.4h\n"
- "LDR q3, [%[in1]], #16\n"
- "FCVTL2 v4.4s, v3.8h\n"
- "FCVTL v3.4s, v3.4h\n"
- "STP q2, q3, [%[out], #32]\n"
- ASM_PREFETCH("[%[in1], #192]")
- "LDR d5, [%[in1]], #8\n"
- "FCVTL v5.4s, v5.4h\n"
- "STP q4, q5, [%[out], #64]\n"
- : [in0] "+r" (in0), [in1] "+r" (in1), [out] "+r" (out)
- :
- : "v0", "v1", "v2", "v3", "v4", "v5", "memory"
- );
-}
-
-template <>
-inline void TransposeInterleaveCommon<12, __fp16, float>::moveblock_1x4(const __fp16 *&in0, const __fp16 *&in1, const __fp16 *&in2, const __fp16 *&in3, float *out) {
- __asm __volatile (
- "LDR q0, [%[in0]], #16\n"
- "FCVTL2 v1.4s, v0.8h\n"
- "FCVTL v0.4s, v0.4h\n"
- "STP q0, q1, [%[out]]\n"
- "LDR d2, [%[in0]], #8\n"
- ASM_PREFETCH("[%[in0], #192]")
- "FCVTL v2.4s, v2.4h\n"
- "LDR q3, [%[in1]], #16\n"
- "FCVTL2 v4.4s, v3.8h\n"
- "FCVTL v3.4s, v3.4h\n"
- "STP q2, q3, [%[out], #32]\n"
- "LDR d5, [%[in1]], #8\n"
- "FCVTL v5.4s, v5.4h\n"
- ASM_PREFETCH("[%[in1], #192]")
- "STP q4, q5, [%[out], #64]\n"
- "LDR q6, [%[in2]], #16\n"
- "FCVTL2 v7.4s, v6.8h\n"
- "FCVTL v6.4s, v6.4h\n"
- "STP q6, q7, [%[out], #96]\n"
- "LDR d8, [%[in2]], #8\n"
- "FCVTL v8.4s, v8.4h\n"
- ASM_PREFETCH("[%[in2], #192]")
- "LDR q9, [%[in3]], #16\n"
- "FCVTL2 v10.4s, v9.8h\n"
- "FCVTL v9.4s, v9.4h\n"
- "STP q8, q9, [%[out], #128]\n"
- "LDR d11, [%[in3]], #8\n"
- "FCVTL v11.4s, v11.4h\n"
- "STP q10, q11, [%[out], #160]\n"
- ASM_PREFETCH("[%[in3], #192]")
-
- : [in0] "+r" (in0), [in1] "+r" (in1), [in2] "+r" (in2), [in3] "+r" (in3), [out] "+r" (out)
- :
- : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "memory"
- );
-}
-
-template <>
-template <>
-inline void TransformImpl<12, 1, true, 4, 2, VLType::None>::Transform(
- float* out, const __fp16* const in, const int stride,
- const int x0, const int xmax, const int k0, const int kmax
-) {
- TransposeInterleaveCommon<12, __fp16, float>::Transform(out, in, stride, x0, xmax, k0, kmax);
-}
-
-#endif // __aarch64__ && __ARM_FP16_ARGS
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16.hpp
new file mode 100644
index 0000000000..dd1bd508ef
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16.hpp
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_16(uint32_t *out, const uint32_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 4 * height * sizeof(uint32_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x4\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q19, [x24], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x22], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q19, [x23, #0x0]\n"
+ "str q18, [x23, #0x10]\n"
+ "str q17, [x23, #0x20]\n"
+ "str q16, [x23, #0x30]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x1\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 1 loop: loop
+ "ldr s19, [x24], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s18, [x22], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s17, [x21], #0x4\n"
+ "ldr s16, [x20], #0x4\n"
+ "str s19, [x23, #0x0]\n"
+ "str s18, [x23, #0x10]\n"
+ "str s17, [x23, #0x20]\n"
+ "str s16, [x23, #0x30]\n"
+ "add x23, x23, #0x4\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x40\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x4\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Column loop
+ "ldr q16, [x24], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "cmp x19, #0x4\n"
+ "str q16, [x23, #0x0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Column loop skip
+ "cmp x19, #0x1\n"
+ "blt 11f\n"
+ "10:" // Tail row loop: width 1 loop: loop
+ "ldr s16, [x24], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "cmp x19, #0x1\n"
+ "str s16, [x23, #0x0]\n"
+ "add x23, x23, #0x4\n"
+ "bge 10b\n"
+ "11:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x10\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v16", "v17", "v18", "v19", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<4, 1, true, VLType::None>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_16(
+ reinterpret_cast<uint32_t *>(out),
+ reinterpret_cast<const uint32_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 4,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_1x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_1x4.hpp
new file mode 100644
index 0000000000..7e7fcf5b8b
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_1x4.hpp
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_16_1x4(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 16 * roundup<size_t>(height, 4) * sizeof(uint8_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x10\n"
+ "blt 8f\n"
+ "1:" // Main row loop: Head
+ "mov x16, %x[in]\n"
+ "mov x15, %x[out]\n"
+ "add x14, x16, %x[in_stride]\n"
+ "add x13, x14, %x[in_stride]\n"
+ "add x12, x13, %x[in_stride]\n"
+ "add x11, x12, %x[in_stride]\n"
+ "add x10, x11, %x[in_stride]\n"
+ "add x9, x10, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x10\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q18, [x16], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q20, [x14], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q17, [x13], #0x10\n"
+ "zip1 v19.16b, v18.16b, v17.16b\n"
+ "ldr q16, [x12], #0x10\n"
+ "zip2 v18.16b, v18.16b, v17.16b\n"
+ "ldr q3, [x11], #0x10\n"
+ "ldr q2, [x10], #0x10\n"
+ "zip1 v17.16b, v20.16b, v16.16b\n"
+ "ldr q1, [x9], #0x10\n"
+ "zip2 v16.16b, v20.16b, v16.16b\n"
+ "ldr q0, [x28], #0x10\n"
+ "zip1 v31.16b, v19.16b, v17.16b\n"
+ "ldr q30, [x27], #0x10\n"
+ "zip2 v20.16b, v19.16b, v17.16b\n"
+ "ldr q29, [x26], #0x10\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr q28, [x25], #0x10\n"
+ "zip2 v18.16b, v18.16b, v16.16b\n"
+ "ldr q27, [x24], #0x10\n"
+ "zip1 v17.16b, v3.16b, v1.16b\n"
+ "ldr q26, [x23], #0x10\n"
+ "zip1 v16.16b, v2.16b, v0.16b\n"
+ "ldr q25, [x22], #0x10\n"
+ "zip1 v24.16b, v17.16b, v16.16b\n"
+ "ldr q23, [x21], #0x10\n"
+ "zip2 v22.16b, v17.16b, v16.16b\n"
+ "ldr q21, [x20], #0x10\n"
+ "zip2 v17.16b, v3.16b, v1.16b\n"
+ "str q31, [x15, #0x0]\n"
+ "zip2 v16.16b, v2.16b, v0.16b\n"
+ "str q20, [x15, #0x10]\n"
+ "zip1 v20.16b, v17.16b, v16.16b\n"
+ "str q19, [x15, #0x20]\n"
+ "zip2 v19.16b, v17.16b, v16.16b\n"
+ "str q18, [x15, #0x30]\n"
+ "zip1 v18.16b, v30.16b, v28.16b\n"
+ "str q24, [x15, #0x40]\n"
+ "zip1 v16.16b, v29.16b, v27.16b\n"
+ "str q22, [x15, #0x50]\n"
+ "zip1 v17.16b, v18.16b, v16.16b\n"
+ "str q20, [x15, #0x60]\n"
+ "zip2 v16.16b, v18.16b, v16.16b\n"
+ "str q19, [x15, #0x70]\n"
+ "zip2 v18.16b, v30.16b, v28.16b\n"
+ "str q17, [x15, #0x80]\n"
+ "zip2 v17.16b, v29.16b, v27.16b\n"
+ "str q16, [x15, #0x90]\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0xa0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0xb0]\n"
+ "zip1 v18.16b, v26.16b, v23.16b\n"
+ "zip1 v17.16b, v25.16b, v21.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0xc0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0xd0]\n"
+ "zip2 v18.16b, v26.16b, v23.16b\n"
+ "zip2 v17.16b, v25.16b, v21.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0xe0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0xf0]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 4 loop: loop
+ "ldr s18, [x16], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s17, [x14], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s16, [x13], #0x4\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x12], #0x4\n"
+ "ldr s18, [x11], #0x4\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "ldr s20, [x10], #0x4\n"
+ "ldr s17, [x9], #0x4\n"
+ "zip1 v23.16b, v19.16b, v16.16b\n"
+ "ldr s16, [x28], #0x4\n"
+ "zip1 v19.16b, v18.16b, v17.16b\n"
+ "ldr s18, [x27], #0x4\n"
+ "ldr s22, [x26], #0x4\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "ldr s17, [x25], #0x4\n"
+ "zip1 v21.16b, v19.16b, v16.16b\n"
+ "ldr s16, [x24], #0x4\n"
+ "zip1 v18.16b, v18.16b, v17.16b\n"
+ "ldr s20, [x23], #0x4\n"
+ "ldr s19, [x22], #0x4\n"
+ "zip1 v16.16b, v22.16b, v16.16b\n"
+ "ldr s17, [x21], #0x4\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x20], #0x4\n"
+ "zip1 v17.16b, v20.16b, v17.16b\n"
+ "str q23, [x15, #0x0]\n"
+ "str q21, [x15, #0x40]\n"
+ "zip1 v16.16b, v19.16b, v16.16b\n"
+ "str q18, [x15, #0x80]\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x15, #0xc0]\n"
+ "add x15, x15, #0x10\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 1 loop: loop
+ "ldr b18, [x16], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b17, [x14], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b16, [x13], #0x1\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr b16, [x12], #0x1\n"
+ "ldr b18, [x11], #0x1\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "ldr b20, [x10], #0x1\n"
+ "ldr b17, [x9], #0x1\n"
+ "zip1 v23.16b, v19.16b, v16.16b\n"
+ "ldr b16, [x28], #0x1\n"
+ "zip1 v19.16b, v18.16b, v17.16b\n"
+ "ldr b18, [x27], #0x1\n"
+ "ldr b22, [x26], #0x1\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "ldr b17, [x25], #0x1\n"
+ "zip1 v21.16b, v19.16b, v16.16b\n"
+ "ldr b16, [x24], #0x1\n"
+ "zip1 v18.16b, v18.16b, v17.16b\n"
+ "ldr b20, [x23], #0x1\n"
+ "ldr b19, [x22], #0x1\n"
+ "zip1 v16.16b, v22.16b, v16.16b\n"
+ "ldr b17, [x21], #0x1\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr b16, [x20], #0x1\n"
+ "zip1 v17.16b, v20.16b, v17.16b\n"
+ "str s23, [x15, #0x0]\n"
+ "str s21, [x15, #0x40]\n"
+ "zip1 v16.16b, v19.16b, v16.16b\n"
+ "str s18, [x15, #0x80]\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str s16, [x15, #0xc0]\n"
+ "add x15, x15, #0x4\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x100\n"
+ "cmp %x[height], #0x10\n"
+ "bge 1b\n"
+ "cbz %x[height], 16f\n"
+ "8:" // Main loop skip
+
+ "9:" // Tail row loop: Head
+ "mov x16, %x[in]\n"
+ "mov x15, %x[out]\n"
+ "add x14, x16, %x[in_stride]\n"
+ "add x13, x14, %x[in_stride]\n"
+ "add x12, x13, %x[in_stride]\n"
+ "add %x[in], x12, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x12, x12, %x[pad_row], GT\n"
+ "csel x13, x13, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x14, x14, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 11f\n"
+ "10:" // Tail row loop: Column loop
+ "ldr q18, [x16], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q21, [x14], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q17, [x13], #0x10\n"
+ "zip1 v20.16b, v18.16b, v17.16b\n"
+ "ldr q16, [x12], #0x10\n"
+ "zip2 v19.16b, v18.16b, v17.16b\n"
+ "zip1 v18.16b, v21.16b, v16.16b\n"
+ "zip2 v17.16b, v21.16b, v16.16b\n"
+ "zip1 v16.16b, v20.16b, v18.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v20.16b, v18.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip1 v16.16b, v19.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v16.16b, v19.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: width 4 loop: loop
+ "ldr s17, [x16], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s18, [x14], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s16, [x13], #0x4\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr s16, [x12], #0x4\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "add x15, x15, #0x10\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 1 loop: loop
+ "ldr b17, [x16], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b18, [x14], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b16, [x13], #0x1\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr b16, [x12], #0x1\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str s16, [x15, #0x0]\n"
+ "add x15, x15, #0x4\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x40\n"
+ "cmp %x[height], #0x1\n"
+ "bge 9b\n"
+ "16:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<16, 4, true, VLType::None>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_16_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<16, 4, true, VLType::None>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_16_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_1x8.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_1x8.hpp
new file mode 100644
index 0000000000..f52fbbae4d
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_1x8.hpp
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_16_1x8(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 8) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 16 * roundup<size_t>(height, 8) * sizeof(uint8_t);
+
+ __asm__ __volatile__(
+
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "cmp %x[height], #0x7\n"
+ "csel x20, x20, %x[pad_row], GT\n"
+ "csel x21, x21, %x[pad_row], GE\n"
+ "cmp %x[height], #0x5\n"
+ "csel x22, x22, %x[pad_row], GT\n"
+ "csel x23, x23, %x[pad_row], GE\n"
+ "cmp %x[height], #0x3\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "ldr q19, [x26], #0x10\n"
+ "cmp x19, #0x20\n"
+ "ldr q4, [x25], #0x10\n"
+ "ldr q3, [x24], #0x10\n"
+ "ldr q16, [x23], #0x10\n"
+ "zip1 v2.16b, v17.16b, v16.16b\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v1.16b, v17.16b, v16.16b\n"
+ "ldr q0, [x26], #0x10\n"
+ "ldr q31, [x25], #0x10\n"
+ "ldr q30, [x24], #0x10\n"
+ "ldr q17, [x23], #0x10\n"
+ "zip1 v29.16b, v18.16b, v17.16b\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip2 v28.16b, v18.16b, v17.16b\n"
+ "ldr q27, [x21], #0x10\n"
+ "ldr q26, [x20], #0x10\n"
+ "zip1 v25.16b, v19.16b, v16.16b\n"
+ "ldr q24, [x22], #0x10\n"
+ "zip2 v21.16b, v19.16b, v16.16b\n"
+ "ldr q23, [x21], #0x10\n"
+ "zip1 v20.16b, v4.16b, v27.16b\n"
+ "ldr q22, [x20], #0x10\n"
+ "zip1 v18.16b, v2.16b, v20.16b\n"
+ "zip1 v19.16b, v3.16b, v26.16b\n"
+ "zip1 v17.16b, v25.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v18.16b, v2.16b, v20.16b\n"
+ "zip2 v17.16b, v25.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v20.16b, v4.16b, v27.16b\n"
+ "zip1 v18.16b, v1.16b, v20.16b\n"
+ "zip2 v19.16b, v3.16b, v26.16b\n"
+ "zip1 v17.16b, v21.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "zip2 v18.16b, v1.16b, v20.16b\n"
+ "zip2 v17.16b, v21.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x60]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x70]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip1 v21.16b, v31.16b, v23.16b\n"
+ "zip1 v20.16b, v0.16b, v24.16b\n"
+ "zip1 v18.16b, v29.16b, v21.16b\n"
+ "zip1 v19.16b, v30.16b, v22.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v18.16b, v29.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v21.16b, v31.16b, v23.16b\n"
+ "zip1 v18.16b, v28.16b, v21.16b\n"
+ "zip2 v20.16b, v0.16b, v24.16b\n"
+ "zip2 v19.16b, v30.16b, v22.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "zip2 v18.16b, v28.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x60]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x70]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0x10\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q19, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q18, [x26], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q28, [x25], #0x10\n"
+ "ldr q27, [x24], #0x10\n"
+ "ldr q17, [x23], #0x10\n"
+ "zip1 v26.16b, v19.16b, v17.16b\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip2 v25.16b, v19.16b, v17.16b\n"
+ "ldr q24, [x21], #0x10\n"
+ "ldr q23, [x20], #0x10\n"
+ "zip1 v22.16b, v18.16b, v16.16b\n"
+ "zip2 v21.16b, v18.16b, v16.16b\n"
+ "zip1 v20.16b, v28.16b, v24.16b\n"
+ "zip1 v18.16b, v26.16b, v20.16b\n"
+ "zip1 v19.16b, v27.16b, v23.16b\n"
+ "zip1 v17.16b, v22.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "zip2 v18.16b, v26.16b, v20.16b\n"
+ "zip2 v17.16b, v22.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v20.16b, v28.16b, v24.16b\n"
+ "zip1 v18.16b, v25.16b, v20.16b\n"
+ "zip2 v19.16b, v27.16b, v23.16b\n"
+ "zip1 v17.16b, v21.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x50]\n"
+ "zip2 v18.16b, v25.16b, v20.16b\n"
+ "zip2 v17.16b, v21.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x60]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x70]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr s17, [x28], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s21, [x26], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s18, [x25], #0x4\n"
+ "ldr s20, [x24], #0x4\n"
+ "ldr s16, [x23], #0x4\n"
+ "zip1 v19.16b, v17.16b, v16.16b\n"
+ "ldr s17, [x22], #0x4\n"
+ "ldr s16, [x21], #0x4\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x20], #0x4\n"
+ "zip1 v17.16b, v21.16b, v17.16b\n"
+ "zip1 v18.16b, v19.16b, v18.16b\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x27, #0x10]\n"
+ "add x27, x27, #0x20\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr b18, [x28], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b21, [x26], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b17, [x25], #0x1\n"
+ "ldr b20, [x24], #0x1\n"
+ "ldr b16, [x23], #0x1\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr b18, [x22], #0x1\n"
+ "ldr b16, [x21], #0x1\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr b16, [x20], #0x1\n"
+ "zip1 v18.16b, v21.16b, v18.16b\n"
+ "zip1 v17.16b, v19.16b, v17.16b\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str d16, [x27, #0x0]\n"
+ "add x27, x27, #0x8\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x80\n"
+ "cmp %x[height], #0x1\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<16, 8, true, VLType::None>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_16_1x8(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<16, 8, true, VLType::None>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_16_1x8(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x2.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x2.hpp
new file mode 100644
index 0000000000..cfac12a84a
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x2.hpp
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_16_2x2(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 2) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 16 * roundup<size_t>(height, 2) * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x8\n"
+ "blt 8f\n"
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q16, [x26], #0x10\n"
+ "zip1 v1.8h, v18.8h, v16.8h\n"
+ "ldr q17, [x28], #0x10\n"
+ "cmp x19, #0x10\n"
+ "zip2 v0.8h, v18.8h, v16.8h\n"
+ "ldr q16, [x26], #0x10\n"
+ "ldr q19, [x25], #0x10\n"
+ "zip1 v31.8h, v17.8h, v16.8h\n"
+ "ldr q18, [x25], #0x10\n"
+ "zip2 v30.8h, v17.8h, v16.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "ldr q20, [x23], #0x10\n"
+ "zip1 v29.8h, v19.8h, v16.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "zip2 v28.8h, v19.8h, v16.8h\n"
+ "ldr q19, [x23], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v27.8h, v18.8h, v17.8h\n"
+ "ldr q26, [x21], #0x10\n"
+ "zip2 v25.8h, v18.8h, v17.8h\n"
+ "ldr q18, [x22], #0x10\n"
+ "zip1 v24.8h, v20.8h, v16.8h\n"
+ "ldr q17, [x20], #0x10\n"
+ "zip2 v23.8h, v20.8h, v16.8h\n"
+ "ldr q22, [x21], #0x10\n"
+ "zip1 v21.8h, v19.8h, v18.8h\n"
+ "ldr q16, [x20], #0x10\n"
+ "zip2 v20.8h, v19.8h, v18.8h\n"
+ "zip1 v19.8h, v26.8h, v17.8h\n"
+ "str q1, [x27, #0x0]\n"
+ "zip2 v18.8h, v26.8h, v17.8h\n"
+ "str q0, [x27, #0x10]\n"
+ "str q31, [x27, #0x20]\n"
+ "zip1 v17.8h, v22.8h, v16.8h\n"
+ "str q30, [x27, #0x30]\n"
+ "zip2 v16.8h, v22.8h, v16.8h\n"
+ "str q29, [x27, #0x40]\n"
+ "str q28, [x27, #0x50]\n"
+ "str q27, [x27, #0x60]\n"
+ "str q25, [x27, #0x70]\n"
+ "str q24, [x27, #0x80]\n"
+ "str q23, [x27, #0x90]\n"
+ "str q21, [x27, #0xa0]\n"
+ "str q20, [x27, #0xb0]\n"
+ "str q19, [x27, #0xc0]\n"
+ "str q18, [x27, #0xd0]\n"
+ "str q17, [x27, #0xe0]\n"
+ "str q16, [x27, #0xf0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 4 loop: loop
+ "ldr d17, [x28], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d16, [x26], #0x8\n"
+ "zip1 v20.8h, v17.8h, v16.8h\n"
+ "ldr d17, [x25], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d16, [x24], #0x8\n"
+ "zip1 v19.8h, v17.8h, v16.8h\n"
+ "ldr d17, [x23], #0x8\n"
+ "ldr d16, [x22], #0x8\n"
+ "zip1 v18.8h, v17.8h, v16.8h\n"
+ "ldr d17, [x21], #0x8\n"
+ "ldr d16, [x20], #0x8\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str q20, [x27, #0x0]\n"
+ "str q19, [x27, #0x40]\n"
+ "str q18, [x27, #0x80]\n"
+ "str q16, [x27, #0xc0]\n"
+ "add x27, x27, #0x10\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 1 loop: loop
+ "ldr h17, [x28], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h16, [x26], #0x2\n"
+ "zip1 v20.8h, v17.8h, v16.8h\n"
+ "ldr h17, [x25], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h16, [x24], #0x2\n"
+ "zip1 v19.8h, v17.8h, v16.8h\n"
+ "ldr h17, [x23], #0x2\n"
+ "ldr h16, [x22], #0x2\n"
+ "zip1 v18.8h, v17.8h, v16.8h\n"
+ "ldr h17, [x21], #0x2\n"
+ "ldr h16, [x20], #0x2\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str s20, [x27, #0x0]\n"
+ "str s19, [x27, #0x40]\n"
+ "str s18, [x27, #0x80]\n"
+ "str s16, [x27, #0xc0]\n"
+ "add x27, x27, #0x4\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x100\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 16f\n"
+ "8:" // Main loop skip
+
+ "9:" // Tail row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add %x[in], x26, %x[in_stride]\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x2\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 11f\n"
+ "10:" // Tail row loop: Column loop
+ "ldr q18, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q16, [x26], #0x10\n"
+ "zip1 v17.8h, v18.8h, v16.8h\n"
+ "ldr q19, [x28], #0x10\n"
+ "cmp x19, #0x10\n"
+ "zip2 v18.8h, v18.8h, v16.8h\n"
+ "ldr q16, [x26], #0x10\n"
+ "str q17, [x27, #0x0]\n"
+ "zip1 v17.8h, v19.8h, v16.8h\n"
+ "str q18, [x27, #0x10]\n"
+ "zip2 v16.8h, v19.8h, v16.8h\n"
+ "str q17, [x27, #0x20]\n"
+ "str q16, [x27, #0x30]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: width 4 loop: loop
+ "ldr d17, [x28], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d16, [x26], #0x8\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "add x27, x27, #0x10\n"
+ "cmp x19, #0x4\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 1 loop: loop
+ "ldr h17, [x28], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h16, [x26], #0x2\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str s16, [x27, #0x0]\n"
+ "add x27, x27, #0x4\n"
+ "cmp x19, #0x1\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x40\n"
+ "cmp %x[height], #0x1\n"
+ "bge 9b\n"
+ "16:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<16, 2, true, VLType::None>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_16_2x2(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x4.hpp
new file mode 100644
index 0000000000..8c8dfd1d0d
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x4.hpp
@@ -0,0 +1,511 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_16_2x4(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 16 * roundup<size_t>(height, 4) * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x8\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q24, [x28], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "ldr q4, [x26], #0x10\n"
+ "cmp x19, #0x20\n"
+ "ldr q26, [x25], #0x10\n"
+ "zip1 v2.8h, v24.8h, v26.8h\n"
+ "ldr q3, [x28], #0x10\n"
+ "zip2 v9.8h, v24.8h, v26.8h\n"
+ "ldr q0, [x26], #0x10\n"
+ "ldr q22, [x25], #0x10\n"
+ "zip1 v31.8h, v3.8h, v22.8h\n"
+ "ldr q23, [x28], #0x10\n"
+ "zip2 v25.8h, v3.8h, v22.8h\n"
+ "ldr q22, [x26], #0x10\n"
+ "ldr q5, [x25], #0x10\n"
+ "zip1 v17.8h, v23.8h, v5.8h\n"
+ "ldr q19, [x28], #0x10\n"
+ "zip2 v20.8h, v23.8h, v5.8h\n"
+ "ldr q1, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v15.8h, v19.8h, v16.8h\n"
+ "ldr q8, [x24], #0x10\n"
+ "zip2 v11.8h, v19.8h, v16.8h\n"
+ "ldr q26, [x23], #0x10\n"
+ "ldr q19, [x22], #0x10\n"
+ "zip1 v5.8h, v4.8h, v8.8h\n"
+ "ldr q18, [x24], #0x10\n"
+ "zip2 v6.8h, v4.8h, v8.8h\n"
+ "ldr q7, [x23], #0x10\n"
+ "zip1 v27.8h, v2.8h, v5.8h\n"
+ "ldr q23, [x22], #0x10\n"
+ "zip2 v8.8h, v2.8h, v5.8h\n"
+ "ldr q24, [x21], #0x10\n"
+ "zip1 v12.8h, v9.8h, v6.8h\n"
+ "ldr q13, [x24], #0x10\n"
+ "zip2 v16.8h, v9.8h, v6.8h\n"
+ "ldr q9, [x23], #0x10\n"
+ "zip1 v29.8h, v0.8h, v18.8h\n"
+ "ldr q10, [x22], #0x10\n"
+ "zip1 v14.8h, v31.8h, v29.8h\n"
+ "ldr q4, [x21], #0x10\n"
+ "zip2 v21.8h, v31.8h, v29.8h\n"
+ "ldr q6, [x24], #0x10\n"
+ "zip2 v18.8h, v0.8h, v18.8h\n"
+ "ldr q3, [x23], #0x10\n"
+ "zip1 v0.8h, v25.8h, v18.8h\n"
+ "ldr q31, [x22], #0x10\n"
+ "zip2 v29.8h, v25.8h, v18.8h\n"
+ "ldr q5, [x21], #0x10\n"
+ "zip1 v28.8h, v26.8h, v24.8h\n"
+ "ldr q25, [x20], #0x10\n"
+ "zip2 v26.8h, v26.8h, v24.8h\n"
+ "ldr q30, [x21], #0x10\n"
+ "zip1 v24.8h, v7.8h, v4.8h\n"
+ "zip2 v4.8h, v7.8h, v4.8h\n"
+ "ldr q18, [x20], #0x10\n"
+ "zip1 v7.8h, v19.8h, v25.8h\n"
+ "ldr q2, [x20], #0x10\n"
+ "zip2 v25.8h, v19.8h, v25.8h\n"
+ "zip1 v19.8h, v28.8h, v7.8h\n"
+ "zip2 v7.8h, v28.8h, v7.8h\n"
+ "ldr q28, [x20], #0x10\n"
+ "str q27, [x27, #0x0]\n"
+ "zip1 v27.8h, v26.8h, v25.8h\n"
+ "zip2 v26.8h, v26.8h, v25.8h\n"
+ "str q8, [x27, #0x10]\n"
+ "zip1 v25.8h, v23.8h, v18.8h\n"
+ "str q12, [x27, #0x20]\n"
+ "zip1 v8.8h, v24.8h, v25.8h\n"
+ "str q16, [x27, #0x30]\n"
+ "zip2 v25.8h, v24.8h, v25.8h\n"
+ "str q14, [x27, #0x40]\n"
+ "zip2 v12.8h, v23.8h, v18.8h\n"
+ "str q21, [x27, #0x50]\n"
+ "zip1 v21.8h, v4.8h, v12.8h\n"
+ "str q0, [x27, #0x60]\n"
+ "zip2 v14.8h, v4.8h, v12.8h\n"
+ "str q29, [x27, #0x70]\n"
+ "zip1 v12.8h, v22.8h, v13.8h\n"
+ "str q19, [x27, #0x80]\n"
+ "zip1 v24.8h, v17.8h, v12.8h\n"
+ "str q7, [x27, #0x90]\n"
+ "zip2 v23.8h, v17.8h, v12.8h\n"
+ "str q27, [x27, #0xa0]\n"
+ "zip2 v16.8h, v22.8h, v13.8h\n"
+ "str q26, [x27, #0xb0]\n"
+ "zip1 v19.8h, v20.8h, v16.8h\n"
+ "str q8, [x27, #0xc0]\n"
+ "zip2 v18.8h, v20.8h, v16.8h\n"
+ "str q25, [x27, #0xd0]\n"
+ "zip1 v16.8h, v1.8h, v6.8h\n"
+ "str q21, [x27, #0xe0]\n"
+ "zip1 v21.8h, v15.8h, v16.8h\n"
+ "str q14, [x27, #0xf0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip2 v17.8h, v15.8h, v16.8h\n"
+ "str q24, [x27, #0x0]\n"
+ "zip2 v16.8h, v1.8h, v6.8h\n"
+ "str q23, [x27, #0x10]\n"
+ "zip1 v20.8h, v11.8h, v16.8h\n"
+ "str q19, [x27, #0x20]\n"
+ "zip2 v19.8h, v11.8h, v16.8h\n"
+ "str q18, [x27, #0x30]\n"
+ "zip1 v18.8h, v9.8h, v5.8h\n"
+ "str q21, [x27, #0x40]\n"
+ "zip1 v16.8h, v10.8h, v2.8h\n"
+ "str q17, [x27, #0x50]\n"
+ "zip1 v17.8h, v18.8h, v16.8h\n"
+ "str q20, [x27, #0x60]\n"
+ "zip2 v16.8h, v18.8h, v16.8h\n"
+ "str q19, [x27, #0x70]\n"
+ "zip2 v18.8h, v9.8h, v5.8h\n"
+ "str q17, [x27, #0x80]\n"
+ "zip2 v17.8h, v10.8h, v2.8h\n"
+ "str q16, [x27, #0x90]\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xa0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xb0]\n"
+ "zip1 v18.8h, v3.8h, v30.8h\n"
+ "zip1 v17.8h, v31.8h, v28.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xc0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xd0]\n"
+ "zip2 v18.8h, v3.8h, v30.8h\n"
+ "zip2 v17.8h, v31.8h, v28.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xe0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xf0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0x10\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q20, [x26], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.8h, v17.8h, v16.8h\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v22.8h, v17.8h, v16.8h\n"
+ "ldr q21, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v0.8h, v18.8h, v17.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v31.8h, v18.8h, v17.8h\n"
+ "ldr q30, [x23], #0x10\n"
+ "ldr q29, [x22], #0x10\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "ldr q18, [x24], #0x10\n"
+ "zip2 v16.8h, v20.8h, v16.8h\n"
+ "ldr q28, [x23], #0x10\n"
+ "zip1 v27.8h, v19.8h, v17.8h\n"
+ "ldr q26, [x22], #0x10\n"
+ "zip2 v20.8h, v19.8h, v17.8h\n"
+ "ldr q25, [x21], #0x10\n"
+ "zip1 v19.8h, v22.8h, v16.8h\n"
+ "ldr q24, [x20], #0x10\n"
+ "zip2 v23.8h, v22.8h, v16.8h\n"
+ "ldr q22, [x21], #0x10\n"
+ "zip1 v17.8h, v21.8h, v18.8h\n"
+ "zip2 v18.8h, v21.8h, v18.8h\n"
+ "ldr q21, [x20], #0x10\n"
+ "zip1 v16.8h, v0.8h, v17.8h\n"
+ "str q27, [x27, #0x0]\n"
+ "zip2 v17.8h, v0.8h, v17.8h\n"
+ "str q20, [x27, #0x10]\n"
+ "zip1 v20.8h, v31.8h, v18.8h\n"
+ "str q19, [x27, #0x20]\n"
+ "zip2 v19.8h, v31.8h, v18.8h\n"
+ "str q23, [x27, #0x30]\n"
+ "zip1 v18.8h, v30.8h, v25.8h\n"
+ "str q16, [x27, #0x40]\n"
+ "zip1 v16.8h, v29.8h, v24.8h\n"
+ "str q17, [x27, #0x50]\n"
+ "zip1 v17.8h, v18.8h, v16.8h\n"
+ "str q20, [x27, #0x60]\n"
+ "zip2 v16.8h, v18.8h, v16.8h\n"
+ "str q19, [x27, #0x70]\n"
+ "zip2 v18.8h, v30.8h, v25.8h\n"
+ "str q17, [x27, #0x80]\n"
+ "zip2 v17.8h, v29.8h, v24.8h\n"
+ "str q16, [x27, #0x90]\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xa0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xb0]\n"
+ "zip1 v18.8h, v28.8h, v22.8h\n"
+ "zip1 v17.8h, v26.8h, v21.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xc0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xd0]\n"
+ "zip2 v18.8h, v28.8h, v22.8h\n"
+ "zip2 v17.8h, v26.8h, v21.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xe0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0xf0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr d17, [x28], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d18, [x26], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d16, [x25], #0x8\n"
+ "zip1 v17.8h, v17.8h, v16.8h\n"
+ "ldr d16, [x24], #0x8\n"
+ "ldr d21, [x23], #0x8\n"
+ "zip1 v16.8h, v18.8h, v16.8h\n"
+ "ldr d20, [x22], #0x8\n"
+ "ldr d19, [x21], #0x8\n"
+ "zip1 v18.8h, v17.8h, v16.8h\n"
+ "zip2 v17.8h, v17.8h, v16.8h\n"
+ "ldr d16, [x20], #0x8\n"
+ "str q18, [x27, #0x0]\n"
+ "zip1 v18.8h, v21.8h, v19.8h\n"
+ "str q17, [x27, #0x10]\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x80]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x90]\n"
+ "add x27, x27, #0x20\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr h18, [x28], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h17, [x26], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h16, [x25], #0x2\n"
+ "zip1 v18.8h, v18.8h, v16.8h\n"
+ "ldr h16, [x24], #0x2\n"
+ "ldr h20, [x23], #0x2\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "ldr h19, [x22], #0x2\n"
+ "ldr h17, [x21], #0x2\n"
+ "zip1 v18.8h, v18.8h, v16.8h\n"
+ "ldr h16, [x20], #0x2\n"
+ "zip1 v17.8h, v20.8h, v17.8h\n"
+ "str d18, [x27, #0x0]\n"
+ "zip1 v16.8h, v19.8h, v16.8h\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str d16, [x27, #0x80]\n"
+ "add x27, x27, #0x8\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x100\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "ldr q19, [x26], #0x10\n"
+ "cmp x19, #0x20\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v20.8h, v17.8h, v16.8h\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v0.8h, v17.8h, v16.8h\n"
+ "ldr q31, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v30.8h, v18.8h, v16.8h\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v29.8h, v18.8h, v16.8h\n"
+ "ldr q28, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v27.8h, v17.8h, v16.8h\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v26.8h, v17.8h, v16.8h\n"
+ "ldr q25, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v24.8h, v18.8h, v17.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v23.8h, v18.8h, v17.8h\n"
+ "ldr q22, [x24], #0x10\n"
+ "zip1 v17.8h, v19.8h, v16.8h\n"
+ "zip2 v19.8h, v19.8h, v16.8h\n"
+ "ldr q21, [x24], #0x10\n"
+ "zip1 v16.8h, v20.8h, v17.8h\n"
+ "zip2 v17.8h, v20.8h, v17.8h\n"
+ "ldr q20, [x24], #0x10\n"
+ "zip1 v18.8h, v0.8h, v19.8h\n"
+ "zip2 v19.8h, v0.8h, v19.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "zip1 v16.8h, v31.8h, v22.8h\n"
+ "str q17, [x27, #0x10]\n"
+ "zip1 v17.8h, v30.8h, v16.8h\n"
+ "str q18, [x27, #0x20]\n"
+ "zip2 v18.8h, v30.8h, v16.8h\n"
+ "str q19, [x27, #0x30]\n"
+ "zip2 v16.8h, v31.8h, v22.8h\n"
+ "str q17, [x27, #0x40]\n"
+ "zip1 v17.8h, v29.8h, v16.8h\n"
+ "str q18, [x27, #0x50]\n"
+ "zip2 v16.8h, v29.8h, v16.8h\n"
+ "str q17, [x27, #0x60]\n"
+ "zip1 v17.8h, v28.8h, v21.8h\n"
+ "str q16, [x27, #0x70]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "zip1 v16.8h, v27.8h, v17.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.8h, v27.8h, v17.8h\n"
+ "zip2 v17.8h, v28.8h, v21.8h\n"
+ "str q16, [x27, #0x10]\n"
+ "zip1 v16.8h, v26.8h, v17.8h\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.8h, v26.8h, v17.8h\n"
+ "str q16, [x27, #0x30]\n"
+ "zip1 v17.8h, v25.8h, v20.8h\n"
+ "zip1 v16.8h, v24.8h, v17.8h\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.8h, v24.8h, v17.8h\n"
+ "str q16, [x27, #0x50]\n"
+ "zip2 v17.8h, v25.8h, v20.8h\n"
+ "zip1 v16.8h, v23.8h, v17.8h\n"
+ "str q16, [x27, #0x60]\n"
+ "zip2 v16.8h, v23.8h, v17.8h\n"
+ "str q16, [x27, #0x70]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0x10\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q25, [x26], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v24.8h, v17.8h, v16.8h\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v23.8h, v17.8h, v16.8h\n"
+ "ldr q22, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v21.8h, v18.8h, v17.8h\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v20.8h, v18.8h, v17.8h\n"
+ "ldr q19, [x24], #0x10\n"
+ "zip1 v18.8h, v25.8h, v16.8h\n"
+ "zip2 v17.8h, v25.8h, v16.8h\n"
+ "zip1 v16.8h, v24.8h, v18.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.8h, v24.8h, v18.8h\n"
+ "str q16, [x27, #0x10]\n"
+ "zip1 v16.8h, v23.8h, v17.8h\n"
+ "str q16, [x27, #0x20]\n"
+ "zip2 v16.8h, v23.8h, v17.8h\n"
+ "str q16, [x27, #0x30]\n"
+ "zip1 v17.8h, v22.8h, v19.8h\n"
+ "zip1 v16.8h, v21.8h, v17.8h\n"
+ "str q16, [x27, #0x40]\n"
+ "zip2 v16.8h, v21.8h, v17.8h\n"
+ "str q16, [x27, #0x50]\n"
+ "zip2 v17.8h, v22.8h, v19.8h\n"
+ "zip1 v16.8h, v20.8h, v17.8h\n"
+ "str q16, [x27, #0x60]\n"
+ "zip2 v16.8h, v20.8h, v17.8h\n"
+ "str q16, [x27, #0x70]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr d18, [x28], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d17, [x26], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d16, [x25], #0x8\n"
+ "zip1 v18.8h, v18.8h, v16.8h\n"
+ "ldr d16, [x24], #0x8\n"
+ "zip1 v17.8h, v17.8h, v16.8h\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x0]\n"
+ "zip2 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x27, #0x10]\n"
+ "add x27, x27, #0x20\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr h17, [x28], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h18, [x26], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h16, [x25], #0x2\n"
+ "zip1 v17.8h, v17.8h, v16.8h\n"
+ "ldr h16, [x24], #0x2\n"
+ "zip1 v16.8h, v18.8h, v16.8h\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str d16, [x27, #0x0]\n"
+ "add x27, x27, #0x8\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x80\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<16, 4, true, VLType::None>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_16_2x4(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x4_fp32bf16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x4_fp32bf16.hpp
new file mode 100644
index 0000000000..2ecf03c4c1
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_16_2x4_fp32bf16.hpp
@@ -0,0 +1,447 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_16_2x4_fp32bf16(bfloat16 *out, const float *in, size_t width, size_t in_stride, size_t height)
+{
+ float *pad_row = reinterpret_cast<float *>(alloca(width * sizeof(float)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(float));
+ }
+
+ size_t out_stride = 16 * roundup<size_t>(height, 4) * sizeof(bfloat16);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x8\n"
+ "blt 8f\n"
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q19, [x26], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v24.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v23.4s, v17.4s, v16.4s\n"
+ "ldr q22, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v21.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v14.4s, v18.4s, v16.4s\n"
+ "ldr q13, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v12.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v11.4s, v17.4s, v16.4s\n"
+ "ldr q10, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v9.4s, v18.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v8.4s, v18.4s, v17.4s\n"
+ "ldr q7, [x23], #0x10\n"
+ "ldr q6, [x22], #0x10\n"
+ "zip1 v17.4s, v19.4s, v16.4s\n"
+ "ldr q20, [x24], #0x10\n"
+ "zip2 v19.4s, v19.4s, v16.4s\n"
+ "ldr q5, [x23], #0x10\n"
+ "zip1 v16.4s, v24.4s, v17.4s\n"
+ "ldr q4, [x22], #0x10\n"
+ ".inst 0x0ea16a03 // bfcvtn v3.4h, v16.4s\n"
+ "ldr q2, [x21], #0x10\n"
+ "zip2 v17.4s, v24.4s, v17.4s\n"
+ "ldr q1, [x24], #0x10\n"
+ "zip1 v16.4s, v23.4s, v19.4s\n"
+ "ldr q0, [x23], #0x10\n"
+ ".inst 0x4ea16a23 // bfcvtn2 v3.8h, v17.4s\n"
+ "ldr q31, [x22], #0x10\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "ldr q30, [x21], #0x10\n"
+ "zip2 v16.4s, v23.4s, v19.4s\n"
+ "ldr q29, [x24], #0x10\n"
+ "zip1 v17.4s, v22.4s, v20.4s\n"
+ "ldr q28, [x23], #0x10\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "ldr q27, [x22], #0x10\n"
+ "zip1 v16.4s, v21.4s, v17.4s\n"
+ "ldr q26, [x21], #0x10\n"
+ ".inst 0x0ea16a19 // bfcvtn v25.4h, v16.4s\n"
+ "ldr q24, [x20], #0x10\n"
+ "zip2 v16.4s, v21.4s, v17.4s\n"
+ "ldr q23, [x21], #0x10\n"
+ ".inst 0x4ea16a19 // bfcvtn2 v25.8h, v16.4s\n"
+ "zip2 v17.4s, v22.4s, v20.4s\n"
+ "ldr q22, [x20], #0x10\n"
+ "zip1 v16.4s, v14.4s, v17.4s\n"
+ "ldr q21, [x20], #0x10\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v16.4s, v14.4s, v17.4s\n"
+ "ldr q20, [x20], #0x10\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "zip1 v17.4s, v13.4s, v1.4s\n"
+ "str q3, [x27, #0x0]\n"
+ "zip1 v16.4s, v12.4s, v17.4s\n"
+ "str q18, [x27, #0x10]\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "str q25, [x27, #0x20]\n"
+ "zip2 v16.4s, v12.4s, v17.4s\n"
+ "str q19, [x27, #0x30]\n"
+ "zip2 v17.4s, v13.4s, v1.4s\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "str q18, [x27, #0x40]\n"
+ "zip1 v16.4s, v11.4s, v17.4s\n"
+ "zip2 v19.4s, v11.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip1 v17.4s, v10.4s, v29.4s\n"
+ "zip1 v16.4s, v9.4s, v17.4s\n"
+ ".inst 0x4ea16a72 // bfcvtn2 v18.8h, v19.4s\n"
+ "str q18, [x27, #0x50]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v9.4s, v17.4s\n"
+ "zip2 v17.4s, v10.4s, v29.4s\n"
+ "zip1 v16.4s, v8.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x60]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v16.4s, v8.4s, v17.4s\n"
+ "zip1 v18.4s, v7.4s, v2.4s\n"
+ "zip1 v17.4s, v6.4s, v24.4s\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "str q19, [x27, #0x70]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v7.4s, v2.4s\n"
+ "zip2 v17.4s, v6.4s, v24.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x80]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v5.4s, v30.4s\n"
+ "zip1 v17.4s, v4.4s, v22.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x90]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v5.4s, v30.4s\n"
+ "zip2 v17.4s, v4.4s, v22.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xa0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v0.4s, v26.4s\n"
+ "zip1 v17.4s, v31.4s, v21.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xb0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v0.4s, v26.4s\n"
+ "zip2 v17.4s, v31.4s, v21.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xc0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v28.4s, v23.4s\n"
+ "zip1 v17.4s, v27.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xd0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v28.4s, v23.4s\n"
+ "zip2 v17.4s, v27.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xe0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v17.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ ".inst 0x4ea16a30 // bfcvtn2 v16.8h, v17.4s\n"
+ "str q16, [x27, #0xf0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 4 loop: loop
+ "ldr q20, [x28], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x26], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v19.4s, v20.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v25.4s, v20.4s, v17.4s\n"
+ "ldr q24, [x23], #0x10\n"
+ "ldr q23, [x22], #0x10\n"
+ "zip1 v17.4s, v18.4s, v16.4s\n"
+ "ldr q22, [x21], #0x10\n"
+ "zip2 v21.4s, v18.4s, v16.4s\n"
+ "ldr q20, [x20], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v19.4s, v17.4s\n"
+ "zip1 v16.4s, v25.4s, v21.4s\n"
+ ".inst 0x4ea16a32 // bfcvtn2 v18.8h, v17.4s\n"
+ "str q18, [x27, #0x0]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v16.4s, v25.4s, v21.4s\n"
+ "zip1 v18.4s, v24.4s, v22.4s\n"
+ "zip1 v17.4s, v23.4s, v20.4s\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "str q19, [x27, #0x10]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v24.4s, v22.4s\n"
+ "zip2 v17.4s, v23.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x80]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v17.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ ".inst 0x4ea16a30 // bfcvtn2 v16.8h, v17.4s\n"
+ "str q16, [x27, #0x90]\n"
+ "add x27, x27, #0x20\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 1 loop: loop
+ "ldr s18, [x28], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s17, [x26], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v18.4s, v18.4s, v16.4s\n"
+ "ldr s16, [x24], #0x4\n"
+ "ldr s20, [x23], #0x4\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ "ldr s19, [x22], #0x4\n"
+ "ldr s17, [x21], #0x4\n"
+ "zip1 v16.4s, v18.4s, v16.4s\n"
+ "ldr s18, [x20], #0x4\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v17.4s, v20.4s, v17.4s\n"
+ "str d16, [x27, #0x0]\n"
+ "zip1 v16.4s, v19.4s, v18.4s\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "str d16, [x27, #0x80]\n"
+ "add x27, x27, #0x8\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x100\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 16f\n"
+ "8:" // Main loop skip
+
+ "9:" // Tail row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 11f\n"
+ "10:" // Tail row loop: Column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q20, [x26], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v1.4s, v17.4s, v16.4s\n"
+ "ldr q0, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v31.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v30.4s, v18.4s, v16.4s\n"
+ "ldr q29, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v28.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v27.4s, v17.4s, v16.4s\n"
+ "ldr q26, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v25.4s, v18.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v24.4s, v18.4s, v17.4s\n"
+ "ldr q23, [x24], #0x10\n"
+ "zip1 v17.4s, v20.4s, v16.4s\n"
+ "zip2 v22.4s, v20.4s, v16.4s\n"
+ "ldr q21, [x24], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ "zip2 v19.4s, v19.4s, v17.4s\n"
+ "ldr q20, [x24], #0x10\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip1 v16.4s, v1.4s, v22.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v16.4s, v1.4s, v22.4s\n"
+ ".inst 0x4ea16a71 // bfcvtn2 v17.8h, v19.4s\n"
+ "str q17, [x27, #0x0]\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "zip1 v17.4s, v0.4s, v23.4s\n"
+ "str q18, [x27, #0x10]\n"
+ "zip1 v16.4s, v31.4s, v17.4s\n"
+ "zip2 v19.4s, v31.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v0.4s, v23.4s\n"
+ "zip1 v16.4s, v30.4s, v17.4s\n"
+ ".inst 0x4ea16a72 // bfcvtn2 v18.8h, v19.4s\n"
+ "str q18, [x27, #0x20]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v30.4s, v17.4s\n"
+ "zip1 v17.4s, v29.4s, v21.4s\n"
+ "zip1 v16.4s, v28.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x30]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v28.4s, v17.4s\n"
+ "zip2 v17.4s, v29.4s, v21.4s\n"
+ "zip1 v16.4s, v27.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x40]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v27.4s, v17.4s\n"
+ "zip1 v17.4s, v26.4s, v20.4s\n"
+ "zip1 v16.4s, v25.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x50]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v17.4s, v25.4s, v17.4s\n"
+ "zip2 v18.4s, v26.4s, v20.4s\n"
+ "zip1 v16.4s, v24.4s, v18.4s\n"
+ ".inst 0x4ea16a33 // bfcvtn2 v19.8h, v17.4s\n"
+ "str q19, [x27, #0x60]\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip2 v16.4s, v24.4s, v18.4s\n"
+ ".inst 0x4ea16a11 // bfcvtn2 v17.8h, v16.4s\n"
+ "str q17, [x27, #0x70]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: width 4 loop: loop
+ "ldr q19, [x28], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x26], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v21.4s, v19.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v20.4s, v19.4s, v17.4s\n"
+ "zip1 v17.4s, v18.4s, v16.4s\n"
+ "zip2 v19.4s, v18.4s, v16.4s\n"
+ "zip1 v16.4s, v21.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v21.4s, v17.4s\n"
+ "zip1 v16.4s, v20.4s, v19.4s\n"
+ ".inst 0x4ea16a32 // bfcvtn2 v18.8h, v17.4s\n"
+ "str q18, [x27, #0x0]\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip2 v16.4s, v20.4s, v19.4s\n"
+ ".inst 0x4ea16a11 // bfcvtn2 v17.8h, v16.4s\n"
+ "str q17, [x27, #0x10]\n"
+ "add x27, x27, #0x20\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 1 loop: loop
+ "ldr s17, [x28], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s18, [x26], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v17.4s, v17.4s, v16.4s\n"
+ "ldr s16, [x24], #0x4\n"
+ "zip1 v16.4s, v18.4s, v16.4s\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "str d16, [x27, #0x0]\n"
+ "add x27, x27, #0x8\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x80\n"
+ "cmp %x[height], #0x1\n"
+ "bge 9b\n"
+ "16:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<16, 4, true, VLType::None>(
+ bfloat16 *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_16_2x4_fp32bf16(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24.hpp
new file mode 100644
index 0000000000..9f3ab95108
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24.hpp
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_24(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 12 * height * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q29, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q18, [x22], #0x10\n"
+ "dup v28.2d, v18.d[1]\n"
+ "ldr q16, [x24], #0x10\n"
+ "cmp x19, #0x18\n"
+ "dup v27.2d, v16.d[0]\n"
+ "ldr q17, [x24], #0x10\n"
+ "dup v26.2d, v16.d[1]\n"
+ "ldr q16, [x22], #0x10\n"
+ "mov v27.d[1], v18.d[0]\n"
+ "ldr q25, [x21], #0x10\n"
+ "ldr q24, [x20], #0x10\n"
+ "mov v26.d[1], v17.d[0]\n"
+ "ldr q23, [x22], #0x10\n"
+ "mov v28.d[1], v16.d[0]\n"
+ "dup v22.2d, v17.d[1]\n"
+ "ldr q17, [x21], #0x10\n"
+ "dup v21.2d, v24.d[1]\n"
+ "ldr q20, [x20], #0x10\n"
+ "mov v22.d[1], v16.d[1]\n"
+ "ldr q16, [x21], #0x10\n"
+ "dup v19.2d, v17.d[0]\n"
+ "dup v18.2d, v17.d[1]\n"
+ "ldr q17, [x20], #0x10\n"
+ "mov v19.d[1], v24.d[0]\n"
+ "str q29, [x23, #0x0]\n"
+ "mov v21.d[1], v20.d[0]\n"
+ "str q27, [x23, #0x10]\n"
+ "str q28, [x23, #0x20]\n"
+ "mov v18.d[1], v16.d[0]\n"
+ "dup v16.2d, v16.d[1]\n"
+ "str q25, [x23, #0x30]\n"
+ "mov v16.d[1], v20.d[1]\n"
+ "str q19, [x23, #0x40]\n"
+ "str q21, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "str q26, [x23, #0x0]\n"
+ "str q22, [x23, #0x10]\n"
+ "str q23, [x23, #0x20]\n"
+ "str q18, [x23, #0x30]\n"
+ "str q16, [x23, #0x40]\n"
+ "str q17, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q22, [x24], #0x10\n"
+ "sub x19, x19, #0xc\n"
+ "ldr q16, [x22], #0x10\n"
+ "dup v21.2d, v16.d[1]\n"
+ "ldr d20, [x24], #0x8\n"
+ "cmp x19, #0xc\n"
+ "mov v20.d[1], v16.d[0]\n"
+ "ldr d16, [x22], #0x8\n"
+ "ldr q19, [x21], #0x10\n"
+ "mov v21.d[1], v16.d[0]\n"
+ "ldr d18, [x21], #0x8\n"
+ "ldr q16, [x20], #0x10\n"
+ "mov v18.d[1], v16.d[0]\n"
+ "ldr d17, [x20], #0x8\n"
+ "dup v16.2d, v16.d[1]\n"
+ "str q22, [x23, #0x0]\n"
+ "str q20, [x23, #0x10]\n"
+ "mov v16.d[1], v17.d[0]\n"
+ "str q21, [x23, #0x20]\n"
+ "str q19, [x23, #0x30]\n"
+ "str q18, [x23, #0x40]\n"
+ "str q16, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr d19, [x24], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d18, [x22], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d17, [x21], #0x8\n"
+ "ldr d16, [x20], #0x8\n"
+ "str d19, [x23, #0x0]\n"
+ "str d18, [x23, #0x18]\n"
+ "str d17, [x23, #0x30]\n"
+ "str d16, [x23, #0x48]\n"
+ "add x23, x23, #0x8\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr h19, [x24], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h18, [x22], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h17, [x21], #0x2\n"
+ "ldr h16, [x20], #0x2\n"
+ "str h19, [x23, #0x0]\n"
+ "str h18, [x23, #0x18]\n"
+ "str h17, [x23, #0x30]\n"
+ "str h16, [x23, #0x48]\n"
+ "add x23, x23, #0x2\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x60\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q19, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "cmp x19, #0x18\n"
+ "ldr q16, [x24], #0x10\n"
+ "dup v18.2d, v16.d[0]\n"
+ "ldr q17, [x24], #0x10\n"
+ "dup v16.2d, v16.d[1]\n"
+ "str q19, [x23, #0x0]\n"
+ "str d18, [x23, #0x10]\n"
+ "mov v16.d[1], v17.d[0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "str q16, [x23, #0x0]\n"
+ "dup v16.2d, v17.d[1]\n"
+ "str d16, [x23, #0x10]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr q17, [x24], #0x10\n"
+ "sub x19, x19, #0xc\n"
+ "cmp x19, #0xc\n"
+ "ldr d16, [x24], #0x8\n"
+ "str q17, [x23, #0x0]\n"
+ "str d16, [x23, #0x10]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "cmp x19, #0x4\n"
+ "str d16, [x23, #0x0]\n"
+ "add x23, x23, #0x8\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr h16, [x24], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "cmp x19, #0x1\n"
+ "str h16, [x23, #0x0]\n"
+ "add x23, x23, #0x2\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x18\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<6, 1, true, VLType::None>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_24(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 2,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<12, 1, true, VLType::None>(
+ int16_t *out, const int16_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_24(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int16_t) / 2,
+ stride * sizeof(int16_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<12, 1, true, VLType::None>(
+ uint16_t *out, const uint16_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_24(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint16_t) / 2,
+ stride * sizeof(uint16_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_2x4_fp32bf16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_2x4_fp32bf16.hpp
new file mode 100644
index 0000000000..101be7e843
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_2x4_fp32bf16.hpp
@@ -0,0 +1,787 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_24_2x4_fp32bf16(bfloat16 *out, const float *in, size_t width, size_t in_stride, size_t height)
+{
+ float *pad_row = reinterpret_cast<float *>(alloca(width * sizeof(float)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(float));
+ }
+
+ size_t out_stride = 24 * roundup<size_t>(height, 4) * sizeof(bfloat16);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x8\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q3, [x28], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q27, [x26], #0x10\n"
+ "cmp x19, #0x18\n"
+ "ldr q26, [x25], #0x10\n"
+ "zip1 v28.4s, v3.4s, v26.4s\n"
+ "ldr q1, [x28], #0x10\n"
+ "zip2 v12.4s, v3.4s, v26.4s\n"
+ "ldr q26, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v11.4s, v1.4s, v17.4s\n"
+ "ldr q31, [x28], #0x10\n"
+ "zip2 v23.4s, v1.4s, v17.4s\n"
+ "ldr q3, [x26], #0x10\n"
+ "ldr q1, [x25], #0x10\n"
+ "zip1 v10.4s, v31.4s, v1.4s\n"
+ "ldr q14, [x28], #0x10\n"
+ "zip2 v17.4s, v31.4s, v1.4s\n"
+ "ldr q6, [x26], #0x10\n"
+ "ldr q1, [x25], #0x10\n"
+ "zip1 v5.4s, v14.4s, v1.4s\n"
+ "ldr q0, [x28], #0x10\n"
+ "zip2 v8.4s, v14.4s, v1.4s\n"
+ "ldr q2, [x26], #0x10\n"
+ "ldr q30, [x25], #0x10\n"
+ "zip1 v15.4s, v0.4s, v30.4s\n"
+ "ldr q14, [x28], #0x10\n"
+ "zip2 v1.4s, v0.4s, v30.4s\n"
+ "ldr q0, [x26], #0x10\n"
+ "ldr q29, [x25], #0x10\n"
+ "zip1 v19.4s, v14.4s, v29.4s\n"
+ "ldr q25, [x24], #0x10\n"
+ "zip2 v30.4s, v14.4s, v29.4s\n"
+ "ldr q7, [x23], #0x10\n"
+ "ldr q31, [x22], #0x10\n"
+ "zip1 v20.4s, v27.4s, v25.4s\n"
+ "ldr q24, [x24], #0x10\n"
+ "zip2 v4.4s, v27.4s, v25.4s\n"
+ "ldr q22, [x23], #0x10\n"
+ "zip1 v14.4s, v28.4s, v20.4s\n"
+ "ldr q13, [x22], #0x10\n"
+ ".inst 0x0ea169d0 // bfcvtn v16.4h, v14.4s\n"
+ "ldr q29, [x21], #0x10\n"
+ "zip2 v21.4s, v28.4s, v20.4s\n"
+ "ldr q27, [x24], #0x10\n"
+ "zip1 v9.4s, v12.4s, v4.4s\n"
+ "ldr q14, [x23], #0x10\n"
+ ".inst 0x4ea16ab0 // bfcvtn2 v16.8h, v21.4s\n"
+ "ldr q21, [x22], #0x10\n"
+ ".inst 0x0ea16929 // bfcvtn v9.4h, v9.4s\n"
+ "ldr q18, [x21], #0x10\n"
+ "zip2 v25.4s, v12.4s, v4.4s\n"
+ "ldr q4, [x24], #0x10\n"
+ "zip1 v28.4s, v26.4s, v24.4s\n"
+ "ldr q20, [x23], #0x10\n"
+ ".inst 0x4ea16b29 // bfcvtn2 v9.8h, v25.4s\n"
+ "ldr q12, [x22], #0x10\n"
+ "zip1 v25.4s, v11.4s, v28.4s\n"
+ ".inst 0x0ea16b39 // bfcvtn v25.4h, v25.4s\n"
+ "zip2 v11.4s, v11.4s, v28.4s\n"
+ "ldr q28, [x24], #0x10\n"
+ "zip2 v26.4s, v26.4s, v24.4s\n"
+ "ldr q24, [x23], #0x10\n"
+ ".inst 0x4ea16979 // bfcvtn2 v25.8h, v11.4s\n"
+ "zip1 v11.4s, v23.4s, v26.4s\n"
+ ".inst 0x0ea1696b // bfcvtn v11.4h, v11.4s\n"
+ "zip2 v23.4s, v23.4s, v26.4s\n"
+ "ldr q26, [x24], #0x10\n"
+ ".inst 0x4ea16aeb // bfcvtn2 v11.8h, v23.4s\n"
+ "zip1 v23.4s, v3.4s, v27.4s\n"
+ "zip2 v27.4s, v3.4s, v27.4s\n"
+ "zip1 v3.4s, v10.4s, v23.4s\n"
+ ".inst 0x0ea16863 // bfcvtn v3.4h, v3.4s\n"
+ "zip2 v10.4s, v10.4s, v23.4s\n"
+ "ldr q23, [x23], #0x10\n"
+ ".inst 0x4ea16943 // bfcvtn2 v3.8h, v10.4s\n"
+ "zip1 v10.4s, v17.4s, v27.4s\n"
+ ".inst 0x0ea1694a // bfcvtn v10.4h, v10.4s\n"
+ "zip2 v27.4s, v17.4s, v27.4s\n"
+ "ldr q17, [x22], #0x10\n"
+ ".inst 0x4ea16b6a // bfcvtn2 v10.8h, v27.4s\n"
+ "zip1 v27.4s, v6.4s, v4.4s\n"
+ "zip2 v6.4s, v6.4s, v4.4s\n"
+ "zip1 v4.4s, v5.4s, v27.4s\n"
+ ".inst 0x0ea16884 // bfcvtn v4.4h, v4.4s\n"
+ "zip2 v27.4s, v5.4s, v27.4s\n"
+ "ldr q5, [x22], #0x10\n"
+ ".inst 0x4ea16b64 // bfcvtn2 v4.8h, v27.4s\n"
+ "zip1 v27.4s, v8.4s, v6.4s\n"
+ ".inst 0x0ea16b7b // bfcvtn v27.4h, v27.4s\n"
+ "zip2 v6.4s, v8.4s, v6.4s\n"
+ "ldr q8, [x21], #0x10\n"
+ ".inst 0x4ea168db // bfcvtn2 v27.8h, v6.4s\n"
+ "zip1 v6.4s, v2.4s, v28.4s\n"
+ "zip2 v2.4s, v2.4s, v28.4s\n"
+ "zip1 v28.4s, v15.4s, v6.4s\n"
+ ".inst 0x0ea16b9c // bfcvtn v28.4h, v28.4s\n"
+ "zip2 v6.4s, v15.4s, v6.4s\n"
+ "ldr q15, [x21], #0x10\n"
+ ".inst 0x4ea168dc // bfcvtn2 v28.8h, v6.4s\n"
+ "zip1 v6.4s, v1.4s, v2.4s\n"
+ ".inst 0x0ea168c6 // bfcvtn v6.4h, v6.4s\n"
+ "zip2 v2.4s, v1.4s, v2.4s\n"
+ "ldr q1, [x21], #0x10\n"
+ ".inst 0x4ea16846 // bfcvtn2 v6.8h, v2.4s\n"
+ "zip1 v2.4s, v0.4s, v26.4s\n"
+ "zip2 v26.4s, v0.4s, v26.4s\n"
+ "zip1 v0.4s, v19.4s, v2.4s\n"
+ ".inst 0x0ea16800 // bfcvtn v0.4h, v0.4s\n"
+ "zip2 v19.4s, v19.4s, v2.4s\n"
+ "ldr q2, [x21], #0x10\n"
+ ".inst 0x4ea16a60 // bfcvtn2 v0.8h, v19.4s\n"
+ "zip1 v19.4s, v30.4s, v26.4s\n"
+ ".inst 0x0ea16a73 // bfcvtn v19.4h, v19.4s\n"
+ "zip2 v30.4s, v30.4s, v26.4s\n"
+ "ldr q26, [x20], #0x10\n"
+ ".inst 0x4ea16bd3 // bfcvtn2 v19.8h, v30.4s\n"
+ "zip1 v30.4s, v7.4s, v29.4s\n"
+ "zip2 v29.4s, v7.4s, v29.4s\n"
+ "zip1 v7.4s, v22.4s, v18.4s\n"
+ "zip2 v18.4s, v22.4s, v18.4s\n"
+ "zip1 v22.4s, v31.4s, v26.4s\n"
+ "zip2 v26.4s, v31.4s, v26.4s\n"
+ "zip1 v31.4s, v30.4s, v22.4s\n"
+ ".inst 0x0ea16bff // bfcvtn v31.4h, v31.4s\n"
+ "zip2 v30.4s, v30.4s, v22.4s\n"
+ "ldr q22, [x20], #0x10\n"
+ ".inst 0x4ea16bdf // bfcvtn2 v31.8h, v30.4s\n"
+ "zip1 v30.4s, v29.4s, v26.4s\n"
+ ".inst 0x0ea16bde // bfcvtn v30.4h, v30.4s\n"
+ "zip2 v26.4s, v29.4s, v26.4s\n"
+ "ldr q29, [x20], #0x10\n"
+ ".inst 0x4ea16b5e // bfcvtn2 v30.8h, v26.4s\n"
+ "zip1 v26.4s, v13.4s, v22.4s\n"
+ "zip2 v13.4s, v13.4s, v22.4s\n"
+ "zip1 v22.4s, v7.4s, v26.4s\n"
+ ".inst 0x0ea16ad6 // bfcvtn v22.4h, v22.4s\n"
+ "zip2 v7.4s, v7.4s, v26.4s\n"
+ "ldr q26, [x20], #0x10\n"
+ ".inst 0x4ea168f6 // bfcvtn2 v22.8h, v7.4s\n"
+ "zip1 v7.4s, v18.4s, v13.4s\n"
+ ".inst 0x0ea168e7 // bfcvtn v7.4h, v7.4s\n"
+ "zip2 v13.4s, v18.4s, v13.4s\n"
+ "ldr q18, [x20], #0x10\n"
+ ".inst 0x4ea169a7 // bfcvtn2 v7.8h, v13.4s\n"
+ "ldr q13, [x20], #0x10\n"
+ "str q16, [x27, #0x0]\n"
+ "zip1 v16.4s, v14.4s, v8.4s\n"
+ "zip2 v8.4s, v14.4s, v8.4s\n"
+ "str q9, [x27, #0x10]\n"
+ "zip1 v9.4s, v21.4s, v29.4s\n"
+ "str q25, [x27, #0x20]\n"
+ "zip1 v25.4s, v16.4s, v9.4s\n"
+ "str q11, [x27, #0x30]\n"
+ ".inst 0x0ea16b2e // bfcvtn v14.4h, v25.4s\n"
+ "str q3, [x27, #0x40]\n"
+ "zip2 v25.4s, v16.4s, v9.4s\n"
+ "str q10, [x27, #0x50]\n"
+ "zip2 v29.4s, v21.4s, v29.4s\n"
+ "str q4, [x27, #0x60]\n"
+ ".inst 0x4ea16b2e // bfcvtn2 v14.8h, v25.4s\n"
+ "str q27, [x27, #0x70]\n"
+ "zip1 v27.4s, v8.4s, v29.4s\n"
+ "str q28, [x27, #0x80]\n"
+ ".inst 0x0ea16b7b // bfcvtn v27.4h, v27.4s\n"
+ "str q6, [x27, #0x90]\n"
+ "zip2 v16.4s, v8.4s, v29.4s\n"
+ "str q0, [x27, #0xa0]\n"
+ "zip1 v0.4s, v20.4s, v15.4s\n"
+ "str q19, [x27, #0xb0]\n"
+ ".inst 0x4ea16a1b // bfcvtn2 v27.8h, v16.4s\n"
+ "str q31, [x27, #0xc0]\n"
+ "zip1 v29.4s, v12.4s, v26.4s\n"
+ "str q30, [x27, #0xd0]\n"
+ "zip1 v28.4s, v0.4s, v29.4s\n"
+ "str q22, [x27, #0xe0]\n"
+ ".inst 0x0ea16b83 // bfcvtn v3.4h, v28.4s\n"
+ "str q7, [x27, #0xf0]\n"
+ "zip2 v22.4s, v0.4s, v29.4s\n"
+ "str q14, [x27, #0x100]\n"
+ "zip2 v19.4s, v20.4s, v15.4s\n"
+ "str q27, [x27, #0x110]\n"
+ ".inst 0x4ea16ac3 // bfcvtn2 v3.8h, v22.4s\n"
+ "str q3, [x27, #0x120]\n"
+ "zip2 v4.4s, v12.4s, v26.4s\n"
+ "zip1 v20.4s, v24.4s, v1.4s\n"
+ "zip1 v22.4s, v19.4s, v4.4s\n"
+ ".inst 0x0ea16ad9 // bfcvtn v25.4h, v22.4s\n"
+ "zip2 v6.4s, v19.4s, v4.4s\n"
+ "zip1 v22.4s, v17.4s, v18.4s\n"
+ ".inst 0x4ea168d9 // bfcvtn2 v25.8h, v6.4s\n"
+ "str q25, [x27, #0x130]\n"
+ "zip1 v3.4s, v20.4s, v22.4s\n"
+ "zip2 v22.4s, v20.4s, v22.4s\n"
+ ".inst 0x0ea16864 // bfcvtn v4.4h, v3.4s\n"
+ "zip2 v15.4s, v24.4s, v1.4s\n"
+ "zip2 v17.4s, v17.4s, v18.4s\n"
+ ".inst 0x4ea16ac4 // bfcvtn2 v4.8h, v22.4s\n"
+ "str q4, [x27, #0x140]\n"
+ "zip1 v16.4s, v15.4s, v17.4s\n"
+ "zip2 v8.4s, v15.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v23.4s, v2.4s\n"
+ "zip1 v17.4s, v5.4s, v13.4s\n"
+ ".inst 0x4ea16910 // bfcvtn2 v16.8h, v8.4s\n"
+ "str q16, [x27, #0x150]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v10.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v23.4s, v2.4s\n"
+ "zip2 v17.4s, v5.4s, v13.4s\n"
+ ".inst 0x4ea16950 // bfcvtn2 v16.8h, v10.4s\n"
+ "str q16, [x27, #0x160]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v17.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ ".inst 0x4ea16a30 // bfcvtn2 v16.8h, v17.4s\n"
+ "str q16, [x27, #0x170]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 16 loop: loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q19, [x26], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v24.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v23.4s, v17.4s, v16.4s\n"
+ "ldr q22, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v21.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v14.4s, v18.4s, v16.4s\n"
+ "ldr q13, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v12.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v11.4s, v17.4s, v16.4s\n"
+ "ldr q10, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v9.4s, v18.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v8.4s, v18.4s, v17.4s\n"
+ "ldr q7, [x23], #0x10\n"
+ "ldr q6, [x22], #0x10\n"
+ "zip1 v17.4s, v19.4s, v16.4s\n"
+ "ldr q20, [x24], #0x10\n"
+ "zip2 v19.4s, v19.4s, v16.4s\n"
+ "ldr q5, [x23], #0x10\n"
+ "zip1 v16.4s, v24.4s, v17.4s\n"
+ "ldr q4, [x22], #0x10\n"
+ ".inst 0x0ea16a03 // bfcvtn v3.4h, v16.4s\n"
+ "ldr q2, [x21], #0x10\n"
+ "zip2 v17.4s, v24.4s, v17.4s\n"
+ "ldr q1, [x24], #0x10\n"
+ "zip1 v16.4s, v23.4s, v19.4s\n"
+ "ldr q0, [x23], #0x10\n"
+ ".inst 0x4ea16a23 // bfcvtn2 v3.8h, v17.4s\n"
+ "ldr q31, [x22], #0x10\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "ldr q30, [x21], #0x10\n"
+ "zip2 v16.4s, v23.4s, v19.4s\n"
+ "ldr q29, [x24], #0x10\n"
+ "zip1 v17.4s, v22.4s, v20.4s\n"
+ "ldr q28, [x23], #0x10\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "ldr q27, [x22], #0x10\n"
+ "zip1 v16.4s, v21.4s, v17.4s\n"
+ "ldr q26, [x21], #0x10\n"
+ ".inst 0x0ea16a19 // bfcvtn v25.4h, v16.4s\n"
+ "ldr q24, [x20], #0x10\n"
+ "zip2 v16.4s, v21.4s, v17.4s\n"
+ "ldr q23, [x21], #0x10\n"
+ ".inst 0x4ea16a19 // bfcvtn2 v25.8h, v16.4s\n"
+ "zip2 v17.4s, v22.4s, v20.4s\n"
+ "ldr q22, [x20], #0x10\n"
+ "zip1 v16.4s, v14.4s, v17.4s\n"
+ "ldr q21, [x20], #0x10\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v16.4s, v14.4s, v17.4s\n"
+ "ldr q20, [x20], #0x10\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "zip1 v17.4s, v13.4s, v1.4s\n"
+ "str q3, [x27, #0x0]\n"
+ "zip1 v16.4s, v12.4s, v17.4s\n"
+ "str q18, [x27, #0x10]\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "str q25, [x27, #0x20]\n"
+ "zip2 v16.4s, v12.4s, v17.4s\n"
+ "str q19, [x27, #0x30]\n"
+ "zip2 v17.4s, v13.4s, v1.4s\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "str q18, [x27, #0x40]\n"
+ "zip1 v16.4s, v11.4s, v17.4s\n"
+ "zip2 v19.4s, v11.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip1 v17.4s, v10.4s, v29.4s\n"
+ "zip1 v16.4s, v9.4s, v17.4s\n"
+ ".inst 0x4ea16a72 // bfcvtn2 v18.8h, v19.4s\n"
+ "str q18, [x27, #0x50]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v9.4s, v17.4s\n"
+ "zip2 v17.4s, v10.4s, v29.4s\n"
+ "zip1 v16.4s, v8.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x60]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v16.4s, v8.4s, v17.4s\n"
+ "zip1 v18.4s, v7.4s, v2.4s\n"
+ "zip1 v17.4s, v6.4s, v24.4s\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "str q19, [x27, #0x70]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v7.4s, v2.4s\n"
+ "zip2 v17.4s, v6.4s, v24.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xc0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v5.4s, v30.4s\n"
+ "zip1 v17.4s, v4.4s, v22.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xd0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v5.4s, v30.4s\n"
+ "zip2 v17.4s, v4.4s, v22.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xe0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v0.4s, v26.4s\n"
+ "zip1 v17.4s, v31.4s, v21.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xf0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v0.4s, v26.4s\n"
+ "zip2 v17.4s, v31.4s, v21.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x100]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v18.4s, v28.4s, v23.4s\n"
+ "zip1 v17.4s, v27.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x110]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v28.4s, v23.4s\n"
+ "zip2 v17.4s, v27.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0x120]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v17.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ ".inst 0x4ea16a30 // bfcvtn2 v16.8h, v17.4s\n"
+ "str q16, [x27, #0x130]\n"
+ "add x27, x27, #0x80\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr q20, [x28], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x26], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v19.4s, v20.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v25.4s, v20.4s, v17.4s\n"
+ "ldr q24, [x23], #0x10\n"
+ "ldr q23, [x22], #0x10\n"
+ "zip1 v17.4s, v18.4s, v16.4s\n"
+ "ldr q22, [x21], #0x10\n"
+ "zip2 v21.4s, v18.4s, v16.4s\n"
+ "ldr q20, [x20], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v19.4s, v17.4s\n"
+ "zip1 v16.4s, v25.4s, v21.4s\n"
+ ".inst 0x4ea16a32 // bfcvtn2 v18.8h, v17.4s\n"
+ "str q18, [x27, #0x0]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v16.4s, v25.4s, v21.4s\n"
+ "zip1 v18.4s, v24.4s, v22.4s\n"
+ "zip1 v17.4s, v23.4s, v20.4s\n"
+ ".inst 0x4ea16a13 // bfcvtn2 v19.8h, v16.4s\n"
+ "str q19, [x27, #0x10]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v19.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip2 v18.4s, v24.4s, v22.4s\n"
+ "zip2 v17.4s, v23.4s, v20.4s\n"
+ ".inst 0x4ea16a70 // bfcvtn2 v16.8h, v19.4s\n"
+ "str q16, [x27, #0xc0]\n"
+ "zip1 v16.4s, v18.4s, v17.4s\n"
+ "zip2 v17.4s, v18.4s, v17.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ ".inst 0x4ea16a30 // bfcvtn2 v16.8h, v17.4s\n"
+ "str q16, [x27, #0xd0]\n"
+ "add x27, x27, #0x20\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr s18, [x28], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s17, [x26], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v18.4s, v18.4s, v16.4s\n"
+ "ldr s16, [x24], #0x4\n"
+ "ldr s20, [x23], #0x4\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ "ldr s19, [x22], #0x4\n"
+ "ldr s17, [x21], #0x4\n"
+ "zip1 v16.4s, v18.4s, v16.4s\n"
+ "ldr s18, [x20], #0x4\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "zip1 v17.4s, v20.4s, v17.4s\n"
+ "str d16, [x27, #0x0]\n"
+ "zip1 v16.4s, v19.4s, v18.4s\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "str d16, [x27, #0xc0]\n"
+ "add x27, x27, #0x8\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x180\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x28, %x[in]\n"
+ "mov x27, %x[out]\n"
+ "add x26, x28, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Column loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q20, [x26], #0x10\n"
+ "cmp x19, #0x18\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v9.4s, v17.4s, v16.4s\n"
+ "ldr q8, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v7.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v6.4s, v18.4s, v16.4s\n"
+ "ldr q5, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v4.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v3.4s, v17.4s, v16.4s\n"
+ "ldr q2, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v1.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v0.4s, v18.4s, v16.4s\n"
+ "ldr q31, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v30.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v29.4s, v17.4s, v16.4s\n"
+ "ldr q28, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v27.4s, v18.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v26.4s, v18.4s, v17.4s\n"
+ "ldr q25, [x24], #0x10\n"
+ "zip1 v17.4s, v20.4s, v16.4s\n"
+ "zip2 v24.4s, v20.4s, v16.4s\n"
+ "ldr q23, [x24], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ "zip2 v17.4s, v19.4s, v17.4s\n"
+ "ldr q22, [x24], #0x10\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip1 v16.4s, v9.4s, v24.4s\n"
+ "ldr q21, [x24], #0x10\n"
+ ".inst 0x4ea16a33 // bfcvtn2 v19.8h, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "ldr q20, [x24], #0x10\n"
+ "zip2 v16.4s, v9.4s, v24.4s\n"
+ "zip1 v17.4s, v8.4s, v25.4s\n"
+ "str q19, [x27, #0x0]\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "str q18, [x27, #0x10]\n"
+ "zip1 v16.4s, v7.4s, v17.4s\n"
+ "zip2 v19.4s, v7.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v8.4s, v25.4s\n"
+ "zip1 v16.4s, v6.4s, v17.4s\n"
+ ".inst 0x4ea16a72 // bfcvtn2 v18.8h, v19.4s\n"
+ "str q18, [x27, #0x20]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v6.4s, v17.4s\n"
+ "zip1 v17.4s, v5.4s, v23.4s\n"
+ "zip1 v16.4s, v4.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x30]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v4.4s, v17.4s\n"
+ "zip2 v17.4s, v5.4s, v23.4s\n"
+ "zip1 v16.4s, v3.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x40]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v3.4s, v17.4s\n"
+ "zip1 v17.4s, v2.4s, v22.4s\n"
+ "zip1 v16.4s, v1.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x50]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v1.4s, v17.4s\n"
+ "zip2 v17.4s, v2.4s, v22.4s\n"
+ "zip1 v16.4s, v0.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x60]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v0.4s, v17.4s\n"
+ "zip1 v17.4s, v31.4s, v21.4s\n"
+ "zip1 v16.4s, v30.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x70]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v30.4s, v17.4s\n"
+ "zip2 v17.4s, v31.4s, v21.4s\n"
+ "zip1 v16.4s, v29.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x80]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v29.4s, v17.4s\n"
+ "zip1 v17.4s, v28.4s, v20.4s\n"
+ "zip1 v16.4s, v27.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x90]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v17.4s, v27.4s, v17.4s\n"
+ "zip2 v18.4s, v28.4s, v20.4s\n"
+ "zip1 v16.4s, v26.4s, v18.4s\n"
+ ".inst 0x4ea16a33 // bfcvtn2 v19.8h, v17.4s\n"
+ "str q19, [x27, #0xa0]\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip2 v16.4s, v26.4s, v18.4s\n"
+ ".inst 0x4ea16a11 // bfcvtn2 v17.8h, v16.4s\n"
+ "str q17, [x27, #0xb0]\n"
+ "add x27, x27, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 16 loop: loop
+ "ldr q17, [x28], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q20, [x26], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v19.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v1.4s, v17.4s, v16.4s\n"
+ "ldr q0, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v31.4s, v18.4s, v16.4s\n"
+ "ldr q17, [x28], #0x10\n"
+ "zip2 v30.4s, v18.4s, v16.4s\n"
+ "ldr q29, [x26], #0x10\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip1 v28.4s, v17.4s, v16.4s\n"
+ "ldr q18, [x28], #0x10\n"
+ "zip2 v27.4s, v17.4s, v16.4s\n"
+ "ldr q26, [x26], #0x10\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v25.4s, v18.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v24.4s, v18.4s, v17.4s\n"
+ "ldr q23, [x24], #0x10\n"
+ "zip1 v17.4s, v20.4s, v16.4s\n"
+ "zip2 v22.4s, v20.4s, v16.4s\n"
+ "ldr q21, [x24], #0x10\n"
+ "zip1 v16.4s, v19.4s, v17.4s\n"
+ "zip2 v19.4s, v19.4s, v17.4s\n"
+ "ldr q20, [x24], #0x10\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip1 v16.4s, v1.4s, v22.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v16.4s, v1.4s, v22.4s\n"
+ ".inst 0x4ea16a71 // bfcvtn2 v17.8h, v19.4s\n"
+ "str q17, [x27, #0x0]\n"
+ ".inst 0x4ea16a12 // bfcvtn2 v18.8h, v16.4s\n"
+ "zip1 v17.4s, v0.4s, v23.4s\n"
+ "str q18, [x27, #0x10]\n"
+ "zip1 v16.4s, v31.4s, v17.4s\n"
+ "zip2 v19.4s, v31.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v0.4s, v23.4s\n"
+ "zip1 v16.4s, v30.4s, v17.4s\n"
+ ".inst 0x4ea16a72 // bfcvtn2 v18.8h, v19.4s\n"
+ "str q18, [x27, #0x20]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v30.4s, v17.4s\n"
+ "zip1 v17.4s, v29.4s, v21.4s\n"
+ "zip1 v16.4s, v28.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x30]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v28.4s, v17.4s\n"
+ "zip2 v17.4s, v29.4s, v21.4s\n"
+ "zip1 v16.4s, v27.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x40]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v18.4s, v27.4s, v17.4s\n"
+ "zip1 v17.4s, v26.4s, v20.4s\n"
+ "zip1 v16.4s, v25.4s, v17.4s\n"
+ ".inst 0x4ea16a53 // bfcvtn2 v19.8h, v18.4s\n"
+ "str q19, [x27, #0x50]\n"
+ ".inst 0x0ea16a13 // bfcvtn v19.4h, v16.4s\n"
+ "zip2 v17.4s, v25.4s, v17.4s\n"
+ "zip2 v18.4s, v26.4s, v20.4s\n"
+ "zip1 v16.4s, v24.4s, v18.4s\n"
+ ".inst 0x4ea16a33 // bfcvtn2 v19.8h, v17.4s\n"
+ "str q19, [x27, #0x60]\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip2 v16.4s, v24.4s, v18.4s\n"
+ ".inst 0x4ea16a11 // bfcvtn2 v17.8h, v16.4s\n"
+ "str q17, [x27, #0x70]\n"
+ "add x27, x27, #0x80\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr q19, [x28], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x26], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x25], #0x10\n"
+ "zip1 v21.4s, v19.4s, v17.4s\n"
+ "ldr q16, [x24], #0x10\n"
+ "zip2 v20.4s, v19.4s, v17.4s\n"
+ "zip1 v17.4s, v18.4s, v16.4s\n"
+ "zip2 v19.4s, v18.4s, v16.4s\n"
+ "zip1 v16.4s, v21.4s, v17.4s\n"
+ ".inst 0x0ea16a12 // bfcvtn v18.4h, v16.4s\n"
+ "zip2 v17.4s, v21.4s, v17.4s\n"
+ "zip1 v16.4s, v20.4s, v19.4s\n"
+ ".inst 0x4ea16a32 // bfcvtn2 v18.8h, v17.4s\n"
+ "str q18, [x27, #0x0]\n"
+ ".inst 0x0ea16a11 // bfcvtn v17.4h, v16.4s\n"
+ "zip2 v16.4s, v20.4s, v19.4s\n"
+ ".inst 0x4ea16a11 // bfcvtn2 v17.8h, v16.4s\n"
+ "str q17, [x27, #0x10]\n"
+ "add x27, x27, #0x20\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr s17, [x28], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s18, [x26], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v17.4s, v17.4s, v16.4s\n"
+ "ldr s16, [x24], #0x4\n"
+ "zip1 v16.4s, v18.4s, v16.4s\n"
+ "zip1 v16.4s, v17.4s, v16.4s\n"
+ ".inst 0x0ea16a10 // bfcvtn v16.4h, v16.4s\n"
+ "str d16, [x27, #0x0]\n"
+ "add x27, x27, #0x8\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0xc0\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<24, 4, true, VLType::None>(
+ bfloat16 *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_24_2x4_fp32bf16(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_bf16fp32.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_bf16fp32.hpp
new file mode 100644
index 0000000000..0a628d372e
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_bf16fp32.hpp
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_24_bf16fp32(float *out, const bfloat16 *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 12 * height * sizeof(float);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q17, [x24], #0x10\n"
+ "shll v3.4s, v17.4h, #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "shll2 v23.4s, v17.8h, #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "cmp x19, #0x18\n"
+ "shll v22.4s, v16.4h, #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "shll2 v2.4s, v16.8h, #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "shll v21.4s, v17.4h, #0x10\n"
+ "ldr q18, [x21], #0x10\n"
+ "shll2 v1.4s, v17.8h, #0x10\n"
+ "ldr q0, [x20], #0x10\n"
+ "shll v31.4s, v19.4h, #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "shll2 v30.4s, v19.8h, #0x10\n"
+ "shll v29.4s, v16.4h, #0x10\n"
+ "ldr q20, [x21], #0x10\n"
+ "shll2 v28.4s, v16.8h, #0x10\n"
+ "ldr q27, [x20], #0x10\n"
+ "shll v19.4s, v18.4h, #0x10\n"
+ "ldr q16, [x21], #0x10\n"
+ "shll v26.4s, v17.4h, #0x10\n"
+ "shll2 v25.4s, v17.8h, #0x10\n"
+ "ldr q24, [x20], #0x10\n"
+ "shll2 v18.4s, v18.8h, #0x10\n"
+ "str q3, [x23, #0x0]\n"
+ "shll v17.4s, v20.4h, #0x10\n"
+ "str q23, [x23, #0x10]\n"
+ "shll2 v23.4s, v20.8h, #0x10\n"
+ "str q22, [x23, #0x20]\n"
+ "shll v22.4s, v16.4h, #0x10\n"
+ "str q21, [x23, #0x30]\n"
+ "shll2 v21.4s, v16.8h, #0x10\n"
+ "str q1, [x23, #0x40]\n"
+ "shll v16.4s, v0.4h, #0x10\n"
+ "str q29, [x23, #0x50]\n"
+ "shll2 v20.4s, v0.8h, #0x10\n"
+ "str q19, [x23, #0x60]\n"
+ "shll v19.4s, v27.4h, #0x10\n"
+ "str q18, [x23, #0x70]\n"
+ "shll2 v18.4s, v27.8h, #0x10\n"
+ "str q17, [x23, #0x80]\n"
+ "shll v17.4s, v24.4h, #0x10\n"
+ "str q16, [x23, #0x90]\n"
+ "shll2 v16.4s, v24.8h, #0x10\n"
+ "str q20, [x23, #0xa0]\n"
+ "str q19, [x23, #0xb0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "str q2, [x23, #0x0]\n"
+ "str q31, [x23, #0x10]\n"
+ "str q30, [x23, #0x20]\n"
+ "str q28, [x23, #0x30]\n"
+ "str q26, [x23, #0x40]\n"
+ "str q25, [x23, #0x50]\n"
+ "str q23, [x23, #0x60]\n"
+ "str q22, [x23, #0x70]\n"
+ "str q21, [x23, #0x80]\n"
+ "str q18, [x23, #0x90]\n"
+ "str q17, [x23, #0xa0]\n"
+ "str q16, [x23, #0xb0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q17, [x24], #0x10\n"
+ "shll v19.4s, v17.4h, #0x10\n"
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "shll2 v27.4s, v17.8h, #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "cmp x19, #0xc\n"
+ "shll v26.4s, v16.4h, #0x10\n"
+ "ldr q16, [x21], #0x10\n"
+ "ldr q25, [x20], #0x10\n"
+ "shll v24.4s, v17.4h, #0x10\n"
+ "shll2 v23.4s, v17.8h, #0x10\n"
+ "ldr d18, [x22], #0x8\n"
+ "shll v22.4s, v16.4h, #0x10\n"
+ "ldr d17, [x21], #0x8\n"
+ "shll2 v21.4s, v16.8h, #0x10\n"
+ "ldr d16, [x20], #0x8\n"
+ "shll v20.4s, v25.4h, #0x10\n"
+ "str q19, [x23, #0x0]\n"
+ "shll v19.4s, v18.4h, #0x10\n"
+ "str q27, [x23, #0x10]\n"
+ "shll2 v18.4s, v25.8h, #0x10\n"
+ "str q26, [x23, #0x20]\n"
+ "shll v17.4s, v17.4h, #0x10\n"
+ "str q24, [x23, #0x30]\n"
+ "shll v16.4s, v16.4h, #0x10\n"
+ "str q23, [x23, #0x40]\n"
+ "str q19, [x23, #0x50]\n"
+ "str q22, [x23, #0x60]\n"
+ "str q21, [x23, #0x70]\n"
+ "str q17, [x23, #0x80]\n"
+ "str q20, [x23, #0x90]\n"
+ "str q18, [x23, #0xa0]\n"
+ "str q16, [x23, #0xb0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr d16, [x24], #0x8\n"
+ "shll v19.4s, v16.4h, #0x10\n"
+ "ldr d16, [x22], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "shll v18.4s, v16.4h, #0x10\n"
+ "ldr d16, [x21], #0x8\n"
+ "cmp x19, #0x4\n"
+ "shll v17.4s, v16.4h, #0x10\n"
+ "ldr d16, [x20], #0x8\n"
+ "str q19, [x23, #0x0]\n"
+ "shll v16.4s, v16.4h, #0x10\n"
+ "str q18, [x23, #0x30]\n"
+ "str q17, [x23, #0x60]\n"
+ "str q16, [x23, #0x90]\n"
+ "add x23, x23, #0x10\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr h16, [x24], #0x2\n"
+ "shll v19.4s, v16.4h, #0x10\n"
+ "ldr h16, [x22], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "shll v18.4s, v16.4h, #0x10\n"
+ "ldr h16, [x21], #0x2\n"
+ "cmp x19, #0x1\n"
+ "shll v17.4s, v16.4h, #0x10\n"
+ "ldr h16, [x20], #0x2\n"
+ "str s19, [x23, #0x0]\n"
+ "shll v16.4s, v16.4h, #0x10\n"
+ "str s18, [x23, #0x30]\n"
+ "str s17, [x23, #0x60]\n"
+ "str s16, [x23, #0x90]\n"
+ "add x23, x23, #0x4\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0xc0\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q16, [x24], #0x10\n"
+ "shll v20.4s, v16.4h, #0x10\n"
+ "ldr q18, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "shll2 v17.4s, v16.8h, #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "shll v16.4s, v18.4h, #0x10\n"
+ "cmp x19, #0x18\n"
+ "shll2 v18.4s, v18.8h, #0x10\n"
+ "str q20, [x23, #0x0]\n"
+ "str q17, [x23, #0x10]\n"
+ "shll v17.4s, v19.4h, #0x10\n"
+ "str q16, [x23, #0x20]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "shll2 v16.4s, v19.8h, #0x10\n"
+ "str q18, [x23, #0x0]\n"
+ "str q17, [x23, #0x10]\n"
+ "str q16, [x23, #0x20]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr q17, [x24], #0x10\n"
+ "shll v18.4s, v17.4h, #0x10\n"
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "shll2 v17.4s, v17.8h, #0x10\n"
+ "str q18, [x23, #0x0]\n"
+ "cmp x19, #0xc\n"
+ "shll v16.4s, v16.4h, #0x10\n"
+ "str q17, [x23, #0x10]\n"
+ "str q16, [x23, #0x20]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr d16, [x24], #0x8\n"
+ "shll v16.4s, v16.4h, #0x10\n"
+ "str q16, [x23, #0x0]\n"
+ "sub x19, x19, #0x4\n"
+ "add x23, x23, #0x10\n"
+ "cmp x19, #0x4\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr h16, [x24], #0x2\n"
+ "shll v16.4s, v16.4h, #0x10\n"
+ "str s16, [x23, #0x0]\n"
+ "sub x19, x19, #0x1\n"
+ "add x23, x23, #0x4\n"
+ "cmp x19, #0x1\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x30\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<12, 1, true, VLType::None>(
+ float *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_24_bf16fp32(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_fp16fp32.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_fp16fp32.hpp
new file mode 100644
index 0000000000..7bac8173e7
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24_fp16fp32.hpp
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_24_fp16fp32(float *out, const __fp16 *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 12 * height * sizeof(float);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q17, [x24], #0x10\n"
+ "fcvtl v3.4s, v17.4h\n"
+ "ldr q16, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "fcvtl2 v23.4s, v17.8h\n"
+ "ldr q17, [x22], #0x10\n"
+ "cmp x19, #0x18\n"
+ "fcvtl v22.4s, v16.4h\n"
+ "ldr q19, [x24], #0x10\n"
+ "fcvtl2 v2.4s, v16.8h\n"
+ "ldr q16, [x22], #0x10\n"
+ "fcvtl v21.4s, v17.4h\n"
+ "ldr q18, [x21], #0x10\n"
+ "fcvtl2 v1.4s, v17.8h\n"
+ "ldr q0, [x20], #0x10\n"
+ "fcvtl v31.4s, v19.4h\n"
+ "ldr q17, [x22], #0x10\n"
+ "fcvtl2 v30.4s, v19.8h\n"
+ "fcvtl v29.4s, v16.4h\n"
+ "ldr q20, [x21], #0x10\n"
+ "fcvtl2 v28.4s, v16.8h\n"
+ "ldr q27, [x20], #0x10\n"
+ "fcvtl v19.4s, v18.4h\n"
+ "ldr q16, [x21], #0x10\n"
+ "fcvtl v26.4s, v17.4h\n"
+ "fcvtl2 v25.4s, v17.8h\n"
+ "ldr q24, [x20], #0x10\n"
+ "fcvtl2 v18.4s, v18.8h\n"
+ "str q3, [x23, #0x0]\n"
+ "fcvtl v17.4s, v20.4h\n"
+ "str q23, [x23, #0x10]\n"
+ "fcvtl2 v23.4s, v20.8h\n"
+ "str q22, [x23, #0x20]\n"
+ "fcvtl v22.4s, v16.4h\n"
+ "str q21, [x23, #0x30]\n"
+ "fcvtl2 v21.4s, v16.8h\n"
+ "str q1, [x23, #0x40]\n"
+ "fcvtl v16.4s, v0.4h\n"
+ "str q29, [x23, #0x50]\n"
+ "fcvtl2 v20.4s, v0.8h\n"
+ "str q19, [x23, #0x60]\n"
+ "fcvtl v19.4s, v27.4h\n"
+ "str q18, [x23, #0x70]\n"
+ "fcvtl2 v18.4s, v27.8h\n"
+ "str q17, [x23, #0x80]\n"
+ "fcvtl v17.4s, v24.4h\n"
+ "str q16, [x23, #0x90]\n"
+ "fcvtl2 v16.4s, v24.8h\n"
+ "str q20, [x23, #0xa0]\n"
+ "str q19, [x23, #0xb0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "str q2, [x23, #0x0]\n"
+ "str q31, [x23, #0x10]\n"
+ "str q30, [x23, #0x20]\n"
+ "str q28, [x23, #0x30]\n"
+ "str q26, [x23, #0x40]\n"
+ "str q25, [x23, #0x50]\n"
+ "str q23, [x23, #0x60]\n"
+ "str q22, [x23, #0x70]\n"
+ "str q21, [x23, #0x80]\n"
+ "str q18, [x23, #0x90]\n"
+ "str q17, [x23, #0xa0]\n"
+ "str q16, [x23, #0xb0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q17, [x24], #0x10\n"
+ "fcvtl v19.4s, v17.4h\n"
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "fcvtl2 v27.4s, v17.8h\n"
+ "ldr q17, [x22], #0x10\n"
+ "cmp x19, #0xc\n"
+ "fcvtl v26.4s, v16.4h\n"
+ "ldr q16, [x21], #0x10\n"
+ "ldr q25, [x20], #0x10\n"
+ "fcvtl v24.4s, v17.4h\n"
+ "fcvtl2 v23.4s, v17.8h\n"
+ "ldr d18, [x22], #0x8\n"
+ "fcvtl v22.4s, v16.4h\n"
+ "ldr d17, [x21], #0x8\n"
+ "fcvtl2 v21.4s, v16.8h\n"
+ "ldr d16, [x20], #0x8\n"
+ "fcvtl v20.4s, v25.4h\n"
+ "str q19, [x23, #0x0]\n"
+ "fcvtl v19.4s, v18.4h\n"
+ "str q27, [x23, #0x10]\n"
+ "fcvtl2 v18.4s, v25.8h\n"
+ "str q26, [x23, #0x20]\n"
+ "fcvtl v17.4s, v17.4h\n"
+ "str q24, [x23, #0x30]\n"
+ "fcvtl v16.4s, v16.4h\n"
+ "str q23, [x23, #0x40]\n"
+ "str q19, [x23, #0x50]\n"
+ "str q22, [x23, #0x60]\n"
+ "str q21, [x23, #0x70]\n"
+ "str q17, [x23, #0x80]\n"
+ "str q20, [x23, #0x90]\n"
+ "str q18, [x23, #0xa0]\n"
+ "str q16, [x23, #0xb0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr d16, [x24], #0x8\n"
+ "fcvtl v19.4s, v16.4h\n"
+ "ldr d16, [x22], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "fcvtl v18.4s, v16.4h\n"
+ "ldr d16, [x21], #0x8\n"
+ "cmp x19, #0x4\n"
+ "fcvtl v17.4s, v16.4h\n"
+ "ldr d16, [x20], #0x8\n"
+ "str q19, [x23, #0x0]\n"
+ "fcvtl v16.4s, v16.4h\n"
+ "str q18, [x23, #0x30]\n"
+ "str q17, [x23, #0x60]\n"
+ "str q16, [x23, #0x90]\n"
+ "add x23, x23, #0x10\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr h16, [x24], #0x2\n"
+ "fcvtl v19.4s, v16.4h\n"
+ "ldr h16, [x22], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "fcvtl v18.4s, v16.4h\n"
+ "ldr h16, [x21], #0x2\n"
+ "cmp x19, #0x1\n"
+ "fcvtl v17.4s, v16.4h\n"
+ "ldr h16, [x20], #0x2\n"
+ "str s19, [x23, #0x0]\n"
+ "fcvtl v16.4s, v16.4h\n"
+ "str s18, [x23, #0x30]\n"
+ "str s17, [x23, #0x60]\n"
+ "str s16, [x23, #0x90]\n"
+ "add x23, x23, #0x4\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0xc0\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Unroll column loop
+ "ldr q16, [x24], #0x10\n"
+ "fcvtl v20.4s, v16.4h\n"
+ "ldr q18, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "fcvtl2 v17.4s, v16.8h\n"
+ "ldr q19, [x24], #0x10\n"
+ "fcvtl v16.4s, v18.4h\n"
+ "cmp x19, #0x18\n"
+ "fcvtl2 v18.4s, v18.8h\n"
+ "str q20, [x23, #0x0]\n"
+ "str q17, [x23, #0x10]\n"
+ "fcvtl v17.4s, v19.4h\n"
+ "str q16, [x23, #0x20]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "fcvtl2 v16.4s, v19.8h\n"
+ "str q18, [x23, #0x0]\n"
+ "str q17, [x23, #0x10]\n"
+ "str q16, [x23, #0x20]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0xc\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Column loop
+ "ldr q17, [x24], #0x10\n"
+ "fcvtl v18.4s, v17.4h\n"
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0xc\n"
+ "fcvtl2 v17.4s, v17.8h\n"
+ "str q18, [x23, #0x0]\n"
+ "fcvtl v16.4s, v16.4h\n"
+ "str q17, [x23, #0x10]\n"
+ "cmp x19, #0xc\n"
+ "str q16, [x23, #0x20]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Column loop skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr d16, [x24], #0x8\n"
+ "fcvtl v16.4s, v16.4h\n"
+ "str q16, [x23, #0x0]\n"
+ "sub x19, x19, #0x4\n"
+ "add x23, x23, #0x10\n"
+ "cmp x19, #0x4\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr h16, [x24], #0x2\n"
+ "fcvtl v16.4s, v16.4h\n"
+ "str s16, [x23, #0x0]\n"
+ "sub x19, x19, #0x1\n"
+ "add x23, x23, #0x4\n"
+ "cmp x19, #0x1\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x30\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<12, 1, true, VLType::None>(
+ float *out, const __fp16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_24_fp16fp32(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(__fp16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24way_16bit.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24way_16bit.hpp
deleted file mode 100644
index bcbe2b84d8..0000000000
--- a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_24way_16bit.hpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2017-2020 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#pragma once
-
-#ifdef __aarch64__
-
-#include "transpose_interleave_common.hpp"
-
-// Generic unblocked transposed 12x32-bit sized specialisation
-template <>
-template <typename T>
-inline void TransformImpl<12, 1, true, 4, 4, VLType::None>::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 24 x uint16_t specialisation
- TransformImpl<24, 1, true, 2, 2, VLType::None>::Transform(
- reinterpret_cast<uint16_t *>(out),
- reinterpret_cast<const uint16_t * const>(in),
- stride*2, x0*2, xmax*2, k0, kmax
- );
-}
-
-// Generic 24x16-bit sized specialisation
-template <>
-template <typename T>
-inline void TransformImpl<24, 1, true, 2, 2, VLType::None>::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 * const>(in),
- stride, x0, xmax, k0, kmax
- );
-}
-
-// Specialised 24 x uint16_t version
-template <>
-inline void TransposeInterleaveCommon<24, uint16_t, uint16_t>::moveblock_1x1(const uint16_t *&in0, uint16_t *out) {
- __asm __volatile (
- "LDP q0, q1, [%[in0]], #32\n"
- "STP q0, q1, [%[out]]\n"
- ASM_PREFETCH("[%[in0], #192]")
- "LDR q2, [%[in0]], #16\n"
- "STR q2, [%[out], #32]\n"
- : [in0] "+r" (in0), [out] "+r" (out)
- :
- : "v0", "v1", "v2", "memory"
- );
-}
-
-template <>
-inline void TransposeInterleaveCommon<24, uint16_t, uint16_t>::moveblock_1x2(const uint16_t *&in0, const uint16_t *&in1,uint16_t *out) {
- __asm __volatile (
- "LDP q0, q1, [%[in0]], #32\n"
- "STP q0, q1, [%[out]]\n"
- ASM_PREFETCH("[%[in0], #192]")
- "LDR q2, [%[in0]], #16\n"
- "LDP q3, q4, [%[in1]], #32\n"
- "STP q2, q3, [%[out], #32]\n"
- ASM_PREFETCH("[%[in1], #192]")
- "LDR q5, [%[in1]], #16\n"
- "STP q4, q5, [%[out], #64]\n"
- : [in0] "+r" (in0), [in1] "+r" (in1), [out] "+r" (out)
- :
- : "v0", "v1", "v2", "v3", "v4", "v5", "memory"
- );
-}
-
-template <>
-inline void TransposeInterleaveCommon<24, uint16_t, uint16_t>::moveblock_1x4(const uint16_t *&in0, const uint16_t *&in1, const uint16_t *&in2, const uint16_t *&in3, uint16_t *out) {
- __asm __volatile (
- "LDP q0, q1, [%[in0]], #32\n"
- "STP q0, q1, [%[out]]\n"
- "LDR q2, [%[in0]], #16\n"
- ASM_PREFETCH("[%[in0], #192]")
- "LDP q3, q4, [%[in1]], #32\n"
- "STP q2, q3, [%[out], #32]\n"
- "LDR q5, [%[in1]], #16\n"
- ASM_PREFETCH("[%[in1], #192]")
- "STP q4, q5, [%[out], #64]\n"
- "LDP q6, q7, [%[in2]], #32\n"
- "STP q6, q7, [%[out], #96]\n"
- "LDR q8, [%[in2]], #16\n"
- ASM_PREFETCH("[%[in2], #192]")
- "LDP q9, q10, [%[in3]], #32\n"
- "STP q8, q9, [%[out], #128]\n"
- "LDR q11, [%[in3]], #16\n"
- "STP q10, q11, [%[out], #160]\n"
- ASM_PREFETCH("[%[in3], #192]")
-
- : [in0] "+r" (in0), [in1] "+r" (in1), [in2] "+r" (in2), [in3] "+r" (in3), [out] "+r" (out)
- :
- : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "memory"
- );
-}
-
-template <>
-template <>
-inline void TransformImpl<24, 1, true, 2, 2, VLType::None>::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<24, uint16_t, uint16_t>::Transform(out, in, stride, x0, xmax, k0, kmax);
-}
-
-#endif // __arch64__
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_32_1x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_32_1x4.hpp
new file mode 100644
index 0000000000..912d512643
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_32_1x4.hpp
@@ -0,0 +1,508 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_32_1x4(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 32 * roundup<size_t>(height, 4) * sizeof(uint8_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x10\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x16, %x[in]\n"
+ "mov x15, %x[out]\n"
+ "add x14, x16, %x[in_stride]\n"
+ "add x13, x14, %x[in_stride]\n"
+ "add x12, x13, %x[in_stride]\n"
+ "add x11, x12, %x[in_stride]\n"
+ "add x10, x11, %x[in_stride]\n"
+ "add x9, x10, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x10\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q14, [x16], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "ldr q7, [x14], #0x10\n"
+ "cmp x19, #0x20\n"
+ "ldr q1, [x13], #0x10\n"
+ "zip1 v0.16b, v14.16b, v1.16b\n"
+ "ldr q2, [x16], #0x10\n"
+ "zip2 v1.16b, v14.16b, v1.16b\n"
+ "ldr q26, [x14], #0x10\n"
+ "ldr q19, [x13], #0x10\n"
+ "zip1 v20.16b, v2.16b, v19.16b\n"
+ "ldr q15, [x12], #0x10\n"
+ "zip2 v14.16b, v2.16b, v19.16b\n"
+ "ldr q30, [x11], #0x10\n"
+ "ldr q29, [x10], #0x10\n"
+ "zip1 v8.16b, v7.16b, v15.16b\n"
+ "ldr q31, [x12], #0x10\n"
+ "zip2 v22.16b, v7.16b, v15.16b\n"
+ "ldr q28, [x11], #0x10\n"
+ "zip1 v25.16b, v0.16b, v8.16b\n"
+ "ldr q23, [x10], #0x10\n"
+ "zip2 v10.16b, v0.16b, v8.16b\n"
+ "ldr q27, [x9], #0x10\n"
+ "zip1 v4.16b, v1.16b, v22.16b\n"
+ "ldr q0, [x28], #0x10\n"
+ "zip2 v5.16b, v1.16b, v22.16b\n"
+ "ldr q13, [x27], #0x10\n"
+ "zip1 v12.16b, v26.16b, v31.16b\n"
+ "ldr q17, [x26], #0x10\n"
+ "zip1 v24.16b, v20.16b, v12.16b\n"
+ "ldr q18, [x9], #0x10\n"
+ "zip2 v12.16b, v20.16b, v12.16b\n"
+ "ldr q6, [x28], #0x10\n"
+ "zip2 v16.16b, v26.16b, v31.16b\n"
+ "ldr q15, [x27], #0x10\n"
+ "zip1 v22.16b, v14.16b, v16.16b\n"
+ "ldr q1, [x26], #0x10\n"
+ "zip2 v9.16b, v14.16b, v16.16b\n"
+ "ldr q8, [x25], #0x10\n"
+ "zip1 v26.16b, v30.16b, v27.16b\n"
+ "ldr q19, [x24], #0x10\n"
+ "zip1 v16.16b, v29.16b, v0.16b\n"
+ "ldr q7, [x23], #0x10\n"
+ "zip1 v11.16b, v26.16b, v16.16b\n"
+ "ldr q14, [x22], #0x10\n"
+ "zip2 v20.16b, v26.16b, v16.16b\n"
+ "ldr q16, [x25], #0x10\n"
+ "zip2 v26.16b, v30.16b, v27.16b\n"
+ "ldr q31, [x24], #0x10\n"
+ "zip2 v21.16b, v29.16b, v0.16b\n"
+ "ldr q0, [x23], #0x10\n"
+ "zip1 v30.16b, v26.16b, v21.16b\n"
+ "ldr q29, [x22], #0x10\n"
+ "zip2 v27.16b, v26.16b, v21.16b\n"
+ "ldr q3, [x21], #0x10\n"
+ "zip1 v21.16b, v28.16b, v18.16b\n"
+ "ldr q2, [x20], #0x10\n"
+ "zip1 v26.16b, v23.16b, v6.16b\n"
+ "zip2 v18.16b, v28.16b, v18.16b\n"
+ "ldr q28, [x21], #0x10\n"
+ "zip2 v23.16b, v23.16b, v6.16b\n"
+ "zip1 v6.16b, v21.16b, v26.16b\n"
+ "zip2 v21.16b, v21.16b, v26.16b\n"
+ "ldr q26, [x20], #0x10\n"
+ "str q25, [x15, #0x0]\n"
+ "zip1 v25.16b, v18.16b, v23.16b\n"
+ "zip2 v23.16b, v18.16b, v23.16b\n"
+ "str q10, [x15, #0x10]\n"
+ "zip1 v18.16b, v13.16b, v8.16b\n"
+ "str q4, [x15, #0x20]\n"
+ "zip1 v10.16b, v17.16b, v19.16b\n"
+ "str q5, [x15, #0x30]\n"
+ "zip1 v5.16b, v18.16b, v10.16b\n"
+ "str q24, [x15, #0x40]\n"
+ "zip2 v24.16b, v18.16b, v10.16b\n"
+ "str q12, [x15, #0x50]\n"
+ "zip2 v18.16b, v13.16b, v8.16b\n"
+ "str q22, [x15, #0x60]\n"
+ "zip2 v17.16b, v17.16b, v19.16b\n"
+ "str q9, [x15, #0x70]\n"
+ "zip1 v9.16b, v18.16b, v17.16b\n"
+ "str q11, [x15, #0x80]\n"
+ "zip2 v12.16b, v18.16b, v17.16b\n"
+ "str q20, [x15, #0x90]\n"
+ "zip1 v20.16b, v15.16b, v16.16b\n"
+ "str q30, [x15, #0xa0]\n"
+ "zip1 v17.16b, v1.16b, v31.16b\n"
+ "str q27, [x15, #0xb0]\n"
+ "zip1 v19.16b, v20.16b, v17.16b\n"
+ "str q6, [x15, #0xc0]\n"
+ "zip2 v18.16b, v20.16b, v17.16b\n"
+ "str q21, [x15, #0xd0]\n"
+ "zip2 v17.16b, v15.16b, v16.16b\n"
+ "str q25, [x15, #0xe0]\n"
+ "zip2 v16.16b, v1.16b, v31.16b\n"
+ "str q23, [x15, #0xf0]\n"
+ "zip1 v22.16b, v17.16b, v16.16b\n"
+ "str q5, [x15, #0x100]\n"
+ "zip2 v21.16b, v17.16b, v16.16b\n"
+ "str q24, [x15, #0x110]\n"
+ "zip1 v17.16b, v7.16b, v3.16b\n"
+ "str q9, [x15, #0x120]\n"
+ "zip1 v16.16b, v14.16b, v2.16b\n"
+ "str q12, [x15, #0x130]\n"
+ "zip1 v20.16b, v17.16b, v16.16b\n"
+ "str q19, [x15, #0x140]\n"
+ "zip2 v19.16b, v17.16b, v16.16b\n"
+ "str q18, [x15, #0x150]\n"
+ "zip2 v18.16b, v7.16b, v3.16b\n"
+ "str q22, [x15, #0x160]\n"
+ "zip2 v16.16b, v14.16b, v2.16b\n"
+ "str q21, [x15, #0x170]\n"
+ "zip1 v17.16b, v18.16b, v16.16b\n"
+ "str q20, [x15, #0x180]\n"
+ "zip2 v16.16b, v18.16b, v16.16b\n"
+ "str q19, [x15, #0x190]\n"
+ "zip1 v18.16b, v0.16b, v28.16b\n"
+ "str q17, [x15, #0x1a0]\n"
+ "zip1 v17.16b, v29.16b, v26.16b\n"
+ "str q16, [x15, #0x1b0]\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x1c0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x1d0]\n"
+ "zip2 v18.16b, v0.16b, v28.16b\n"
+ "zip2 v17.16b, v29.16b, v26.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x1e0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x1f0]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 16 loop: loop
+ "ldr q18, [x16], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q20, [x14], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q17, [x13], #0x10\n"
+ "zip1 v19.16b, v18.16b, v17.16b\n"
+ "ldr q16, [x12], #0x10\n"
+ "zip2 v18.16b, v18.16b, v17.16b\n"
+ "ldr q3, [x11], #0x10\n"
+ "ldr q2, [x10], #0x10\n"
+ "zip1 v17.16b, v20.16b, v16.16b\n"
+ "ldr q1, [x9], #0x10\n"
+ "zip2 v16.16b, v20.16b, v16.16b\n"
+ "ldr q0, [x28], #0x10\n"
+ "zip1 v31.16b, v19.16b, v17.16b\n"
+ "ldr q30, [x27], #0x10\n"
+ "zip2 v20.16b, v19.16b, v17.16b\n"
+ "ldr q29, [x26], #0x10\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr q28, [x25], #0x10\n"
+ "zip2 v18.16b, v18.16b, v16.16b\n"
+ "ldr q27, [x24], #0x10\n"
+ "zip1 v17.16b, v3.16b, v1.16b\n"
+ "ldr q26, [x23], #0x10\n"
+ "zip1 v16.16b, v2.16b, v0.16b\n"
+ "ldr q25, [x22], #0x10\n"
+ "zip1 v24.16b, v17.16b, v16.16b\n"
+ "ldr q23, [x21], #0x10\n"
+ "zip2 v22.16b, v17.16b, v16.16b\n"
+ "ldr q21, [x20], #0x10\n"
+ "zip2 v17.16b, v3.16b, v1.16b\n"
+ "str q31, [x15, #0x0]\n"
+ "zip2 v16.16b, v2.16b, v0.16b\n"
+ "str q20, [x15, #0x10]\n"
+ "zip1 v20.16b, v17.16b, v16.16b\n"
+ "str q19, [x15, #0x20]\n"
+ "zip2 v19.16b, v17.16b, v16.16b\n"
+ "str q18, [x15, #0x30]\n"
+ "zip1 v18.16b, v30.16b, v28.16b\n"
+ "str q24, [x15, #0x80]\n"
+ "zip1 v16.16b, v29.16b, v27.16b\n"
+ "str q22, [x15, #0x90]\n"
+ "zip1 v17.16b, v18.16b, v16.16b\n"
+ "str q20, [x15, #0xa0]\n"
+ "zip2 v16.16b, v18.16b, v16.16b\n"
+ "str q19, [x15, #0xb0]\n"
+ "zip2 v18.16b, v30.16b, v28.16b\n"
+ "str q17, [x15, #0x100]\n"
+ "zip2 v17.16b, v29.16b, v27.16b\n"
+ "str q16, [x15, #0x110]\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x120]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x130]\n"
+ "zip1 v18.16b, v26.16b, v23.16b\n"
+ "zip1 v17.16b, v25.16b, v21.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x180]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x190]\n"
+ "zip2 v18.16b, v26.16b, v23.16b\n"
+ "zip2 v17.16b, v25.16b, v21.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x1a0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x1b0]\n"
+ "add x15, x15, #0x40\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr s18, [x16], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s17, [x14], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s16, [x13], #0x4\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x12], #0x4\n"
+ "ldr s18, [x11], #0x4\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "ldr s20, [x10], #0x4\n"
+ "ldr s17, [x9], #0x4\n"
+ "zip1 v23.16b, v19.16b, v16.16b\n"
+ "ldr s16, [x28], #0x4\n"
+ "zip1 v19.16b, v18.16b, v17.16b\n"
+ "ldr s18, [x27], #0x4\n"
+ "ldr s22, [x26], #0x4\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "ldr s17, [x25], #0x4\n"
+ "zip1 v21.16b, v19.16b, v16.16b\n"
+ "ldr s16, [x24], #0x4\n"
+ "zip1 v18.16b, v18.16b, v17.16b\n"
+ "ldr s20, [x23], #0x4\n"
+ "ldr s19, [x22], #0x4\n"
+ "zip1 v16.16b, v22.16b, v16.16b\n"
+ "ldr s17, [x21], #0x4\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x20], #0x4\n"
+ "zip1 v17.16b, v20.16b, v17.16b\n"
+ "str q23, [x15, #0x0]\n"
+ "str q21, [x15, #0x80]\n"
+ "zip1 v16.16b, v19.16b, v16.16b\n"
+ "str q18, [x15, #0x100]\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x15, #0x180]\n"
+ "add x15, x15, #0x10\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr b18, [x16], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b17, [x14], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b16, [x13], #0x1\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr b16, [x12], #0x1\n"
+ "ldr b18, [x11], #0x1\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "ldr b20, [x10], #0x1\n"
+ "ldr b17, [x9], #0x1\n"
+ "zip1 v23.16b, v19.16b, v16.16b\n"
+ "ldr b16, [x28], #0x1\n"
+ "zip1 v19.16b, v18.16b, v17.16b\n"
+ "ldr b18, [x27], #0x1\n"
+ "ldr b22, [x26], #0x1\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "ldr b17, [x25], #0x1\n"
+ "zip1 v21.16b, v19.16b, v16.16b\n"
+ "ldr b16, [x24], #0x1\n"
+ "zip1 v18.16b, v18.16b, v17.16b\n"
+ "ldr b20, [x23], #0x1\n"
+ "ldr b19, [x22], #0x1\n"
+ "zip1 v16.16b, v22.16b, v16.16b\n"
+ "ldr b17, [x21], #0x1\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr b16, [x20], #0x1\n"
+ "zip1 v17.16b, v20.16b, v17.16b\n"
+ "str s23, [x15, #0x0]\n"
+ "str s21, [x15, #0x80]\n"
+ "zip1 v16.16b, v19.16b, v16.16b\n"
+ "str s18, [x15, #0x100]\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str s16, [x15, #0x180]\n"
+ "add x15, x15, #0x4\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x200\n"
+ "cmp %x[height], #0x10\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x16, %x[in]\n"
+ "mov x15, %x[out]\n"
+ "add x14, x16, %x[in_stride]\n"
+ "add x13, x14, %x[in_stride]\n"
+ "add x12, x13, %x[in_stride]\n"
+ "add %x[in], x12, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x12, x12, %x[pad_row], GT\n"
+ "csel x13, x13, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x14, x14, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Column loop
+ "ldr q17, [x16], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "ldr q25, [x14], #0x10\n"
+ "cmp x19, #0x20\n"
+ "ldr q16, [x13], #0x10\n"
+ "zip1 v24.16b, v17.16b, v16.16b\n"
+ "ldr q18, [x16], #0x10\n"
+ "zip2 v23.16b, v17.16b, v16.16b\n"
+ "ldr q22, [x14], #0x10\n"
+ "ldr q17, [x13], #0x10\n"
+ "zip1 v21.16b, v18.16b, v17.16b\n"
+ "ldr q16, [x12], #0x10\n"
+ "zip2 v20.16b, v18.16b, v17.16b\n"
+ "ldr q19, [x12], #0x10\n"
+ "zip1 v18.16b, v25.16b, v16.16b\n"
+ "zip2 v17.16b, v25.16b, v16.16b\n"
+ "zip1 v16.16b, v24.16b, v18.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v24.16b, v18.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip1 v16.16b, v23.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v16.16b, v23.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "zip1 v17.16b, v22.16b, v19.16b\n"
+ "zip1 v16.16b, v21.16b, v17.16b\n"
+ "str q16, [x15, #0x40]\n"
+ "zip2 v16.16b, v21.16b, v17.16b\n"
+ "str q16, [x15, #0x50]\n"
+ "zip2 v17.16b, v22.16b, v19.16b\n"
+ "zip1 v16.16b, v20.16b, v17.16b\n"
+ "str q16, [x15, #0x60]\n"
+ "zip2 v16.16b, v20.16b, v17.16b\n"
+ "str q16, [x15, #0x70]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 16 loop: loop
+ "ldr q18, [x16], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q21, [x14], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q17, [x13], #0x10\n"
+ "zip1 v20.16b, v18.16b, v17.16b\n"
+ "ldr q16, [x12], #0x10\n"
+ "zip2 v19.16b, v18.16b, v17.16b\n"
+ "zip1 v18.16b, v21.16b, v16.16b\n"
+ "zip2 v17.16b, v21.16b, v16.16b\n"
+ "zip1 v16.16b, v20.16b, v18.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v20.16b, v18.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip1 v16.16b, v19.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v16.16b, v19.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, #0x40\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr s17, [x16], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s18, [x14], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s16, [x13], #0x4\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr s16, [x12], #0x4\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "add x15, x15, #0x10\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr b17, [x16], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b18, [x14], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b16, [x13], #0x1\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr b16, [x12], #0x1\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str s16, [x15, #0x0]\n"
+ "add x15, x15, #0x4\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x80\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<32, 4, true, VLType::None>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_32_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<32, 4, true, VLType::None>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_32_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_32_2x2.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_32_2x2.hpp
new file mode 100644
index 0000000000..05e68daba1
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_32_2x2.hpp
@@ -0,0 +1,452 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_32_2x2(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 2) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 32 * roundup<size_t>(height, 2) * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 12f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[width]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x19, x21, %x[in_stride]\n"
+ "cmp x23, #0x40\n"
+ "add %x[in], x19, %x[in_stride]\n"
+ "mov x20, %x[out]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q14, [x24], #0x10\n"
+ "ldr q10, [x22], #0x10\n"
+ "sub x23, x23, #0x40\n"
+ "zip1 v12.8h, v14.8h, v10.8h\n"
+ "ldr q5, [x21], #0x10\n"
+ "ldr q3, [x19], #0x10\n"
+ "zip2 v31.8h, v14.8h, v10.8h\n"
+ "zip1 v19.8h, v5.8h, v3.8h\n"
+ "ldr q27, [x24], #0x10\n"
+ "ldr q25, [x22], #0x10\n"
+ "zip1 v11.8h, v27.8h, v25.8h\n"
+ "zip2 v24.8h, v27.8h, v25.8h\n"
+ "ldr q6, [x21], #0x10\n"
+ "ldr q29, [x19], #0x10\n"
+ "zip2 v15.8h, v5.8h, v3.8h\n"
+ "zip1 v18.8h, v6.8h, v29.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q9, [x22], #0x10\n"
+ "zip1 v0.8h, v17.8h, v9.8h\n"
+ "zip2 v9.8h, v17.8h, v9.8h\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x19], #0x10\n"
+ "zip2 v8.8h, v6.8h, v29.8h\n"
+ "zip1 v30.8h, v21.8h, v20.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q5, [x22], #0x10\n"
+ "zip1 v13.8h, v17.8h, v5.8h\n"
+ "zip2 v25.8h, v17.8h, v5.8h\n"
+ "ldr q7, [x21], #0x10\n"
+ "ldr q29, [x19], #0x10\n"
+ "zip2 v27.8h, v21.8h, v20.8h\n"
+ "zip1 v14.8h, v7.8h, v29.8h\n"
+ "ldr q28, [x24], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "zip2 v1.8h, v7.8h, v29.8h\n"
+ "cmp x23, #0x40\n"
+ "ldr q10, [x21], #0x10\n"
+ "ldr q21, [x19], #0x10\n"
+ "zip1 v16.8h, v28.8h, v17.8h\n"
+ "zip2 v17.8h, v28.8h, v17.8h\n"
+ "ldr q5, [x24], #0x10\n"
+ "ldr q20, [x22], #0x10\n"
+ "zip1 v3.8h, v5.8h, v20.8h\n"
+ "zip2 v7.8h, v5.8h, v20.8h\n"
+ "ldr q22, [x21], #0x10\n"
+ "ldr q29, [x19], #0x10\n"
+ "zip1 v2.8h, v10.8h, v21.8h\n"
+ "zip2 v5.8h, v10.8h, v21.8h\n"
+ "ldr q21, [x24], #0x10\n"
+ "ldr q20, [x22], #0x10\n"
+ "zip1 v4.8h, v21.8h, v20.8h\n"
+ "zip2 v28.8h, v21.8h, v20.8h\n"
+ "ldr q6, [x21], #0x10\n"
+ "ldr q10, [x19], #0x10\n"
+ "zip1 v26.8h, v22.8h, v29.8h\n"
+ "zip2 v20.8h, v22.8h, v29.8h\n"
+ "ldr q29, [x24], #0x10\n"
+ "ldr q23, [x22], #0x10\n"
+ "zip1 v21.8h, v29.8h, v23.8h\n"
+ "zip2 v23.8h, v29.8h, v23.8h\n"
+ "ldr q22, [x21], #0x10\n"
+ "ldr q29, [x19], #0x10\n"
+ "str q12, [x20, #0x0]\n"
+ "zip1 v12.8h, v6.8h, v10.8h\n"
+ "str q31, [x20, #0x10]\n"
+ "zip2 v6.8h, v6.8h, v10.8h\n"
+ "zip1 v31.8h, v22.8h, v29.8h\n"
+ "str q11, [x20, #0x20]\n"
+ "zip2 v11.8h, v22.8h, v29.8h\n"
+ "str q24, [x20, #0x30]\n"
+ "str q0, [x20, #0x40]\n"
+ "str q9, [x20, #0x50]\n"
+ "str q13, [x20, #0x60]\n"
+ "str q25, [x20, #0x70]\n"
+ "str q19, [x20, #0x80]\n"
+ "str q15, [x20, #0x90]\n"
+ "str q18, [x20, #0xa0]\n"
+ "str q8, [x20, #0xb0]\n"
+ "str q30, [x20, #0xc0]\n"
+ "str q27, [x20, #0xd0]\n"
+ "str q14, [x20, #0xe0]\n"
+ "str q1, [x20, #0xf0]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "str q16, [x20, #0x0]\n"
+ "str q17, [x20, #0x10]\n"
+ "str q3, [x20, #0x20]\n"
+ "str q7, [x20, #0x30]\n"
+ "str q4, [x20, #0x40]\n"
+ "str q28, [x20, #0x50]\n"
+ "str q21, [x20, #0x60]\n"
+ "str q23, [x20, #0x70]\n"
+ "str q2, [x20, #0x80]\n"
+ "str q5, [x20, #0x90]\n"
+ "str q26, [x20, #0xa0]\n"
+ "str q20, [x20, #0xb0]\n"
+ "str q12, [x20, #0xc0]\n"
+ "str q6, [x20, #0xd0]\n"
+ "str q31, [x20, #0xe0]\n"
+ "str q11, [x20, #0xf0]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x23, #0x20\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "sub x23, x23, #0x20\n"
+ "cmp x23, #0x20\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q18, [x19], #0x10\n"
+ "zip1 v1.8h, v17.8h, v16.8h\n"
+ "zip2 v0.8h, v17.8h, v16.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v31.8h, v17.8h, v16.8h\n"
+ "zip2 v30.8h, v17.8h, v16.8h\n"
+ "ldr q20, [x21], #0x10\n"
+ "ldr q19, [x19], #0x10\n"
+ "zip1 v29.8h, v21.8h, v18.8h\n"
+ "zip2 v28.8h, v21.8h, v18.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v27.8h, v17.8h, v16.8h\n"
+ "zip2 v26.8h, v17.8h, v16.8h\n"
+ "ldr q25, [x21], #0x10\n"
+ "ldr q18, [x19], #0x10\n"
+ "zip1 v24.8h, v20.8h, v19.8h\n"
+ "zip2 v23.8h, v20.8h, v19.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v22.8h, v17.8h, v16.8h\n"
+ "zip2 v21.8h, v17.8h, v16.8h\n"
+ "ldr q20, [x21], #0x10\n"
+ "ldr q16, [x19], #0x10\n"
+ "zip1 v19.8h, v25.8h, v18.8h\n"
+ "zip2 v18.8h, v25.8h, v18.8h\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "zip2 v16.8h, v20.8h, v16.8h\n"
+ "str q1, [x20, #0x0]\n"
+ "str q0, [x20, #0x10]\n"
+ "str q31, [x20, #0x20]\n"
+ "str q30, [x20, #0x30]\n"
+ "str q27, [x20, #0x40]\n"
+ "str q26, [x20, #0x50]\n"
+ "str q22, [x20, #0x60]\n"
+ "str q21, [x20, #0x70]\n"
+ "str q29, [x20, #0x80]\n"
+ "str q28, [x20, #0x90]\n"
+ "str q24, [x20, #0xa0]\n"
+ "str q23, [x20, #0xb0]\n"
+ "str q19, [x20, #0xc0]\n"
+ "str q18, [x20, #0xd0]\n"
+ "str q17, [x20, #0xe0]\n"
+ "str q16, [x20, #0xf0]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x23, #0x10\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 16 loop: loop
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "sub x23, x23, #0x10\n"
+ "cmp x23, #0x10\n"
+ "ldr q24, [x21], #0x10\n"
+ "ldr q23, [x19], #0x10\n"
+ "zip1 v19.8h, v17.8h, v16.8h\n"
+ "zip2 v18.8h, v17.8h, v16.8h\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v22.8h, v17.8h, v16.8h\n"
+ "zip2 v21.8h, v17.8h, v16.8h\n"
+ "ldr q20, [x21], #0x10\n"
+ "ldr q16, [x19], #0x10\n"
+ "str q19, [x20, #0x0]\n"
+ "zip1 v19.8h, v24.8h, v23.8h\n"
+ "str q18, [x20, #0x10]\n"
+ "zip2 v18.8h, v24.8h, v23.8h\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "str q22, [x20, #0x20]\n"
+ "zip2 v16.8h, v20.8h, v16.8h\n"
+ "str q21, [x20, #0x30]\n"
+ "str q19, [x20, #0x80]\n"
+ "str q18, [x20, #0x90]\n"
+ "str q17, [x20, #0xa0]\n"
+ "str q16, [x20, #0xb0]\n"
+ "add x20, x20, #0x40\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 16 loop: skip
+ "cmp x23, #0x4\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 4 loop: loop
+ "ldr d19, [x24], #0x8\n"
+ "ldr d16, [x22], #0x8\n"
+ "sub x23, x23, #0x4\n"
+ "cmp x23, #0x4\n"
+ "ldr d18, [x21], #0x8\n"
+ "ldr d17, [x19], #0x8\n"
+ "zip1 v16.8h, v19.8h, v16.8h\n"
+ "str q16, [x20, #0x0]\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str q16, [x20, #0x80]\n"
+ "add x20, x20, #0x10\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 4 loop: skip
+ "cmp x23, #0x1\n"
+ "blt 11f\n"
+ "10:" // Main row loop: width 1 loop: loop
+ "ldr h19, [x24], #0x2\n"
+ "ldr h16, [x22], #0x2\n"
+ "sub x23, x23, #0x1\n"
+ "cmp x23, #0x1\n"
+ "ldr h18, [x21], #0x2\n"
+ "ldr h17, [x19], #0x2\n"
+ "zip1 v16.8h, v19.8h, v16.8h\n"
+ "str s16, [x20, #0x0]\n"
+ "zip1 v16.8h, v18.8h, v17.8h\n"
+ "str s16, [x20, #0x80]\n"
+ "add x20, x20, #0x4\n"
+ "bge 10b\n"
+ "11:" // Main row loop: width 1 loop: skip
+ "cmp %x[height], #0x4\n"
+ "add %x[out], %x[out], #0x100\n"
+ "bge 1b\n"
+ "cbz %x[height], 24f\n"
+ "12:" // Main loop skip
+
+ "13:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x19, %x[width]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "cmp %x[height], #0x1\n"
+ "add %x[in], x22, %x[in_stride]\n"
+ "csel x22, x22, %x[pad_row], GT\n"
+ "cmp x19, #0x40\n"
+ "mov x20, %x[out]\n"
+ "sub %x[height], %x[height], #0x2\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: Unroll column loop
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "sub x19, x19, #0x40\n"
+ "zip1 v0.8h, v18.8h, v17.8h\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip2 v31.8h, v18.8h, v17.8h\n"
+ "zip1 v30.8h, v19.8h, v16.8h\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "zip2 v29.8h, v19.8h, v16.8h\n"
+ "zip1 v28.8h, v18.8h, v17.8h\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip2 v27.8h, v18.8h, v17.8h\n"
+ "zip1 v26.8h, v19.8h, v16.8h\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "zip2 v25.8h, v19.8h, v16.8h\n"
+ "cmp x19, #0x40\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v24.8h, v18.8h, v17.8h\n"
+ "zip2 v23.8h, v18.8h, v17.8h\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "zip1 v22.8h, v19.8h, v16.8h\n"
+ "zip2 v21.8h, v19.8h, v16.8h\n"
+ "ldr q20, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "str q0, [x20, #0x0]\n"
+ "zip1 v19.8h, v18.8h, v17.8h\n"
+ "str q31, [x20, #0x10]\n"
+ "zip2 v18.8h, v18.8h, v17.8h\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "str q30, [x20, #0x20]\n"
+ "zip2 v16.8h, v20.8h, v16.8h\n"
+ "str q29, [x20, #0x30]\n"
+ "str q28, [x20, #0x40]\n"
+ "str q27, [x20, #0x50]\n"
+ "str q26, [x20, #0x60]\n"
+ "str q25, [x20, #0x70]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "str q24, [x20, #0x0]\n"
+ "str q23, [x20, #0x10]\n"
+ "str q22, [x20, #0x20]\n"
+ "str q21, [x20, #0x30]\n"
+ "str q19, [x20, #0x40]\n"
+ "str q18, [x20, #0x50]\n"
+ "str q17, [x20, #0x60]\n"
+ "str q16, [x20, #0x70]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0x20\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: Column loop
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "cmp x19, #0x20\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v24.8h, v18.8h, v17.8h\n"
+ "zip2 v23.8h, v18.8h, v17.8h\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "zip1 v22.8h, v19.8h, v16.8h\n"
+ "zip2 v21.8h, v19.8h, v16.8h\n"
+ "ldr q20, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v19.8h, v18.8h, v17.8h\n"
+ "zip2 v18.8h, v18.8h, v17.8h\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "zip2 v16.8h, v20.8h, v16.8h\n"
+ "str q24, [x20, #0x0]\n"
+ "str q23, [x20, #0x10]\n"
+ "str q22, [x20, #0x20]\n"
+ "str q21, [x20, #0x30]\n"
+ "str q19, [x20, #0x40]\n"
+ "str q18, [x20, #0x50]\n"
+ "str q17, [x20, #0x60]\n"
+ "str q16, [x20, #0x70]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 16 loop: loop
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x22], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q20, [x24], #0x10\n"
+ "ldr q16, [x22], #0x10\n"
+ "zip1 v19.8h, v18.8h, v17.8h\n"
+ "zip2 v18.8h, v18.8h, v17.8h\n"
+ "zip1 v17.8h, v20.8h, v16.8h\n"
+ "zip2 v16.8h, v20.8h, v16.8h\n"
+ "str q19, [x20, #0x0]\n"
+ "str q18, [x20, #0x10]\n"
+ "str q17, [x20, #0x20]\n"
+ "str q16, [x20, #0x30]\n"
+ "add x20, x20, #0x40\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 21f\n"
+ "20:" // Tail row loop: width 4 loop: loop
+ "ldr d17, [x24], #0x8\n"
+ "ldr d16, [x22], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "cmp x19, #0x4\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str q16, [x20, #0x0]\n"
+ "add x20, x20, #0x10\n"
+ "bge 20b\n"
+ "21:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 23f\n"
+ "22:" // Tail row loop: width 1 loop: loop
+ "ldr h17, [x24], #0x2\n"
+ "ldr h16, [x22], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "cmp x19, #0x1\n"
+ "zip1 v16.8h, v17.8h, v16.8h\n"
+ "str s16, [x20, #0x0]\n"
+ "add x20, x20, #0x4\n"
+ "bge 22b\n"
+ "23:" // Tail row loop: width 1 loop: skip
+ "cmp %x[height], #0x1\n"
+ "add %x[out], %x[out], #0x80\n"
+ "bge 13b\n"
+ "24:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<32, 2, true, VLType::None>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_32_2x2(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_48.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_48.hpp
new file mode 100644
index 0000000000..4f7019f564
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_48.hpp
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_48(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 24 * height * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q27, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q26, [x22], #0x10\n"
+ "cmp x19, #0x18\n"
+ "ldr q25, [x21], #0x10\n"
+ "ldr q24, [x20], #0x10\n"
+ "ldr q23, [x24], #0x10\n"
+ "ldr q22, [x22], #0x10\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x20], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q27, [x23, #0x0]\n"
+ "str q23, [x23, #0x10]\n"
+ "str q19, [x23, #0x20]\n"
+ "str q26, [x23, #0x30]\n"
+ "str q22, [x23, #0x40]\n"
+ "str q18, [x23, #0x50]\n"
+ "str q25, [x23, #0x60]\n"
+ "str q21, [x23, #0x70]\n"
+ "str q17, [x23, #0x80]\n"
+ "str q24, [x23, #0x90]\n"
+ "str q20, [x23, #0xa0]\n"
+ "str q16, [x23, #0xb0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 16 loop: loop
+ "ldr q23, [x24], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q22, [x22], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x20], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q23, [x23, #0x0]\n"
+ "str q19, [x23, #0x10]\n"
+ "str q22, [x23, #0x30]\n"
+ "str q18, [x23, #0x40]\n"
+ "str q21, [x23, #0x60]\n"
+ "str q17, [x23, #0x70]\n"
+ "str q20, [x23, #0x90]\n"
+ "str q16, [x23, #0xa0]\n"
+ "add x23, x23, #0x20\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr d19, [x24], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d18, [x22], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d17, [x21], #0x8\n"
+ "ldr d16, [x20], #0x8\n"
+ "str d19, [x23, #0x0]\n"
+ "str d18, [x23, #0x30]\n"
+ "str d17, [x23, #0x60]\n"
+ "str d16, [x23, #0x90]\n"
+ "add x23, x23, #0x8\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr h19, [x24], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h18, [x22], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h17, [x21], #0x2\n"
+ "ldr h16, [x20], #0x2\n"
+ "str h19, [x23, #0x0]\n"
+ "str h18, [x23, #0x30]\n"
+ "str h17, [x23, #0x60]\n"
+ "str h16, [x23, #0x90]\n"
+ "add x23, x23, #0x2\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0xc0\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Column loop
+ "ldr q18, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "cmp x19, #0x18\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "str q18, [x23, #0x0]\n"
+ "str q17, [x23, #0x10]\n"
+ "str q16, [x23, #0x20]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 16 loop: loop
+ "ldr q17, [x24], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "str q17, [x23, #0x0]\n"
+ "str q16, [x23, #0x10]\n"
+ "add x23, x23, #0x20\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "cmp x19, #0x4\n"
+ "str d16, [x23, #0x0]\n"
+ "add x23, x23, #0x8\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr h16, [x24], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "cmp x19, #0x1\n"
+ "str h16, [x23, #0x0]\n"
+ "add x23, x23, #0x2\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x30\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<12, 1, true, VLType::None>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_48(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 2,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<24, 1, true, VLType::None>(
+ __fp16 *out, const __fp16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_48(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(__fp16) / 2,
+ stride * sizeof(__fp16),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<6, 1, true, VLType::None>(
+ double *out, const double *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_48(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(double) / 2,
+ stride * sizeof(double),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_4_1x16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_4_1x16.hpp
new file mode 100644
index 0000000000..cb20172364
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_4_1x16.hpp
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_4_1x16(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 16) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 4 * roundup<size_t>(height, 16) * sizeof(uint8_t);
+
+ __asm__ __volatile__(
+
+ "1:" // Main row loop: Head
+ "mov x16, %x[in]\n"
+ "mov x15, %x[out]\n"
+ "add x14, x16, %x[in_stride]\n"
+ "add x13, x14, %x[in_stride]\n"
+ "add x12, x13, %x[in_stride]\n"
+ "add x11, x12, %x[in_stride]\n"
+ "add x10, x11, %x[in_stride]\n"
+ "add x9, x10, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "cmp %x[height], #0xf\n"
+ "csel x20, x20, %x[pad_row], GT\n"
+ "csel x21, x21, %x[pad_row], GE\n"
+ "cmp %x[height], #0xd\n"
+ "csel x22, x22, %x[pad_row], GT\n"
+ "csel x23, x23, %x[pad_row], GE\n"
+ "cmp %x[height], #0xb\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x9\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "csel x27, x27, %x[pad_row], GE\n"
+ "cmp %x[height], #0x7\n"
+ "csel x28, x28, %x[pad_row], GT\n"
+ "csel x9, x9, %x[pad_row], GE\n"
+ "cmp %x[height], #0x5\n"
+ "csel x10, x10, %x[pad_row], GT\n"
+ "csel x11, x11, %x[pad_row], GE\n"
+ "cmp %x[height], #0x3\n"
+ "csel x12, x12, %x[pad_row], GT\n"
+ "csel x13, x13, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x14, x14, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x10\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q20, [x16], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q19, [x14], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q18, [x13], #0x10\n"
+ "ldr q11, [x12], #0x10\n"
+ "ldr q10, [x11], #0x10\n"
+ "ldr q9, [x10], #0x10\n"
+ "ldr q8, [x9], #0x10\n"
+ "ldr q7, [x28], #0x10\n"
+ "ldr q16, [x27], #0x10\n"
+ "zip1 v6.16b, v20.16b, v16.16b\n"
+ "ldr q17, [x26], #0x10\n"
+ "zip2 v5.16b, v20.16b, v16.16b\n"
+ "ldr q16, [x25], #0x10\n"
+ "ldr q4, [x24], #0x10\n"
+ "zip1 v3.16b, v19.16b, v17.16b\n"
+ "ldr q2, [x23], #0x10\n"
+ "zip2 v1.16b, v19.16b, v17.16b\n"
+ "ldr q0, [x22], #0x10\n"
+ "zip1 v31.16b, v18.16b, v16.16b\n"
+ "ldr q30, [x21], #0x10\n"
+ "zip1 v27.16b, v11.16b, v4.16b\n"
+ "ldr q29, [x20], #0x10\n"
+ "zip2 v28.16b, v18.16b, v16.16b\n"
+ "zip1 v26.16b, v10.16b, v2.16b\n"
+ "zip1 v22.16b, v6.16b, v26.16b\n"
+ "zip1 v25.16b, v8.16b, v30.16b\n"
+ "zip1 v21.16b, v31.16b, v25.16b\n"
+ "zip1 v18.16b, v22.16b, v21.16b\n"
+ "zip1 v24.16b, v9.16b, v0.16b\n"
+ "zip1 v20.16b, v3.16b, v24.16b\n"
+ "zip1 v23.16b, v7.16b, v29.16b\n"
+ "zip1 v19.16b, v27.16b, v23.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip2 v18.16b, v22.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "zip2 v22.16b, v6.16b, v26.16b\n"
+ "zip2 v21.16b, v31.16b, v25.16b\n"
+ "zip1 v18.16b, v22.16b, v21.16b\n"
+ "zip2 v20.16b, v3.16b, v24.16b\n"
+ "zip2 v19.16b, v27.16b, v23.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip2 v18.16b, v22.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "zip2 v27.16b, v10.16b, v2.16b\n"
+ "zip2 v26.16b, v8.16b, v30.16b\n"
+ "zip1 v22.16b, v5.16b, v27.16b\n"
+ "zip1 v21.16b, v28.16b, v26.16b\n"
+ "zip1 v18.16b, v22.16b, v21.16b\n"
+ "zip2 v25.16b, v9.16b, v0.16b\n"
+ "zip1 v20.16b, v1.16b, v25.16b\n"
+ "zip2 v24.16b, v11.16b, v4.16b\n"
+ "zip2 v23.16b, v7.16b, v29.16b\n"
+ "zip1 v19.16b, v24.16b, v23.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip2 v18.16b, v22.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "zip2 v22.16b, v5.16b, v27.16b\n"
+ "zip2 v21.16b, v28.16b, v26.16b\n"
+ "zip1 v18.16b, v22.16b, v21.16b\n"
+ "zip2 v20.16b, v1.16b, v25.16b\n"
+ "zip2 v19.16b, v24.16b, v23.16b\n"
+ "zip1 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip2 v18.16b, v22.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0x4\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr s17, [x16], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s20, [x14], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s18, [x13], #0x4\n"
+ "ldr s19, [x12], #0x4\n"
+ "ldr s27, [x11], #0x4\n"
+ "ldr s22, [x10], #0x4\n"
+ "ldr s26, [x9], #0x4\n"
+ "ldr s25, [x28], #0x4\n"
+ "ldr s16, [x27], #0x4\n"
+ "zip1 v21.16b, v17.16b, v16.16b\n"
+ "ldr s17, [x26], #0x4\n"
+ "ldr s16, [x25], #0x4\n"
+ "zip1 v24.16b, v18.16b, v16.16b\n"
+ "ldr s18, [x24], #0x4\n"
+ "zip1 v20.16b, v20.16b, v17.16b\n"
+ "ldr s17, [x23], #0x4\n"
+ "ldr s16, [x22], #0x4\n"
+ "zip1 v23.16b, v19.16b, v18.16b\n"
+ "ldr s18, [x21], #0x4\n"
+ "ldr s19, [x20], #0x4\n"
+ "zip1 v17.16b, v27.16b, v17.16b\n"
+ "zip1 v16.16b, v22.16b, v16.16b\n"
+ "zip1 v22.16b, v21.16b, v17.16b\n"
+ "zip1 v21.16b, v20.16b, v16.16b\n"
+ "zip1 v16.16b, v26.16b, v18.16b\n"
+ "zip1 v20.16b, v24.16b, v16.16b\n"
+ "zip1 v18.16b, v22.16b, v20.16b\n"
+ "zip1 v16.16b, v25.16b, v19.16b\n"
+ "zip1 v19.16b, v23.16b, v16.16b\n"
+ "zip1 v17.16b, v21.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip2 v18.16b, v22.16b, v20.16b\n"
+ "zip2 v17.16b, v21.16b, v19.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x1\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 1 loop: loop
+ "ldr b17, [x16], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b21, [x14], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b18, [x13], #0x1\n"
+ "ldr b20, [x12], #0x1\n"
+ "ldr b27, [x11], #0x1\n"
+ "ldr b26, [x10], #0x1\n"
+ "ldr b25, [x9], #0x1\n"
+ "ldr b24, [x28], #0x1\n"
+ "ldr b16, [x27], #0x1\n"
+ "zip1 v23.16b, v17.16b, v16.16b\n"
+ "ldr b17, [x26], #0x1\n"
+ "ldr b16, [x25], #0x1\n"
+ "zip1 v22.16b, v18.16b, v16.16b\n"
+ "ldr b19, [x24], #0x1\n"
+ "zip1 v18.16b, v21.16b, v17.16b\n"
+ "ldr b17, [x23], #0x1\n"
+ "ldr b16, [x22], #0x1\n"
+ "zip1 v21.16b, v20.16b, v19.16b\n"
+ "ldr b20, [x21], #0x1\n"
+ "ldr b19, [x20], #0x1\n"
+ "zip1 v17.16b, v27.16b, v17.16b\n"
+ "zip1 v16.16b, v26.16b, v16.16b\n"
+ "zip1 v17.16b, v23.16b, v17.16b\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v25.16b, v20.16b\n"
+ "zip1 v16.16b, v22.16b, v16.16b\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "zip1 v16.16b, v24.16b, v19.16b\n"
+ "zip1 v16.16b, v21.16b, v16.16b\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "add x15, x15, #0x10\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x40\n"
+ "cmp %x[height], #0x1\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<4, 16, true, VLType::None>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_4_1x16(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<4, 16, true, VLType::None>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_4_1x16(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_4_1x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_4_1x4.hpp
new file mode 100644
index 0000000000..27cebe26cf
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_4_1x4.hpp
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_4_1x4(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 4 * roundup<size_t>(height, 4) * sizeof(uint8_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x10\n"
+ "blt 8f\n"
+ "1:" // Main row loop: Head
+ "mov x16, %x[in]\n"
+ "mov x15, %x[out]\n"
+ "add x14, x16, %x[in_stride]\n"
+ "add x13, x14, %x[in_stride]\n"
+ "add x12, x13, %x[in_stride]\n"
+ "add x11, x12, %x[in_stride]\n"
+ "add x10, x11, %x[in_stride]\n"
+ "add x9, x10, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x10\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ldr q20, [x16], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q19, [x14], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x13], #0x10\n"
+ "zip1 v18.16b, v20.16b, v16.16b\n"
+ "ldr q17, [x12], #0x10\n"
+ "zip2 v5.16b, v20.16b, v16.16b\n"
+ "ldr q4, [x11], #0x10\n"
+ "ldr q3, [x10], #0x10\n"
+ "zip1 v16.16b, v19.16b, v17.16b\n"
+ "ldr q2, [x9], #0x10\n"
+ "zip2 v1.16b, v19.16b, v17.16b\n"
+ "ldr q0, [x28], #0x10\n"
+ "zip1 v22.16b, v18.16b, v16.16b\n"
+ "ldr q31, [x27], #0x10\n"
+ "zip2 v21.16b, v18.16b, v16.16b\n"
+ "ldr q30, [x26], #0x10\n"
+ "zip1 v29.16b, v5.16b, v1.16b\n"
+ "ldr q28, [x25], #0x10\n"
+ "zip1 v17.16b, v4.16b, v2.16b\n"
+ "ldr q27, [x24], #0x10\n"
+ "zip1 v16.16b, v3.16b, v0.16b\n"
+ "ldr q26, [x23], #0x10\n"
+ "zip1 v19.16b, v17.16b, v16.16b\n"
+ "ldr q25, [x22], #0x10\n"
+ "zip2 v20.16b, v17.16b, v16.16b\n"
+ "ldr q24, [x21], #0x10\n"
+ "zip1 v18.16b, v31.16b, v28.16b\n"
+ "ldr q23, [x20], #0x10\n"
+ "zip1 v17.16b, v30.16b, v27.16b\n"
+ "str q22, [x15, #0x0]\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q19, [x15, #0x10]\n"
+ "zip2 v19.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip1 v18.16b, v26.16b, v24.16b\n"
+ "zip1 v17.16b, v25.16b, v23.16b\n"
+ "zip1 v16.16b, v18.16b, v17.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "zip2 v17.16b, v18.16b, v17.16b\n"
+ "str q21, [x15, #0x0]\n"
+ "zip2 v22.16b, v4.16b, v2.16b\n"
+ "str q20, [x15, #0x10]\n"
+ "zip2 v21.16b, v3.16b, v0.16b\n"
+ "str q19, [x15, #0x20]\n"
+ "zip1 v16.16b, v22.16b, v21.16b\n"
+ "str q17, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "zip2 v20.16b, v31.16b, v28.16b\n"
+ "str q29, [x15, #0x0]\n"
+ "zip2 v17.16b, v30.16b, v27.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip1 v16.16b, v20.16b, v17.16b\n"
+ "str q16, [x15, #0x20]\n"
+ "zip2 v19.16b, v26.16b, v24.16b\n"
+ "zip2 v18.16b, v25.16b, v23.16b\n"
+ "zip1 v16.16b, v19.16b, v18.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "zip2 v16.16b, v5.16b, v1.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip2 v16.16b, v22.16b, v21.16b\n"
+ "zip2 v17.16b, v20.16b, v17.16b\n"
+ "str q16, [x15, #0x10]\n"
+ "zip2 v16.16b, v19.16b, v18.16b\n"
+ "str q17, [x15, #0x20]\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cmp x19, #0x4\n"
+ "blt 5f\n"
+ "4:" // Main row loop: Column loop
+ "ldr s18, [x16], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s17, [x14], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s16, [x13], #0x4\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x12], #0x4\n"
+ "ldr s18, [x11], #0x4\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "ldr s20, [x10], #0x4\n"
+ "ldr s17, [x9], #0x4\n"
+ "zip1 v23.16b, v19.16b, v16.16b\n"
+ "ldr s16, [x28], #0x4\n"
+ "zip1 v19.16b, v18.16b, v17.16b\n"
+ "ldr s18, [x27], #0x4\n"
+ "ldr s22, [x26], #0x4\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "ldr s17, [x25], #0x4\n"
+ "zip1 v21.16b, v19.16b, v16.16b\n"
+ "ldr s16, [x24], #0x4\n"
+ "zip1 v18.16b, v18.16b, v17.16b\n"
+ "ldr s20, [x23], #0x4\n"
+ "ldr s19, [x22], #0x4\n"
+ "zip1 v16.16b, v22.16b, v16.16b\n"
+ "ldr s17, [x21], #0x4\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr s16, [x20], #0x4\n"
+ "zip1 v17.16b, v20.16b, v17.16b\n"
+ "str q23, [x15, #0x0]\n"
+ "str q21, [x15, #0x10]\n"
+ "zip1 v16.16b, v19.16b, v16.16b\n"
+ "str q18, [x15, #0x20]\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x15, #0x30]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp x19, #0x1\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 1 loop: loop
+ "ldr b18, [x16], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b17, [x14], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b16, [x13], #0x1\n"
+ "zip1 v19.16b, v18.16b, v16.16b\n"
+ "ldr b16, [x12], #0x1\n"
+ "ldr b18, [x11], #0x1\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "ldr b20, [x10], #0x1\n"
+ "ldr b17, [x9], #0x1\n"
+ "zip1 v23.16b, v19.16b, v16.16b\n"
+ "ldr b16, [x28], #0x1\n"
+ "zip1 v19.16b, v18.16b, v17.16b\n"
+ "ldr b18, [x27], #0x1\n"
+ "ldr b22, [x26], #0x1\n"
+ "zip1 v16.16b, v20.16b, v16.16b\n"
+ "ldr b17, [x25], #0x1\n"
+ "zip1 v21.16b, v19.16b, v16.16b\n"
+ "ldr b16, [x24], #0x1\n"
+ "zip1 v18.16b, v18.16b, v17.16b\n"
+ "ldr b20, [x23], #0x1\n"
+ "ldr b19, [x22], #0x1\n"
+ "zip1 v16.16b, v22.16b, v16.16b\n"
+ "ldr b17, [x21], #0x1\n"
+ "zip1 v18.16b, v18.16b, v16.16b\n"
+ "ldr b16, [x20], #0x1\n"
+ "zip1 v17.16b, v20.16b, v17.16b\n"
+ "str s23, [x15, #0x0]\n"
+ "str s21, [x15, #0x10]\n"
+ "zip1 v16.16b, v19.16b, v16.16b\n"
+ "str s18, [x15, #0x20]\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str s16, [x15, #0x30]\n"
+ "add x15, x15, #0x4\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x40\n"
+ "cmp %x[height], #0x10\n"
+ "bge 1b\n"
+ "cbz %x[height], 16f\n"
+ "8:" // Main loop skip
+
+ "9:" // Tail row loop: Head
+ "mov x16, %x[in]\n"
+ "mov x15, %x[out]\n"
+ "add x14, x16, %x[in_stride]\n"
+ "add x13, x14, %x[in_stride]\n"
+ "add x12, x13, %x[in_stride]\n"
+ "add %x[in], x12, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x12, x12, %x[pad_row], GT\n"
+ "csel x13, x13, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x14, x14, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x10\n"
+ "blt 11f\n"
+ "10:" // Tail row loop: Unroll column loop
+ "ldr q19, [x16], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q18, [x14], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q17, [x13], #0x10\n"
+ "zip1 v20.16b, v19.16b, v17.16b\n"
+ "ldr q16, [x12], #0x10\n"
+ "zip2 v19.16b, v19.16b, v17.16b\n"
+ "zip1 v17.16b, v18.16b, v16.16b\n"
+ "zip2 v18.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v20.16b, v17.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "zip2 v16.16b, v20.16b, v17.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "zip1 v17.16b, v19.16b, v18.16b\n"
+ "add x15, x15, %x[out_stride]\n"
+ "zip2 v16.16b, v19.16b, v18.16b\n"
+ "str q17, [x15, #0x0]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "str q16, [x15, #0x0]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 10b\n"
+ "11:" // Tail row loop: Unroll column loop skip
+ "cmp x19, #0x4\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Column loop
+ "ldr s17, [x16], #0x4\n"
+ "sub x19, x19, #0x4\n"
+ "ldr s18, [x14], #0x4\n"
+ "cmp x19, #0x4\n"
+ "ldr s16, [x13], #0x4\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr s16, [x12], #0x4\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str q16, [x15, #0x0]\n"
+ "add x15, x15, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Column loop skip
+ "cmp x19, #0x1\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 1 loop: loop
+ "ldr b17, [x16], #0x1\n"
+ "sub x19, x19, #0x1\n"
+ "ldr b18, [x14], #0x1\n"
+ "cmp x19, #0x1\n"
+ "ldr b16, [x13], #0x1\n"
+ "zip1 v17.16b, v17.16b, v16.16b\n"
+ "ldr b16, [x12], #0x1\n"
+ "zip1 v16.16b, v18.16b, v16.16b\n"
+ "zip1 v16.16b, v17.16b, v16.16b\n"
+ "str s16, [x15, #0x0]\n"
+ "add x15, x15, #0x4\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x10\n"
+ "cmp %x[height], #0x1\n"
+ "bge 9b\n"
+ "16:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<4, 4, true, VLType::None>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_4_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<4, 4, true, VLType::None>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_4_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_64.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_64.hpp
new file mode 100644
index 0000000000..c341b315aa
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_64.hpp
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_64(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 32 * height * sizeof(uint16_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q31, [x24], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "ldr q30, [x22], #0x10\n"
+ "cmp x19, #0x20\n"
+ "ldr q29, [x21], #0x10\n"
+ "ldr q28, [x20], #0x10\n"
+ "ldr q27, [x24], #0x10\n"
+ "ldr q26, [x22], #0x10\n"
+ "ldr q25, [x21], #0x10\n"
+ "ldr q24, [x20], #0x10\n"
+ "ldr q23, [x24], #0x10\n"
+ "ldr q22, [x22], #0x10\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x20], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q31, [x23, #0x0]\n"
+ "str q27, [x23, #0x10]\n"
+ "str q23, [x23, #0x20]\n"
+ "str q19, [x23, #0x30]\n"
+ "str q30, [x23, #0x40]\n"
+ "str q26, [x23, #0x50]\n"
+ "str q22, [x23, #0x60]\n"
+ "str q18, [x23, #0x70]\n"
+ "str q29, [x23, #0x80]\n"
+ "str q25, [x23, #0x90]\n"
+ "str q21, [x23, #0xa0]\n"
+ "str q17, [x23, #0xb0]\n"
+ "str q28, [x23, #0xc0]\n"
+ "str q24, [x23, #0xd0]\n"
+ "str q20, [x23, #0xe0]\n"
+ "str q16, [x23, #0xf0]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 16 loop: loop
+ "ldr q23, [x24], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q22, [x22], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x20], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q23, [x23, #0x0]\n"
+ "str q19, [x23, #0x10]\n"
+ "str q22, [x23, #0x40]\n"
+ "str q18, [x23, #0x50]\n"
+ "str q21, [x23, #0x80]\n"
+ "str q17, [x23, #0x90]\n"
+ "str q20, [x23, #0xc0]\n"
+ "str q16, [x23, #0xd0]\n"
+ "add x23, x23, #0x20\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr d19, [x24], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "ldr d18, [x22], #0x8\n"
+ "cmp x19, #0x4\n"
+ "ldr d17, [x21], #0x8\n"
+ "ldr d16, [x20], #0x8\n"
+ "str d19, [x23, #0x0]\n"
+ "str d18, [x23, #0x40]\n"
+ "str d17, [x23, #0x80]\n"
+ "str d16, [x23, #0xc0]\n"
+ "add x23, x23, #0x8\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr h19, [x24], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "ldr h18, [x22], #0x2\n"
+ "cmp x19, #0x1\n"
+ "ldr h17, [x21], #0x2\n"
+ "ldr h16, [x20], #0x2\n"
+ "str h19, [x23, #0x0]\n"
+ "str h18, [x23, #0x40]\n"
+ "str h17, [x23, #0x80]\n"
+ "str h16, [x23, #0xc0]\n"
+ "add x23, x23, #0x2\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x100\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x20\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Column loop
+ "ldr q19, [x24], #0x10\n"
+ "sub x19, x19, #0x20\n"
+ "cmp x19, #0x20\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "str q19, [x23, #0x0]\n"
+ "str q18, [x23, #0x10]\n"
+ "str q17, [x23, #0x20]\n"
+ "str q16, [x23, #0x30]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 16 loop: loop
+ "ldr q17, [x24], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "str q17, [x23, #0x0]\n"
+ "str q16, [x23, #0x10]\n"
+ "add x23, x23, #0x20\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr d16, [x24], #0x8\n"
+ "sub x19, x19, #0x4\n"
+ "cmp x19, #0x4\n"
+ "str d16, [x23, #0x0]\n"
+ "add x23, x23, #0x8\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr h16, [x24], #0x2\n"
+ "sub x19, x19, #0x1\n"
+ "cmp x19, #0x1\n"
+ "str h16, [x23, #0x0]\n"
+ "add x23, x23, #0x2\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x40\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<16, 1, true, VLType::None>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_64(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 2,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<32, 1, true, VLType::None>(
+ __fp16 *out, const __fp16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_64(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(__fp16) / 2,
+ stride * sizeof(__fp16),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<32, 1, true, VLType::None>(
+ uint16_t *out, const uint16_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_64(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint16_t) / 2,
+ stride * sizeof(uint16_t),
+ (kmax-k0)
+ );
+}
+
+#endif
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
deleted file mode 100644
index df68740bb4..0000000000
--- a/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_8way_32bit.hpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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, VLType::None>::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, VLType::None>::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, VLType::None>::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, VLType::None>::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/a64_transpose_interleave_96.hpp b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_96.hpp
new file mode 100644
index 0000000000..190999ba53
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/a64_transpose_interleave_96.hpp
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2021 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__
+
+namespace {
+
+void a64_transpose_interleave_96(uint32_t *out, const uint32_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 24 * height * sizeof(uint32_t);
+
+ __asm__ __volatile__(
+ "cmp %x[height], #0x4\n"
+ "blt 10f\n"
+ "1:" // Main row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add x22, x24, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add x20, x21, %x[in_stride]\n"
+ "add %x[in], x20, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Column loop
+ "ldr q7, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "ldr q6, [x22], #0x10\n"
+ "cmp x19, #0x18\n"
+ "ldr q5, [x21], #0x10\n"
+ "ldr q4, [x20], #0x10\n"
+ "ldr q3, [x24], #0x10\n"
+ "ldr q2, [x22], #0x10\n"
+ "ldr q1, [x21], #0x10\n"
+ "ldr q0, [x20], #0x10\n"
+ "ldr q31, [x24], #0x10\n"
+ "ldr q30, [x22], #0x10\n"
+ "ldr q29, [x21], #0x10\n"
+ "ldr q28, [x20], #0x10\n"
+ "ldr q27, [x24], #0x10\n"
+ "ldr q26, [x22], #0x10\n"
+ "ldr q25, [x21], #0x10\n"
+ "ldr q24, [x20], #0x10\n"
+ "ldr q23, [x24], #0x10\n"
+ "ldr q22, [x22], #0x10\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x20], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q7, [x23, #0x0]\n"
+ "str q3, [x23, #0x10]\n"
+ "str q31, [x23, #0x20]\n"
+ "str q27, [x23, #0x30]\n"
+ "str q23, [x23, #0x40]\n"
+ "str q19, [x23, #0x50]\n"
+ "str q6, [x23, #0x60]\n"
+ "str q2, [x23, #0x70]\n"
+ "str q30, [x23, #0x80]\n"
+ "str q26, [x23, #0x90]\n"
+ "str q22, [x23, #0xa0]\n"
+ "str q18, [x23, #0xb0]\n"
+ "str q5, [x23, #0xc0]\n"
+ "str q1, [x23, #0xd0]\n"
+ "str q29, [x23, #0xe0]\n"
+ "str q25, [x23, #0xf0]\n"
+ "str q21, [x23, #0x100]\n"
+ "str q17, [x23, #0x110]\n"
+ "str q4, [x23, #0x120]\n"
+ "str q0, [x23, #0x130]\n"
+ "str q28, [x23, #0x140]\n"
+ "str q24, [x23, #0x150]\n"
+ "str q20, [x23, #0x160]\n"
+ "str q16, [x23, #0x170]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 5f\n"
+ "4:" // Main row loop: width 16 loop: loop
+ "ldr q31, [x24], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "ldr q30, [x22], #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q29, [x21], #0x10\n"
+ "ldr q28, [x20], #0x10\n"
+ "ldr q27, [x24], #0x10\n"
+ "ldr q26, [x22], #0x10\n"
+ "ldr q25, [x21], #0x10\n"
+ "ldr q24, [x20], #0x10\n"
+ "ldr q23, [x24], #0x10\n"
+ "ldr q22, [x22], #0x10\n"
+ "ldr q21, [x21], #0x10\n"
+ "ldr q20, [x20], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x22], #0x10\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q31, [x23, #0x0]\n"
+ "str q27, [x23, #0x10]\n"
+ "str q23, [x23, #0x20]\n"
+ "str q19, [x23, #0x30]\n"
+ "str q30, [x23, #0x60]\n"
+ "str q26, [x23, #0x70]\n"
+ "str q22, [x23, #0x80]\n"
+ "str q18, [x23, #0x90]\n"
+ "str q29, [x23, #0xc0]\n"
+ "str q25, [x23, #0xd0]\n"
+ "str q21, [x23, #0xe0]\n"
+ "str q17, [x23, #0xf0]\n"
+ "str q28, [x23, #0x120]\n"
+ "str q24, [x23, #0x130]\n"
+ "str q20, [x23, #0x140]\n"
+ "str q16, [x23, #0x150]\n"
+ "add x23, x23, #0x40\n"
+ "bge 4b\n"
+ "5:" // Main row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 7f\n"
+ "6:" // Main row loop: width 4 loop: loop
+ "ldr q19, [x24], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "ldr q18, [x22], #0x10\n"
+ "cmp x19, #0x4\n"
+ "ldr q17, [x21], #0x10\n"
+ "ldr q16, [x20], #0x10\n"
+ "str q19, [x23, #0x0]\n"
+ "str q18, [x23, #0x60]\n"
+ "str q17, [x23, #0xc0]\n"
+ "str q16, [x23, #0x120]\n"
+ "add x23, x23, #0x10\n"
+ "bge 6b\n"
+ "7:" // Main row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 9f\n"
+ "8:" // Main row loop: width 1 loop: loop
+ "ldr s19, [x24], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "ldr s18, [x22], #0x4\n"
+ "cmp x19, #0x1\n"
+ "ldr s17, [x21], #0x4\n"
+ "ldr s16, [x20], #0x4\n"
+ "str s19, [x23, #0x0]\n"
+ "str s18, [x23, #0x60]\n"
+ "str s17, [x23, #0xc0]\n"
+ "str s16, [x23, #0x120]\n"
+ "add x23, x23, #0x4\n"
+ "bge 8b\n"
+ "9:" // Main row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x180\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 20f\n"
+ "10:" // Main loop skip
+
+ "11:" // Tail row loop: Head
+ "mov x24, %x[in]\n"
+ "mov x23, %x[out]\n"
+ "add %x[in], x24, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x19, %x[width]\n"
+ "cmp x19, #0x18\n"
+ "blt 13f\n"
+ "12:" // Tail row loop: Column loop
+ "ldr q21, [x24], #0x10\n"
+ "sub x19, x19, #0x18\n"
+ "cmp x19, #0x18\n"
+ "ldr q20, [x24], #0x10\n"
+ "ldr q19, [x24], #0x10\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "str q21, [x23, #0x0]\n"
+ "str q20, [x23, #0x10]\n"
+ "str q19, [x23, #0x20]\n"
+ "str q18, [x23, #0x30]\n"
+ "str q17, [x23, #0x40]\n"
+ "str q16, [x23, #0x50]\n"
+ "add x23, x23, %x[out_stride]\n"
+ "bge 12b\n"
+ "13:" // Tail row loop: Column loop skip
+ "cmp x19, #0x10\n"
+ "blt 15f\n"
+ "14:" // Tail row loop: width 16 loop: loop
+ "ldr q19, [x24], #0x10\n"
+ "sub x19, x19, #0x10\n"
+ "cmp x19, #0x10\n"
+ "ldr q18, [x24], #0x10\n"
+ "ldr q17, [x24], #0x10\n"
+ "ldr q16, [x24], #0x10\n"
+ "str q19, [x23, #0x0]\n"
+ "str q18, [x23, #0x10]\n"
+ "str q17, [x23, #0x20]\n"
+ "str q16, [x23, #0x30]\n"
+ "add x23, x23, #0x40\n"
+ "bge 14b\n"
+ "15:" // Tail row loop: width 16 loop: skip
+ "cmp x19, #0x4\n"
+ "blt 17f\n"
+ "16:" // Tail row loop: width 4 loop: loop
+ "ldr q16, [x24], #0x10\n"
+ "sub x19, x19, #0x4\n"
+ "cmp x19, #0x4\n"
+ "str q16, [x23, #0x0]\n"
+ "add x23, x23, #0x10\n"
+ "bge 16b\n"
+ "17:" // Tail row loop: width 4 loop: skip
+ "cmp x19, #0x1\n"
+ "blt 19f\n"
+ "18:" // Tail row loop: width 1 loop: loop
+ "ldr s16, [x24], #0x4\n"
+ "sub x19, x19, #0x1\n"
+ "cmp x19, #0x1\n"
+ "str s16, [x23, #0x0]\n"
+ "add x23, x23, #0x4\n"
+ "bge 18b\n"
+ "19:" // Tail row loop: width 1 loop: skip
+ "add %x[out], %x[out], #0x60\n"
+ "cmp %x[height], #0x1\n"
+ "bge 11b\n"
+ "20:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<24, 1, true, VLType::None>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ a64_transpose_interleave_96(
+ reinterpret_cast<uint32_t *>(out),
+ reinterpret_cast<const uint32_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 4,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/list-sve.hpp b/src/core/NEON/kernels/arm_gemm/transforms/list-sve.hpp
new file mode 100644
index 0000000000..895177b6cc
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/list-sve.hpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2021 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.
+ */
+#include "sve_transpose_interleave_12VL_2x4_fp32bf16.hpp"
+#include "sve_transpose_interleave_1VL_1x4.hpp"
+#include "sve_transpose_interleave_1VL.hpp"
+#include "sve_transpose_interleave_3VL_1x4.hpp"
+#include "sve_transpose_interleave_3VL_2x2.hpp"
+#include "sve_transpose_interleave_3VL.hpp"
+#include "sve_transpose_interleave_4VL_1x4.hpp"
+#include "sve_transpose_interleave_4VL_2x2.hpp"
+#include "sve_transpose_interleave_4VL.hpp"
+#include "sve_transpose_interleave_6VL_1x8.hpp"
+#include "sve_transpose_interleave_6VL_2x4_fp32bf16.hpp"
+#include "sve_transpose_interleave_6VL_2x4.hpp"
+#include "sve_transpose_interleave_6VL_4x2.hpp"
+#include "sve_transpose_interleave_8VL_1x4.hpp"
+#include "sve_transpose_interleave_8VL_1x8.hpp"
+#include "sve_transpose_interleave_8VL_2x2.hpp"
+#include "sve_transpose_interleave_8VL_2x4.hpp"
+#include "sve_transpose_interleave_8VL_2x4_fp32bf16.hpp"
+#include "sve_transpose_interleave_8VL.hpp"
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/list.hpp b/src/core/NEON/kernels/arm_gemm/transforms/list.hpp
index e092c729ba..adbaa6cf2f 100644
--- a/src/core/NEON/kernels/arm_gemm/transforms/list.hpp
+++ b/src/core/NEON/kernels/arm_gemm/transforms/list.hpp
@@ -22,7 +22,28 @@
* SOFTWARE.
*/
#include "a32_transpose_interleave_8way_32bit.hpp"
-#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 "a64_transpose_interleave_12_1x4.hpp"
+#include "a64_transpose_interleave_12_1x8.hpp"
+#include "a64_transpose_interleave_12_2x2.hpp"
+#include "a64_transpose_interleave_12_2x4_fp32bf16.hpp"
+#include "a64_transpose_interleave_12_2x4.hpp"
+#include "a64_transpose_interleave_128.hpp"
+#include "a64_transpose_interleave_12_s8s16.hpp"
+#include "a64_transpose_interleave_12_u8u16.hpp"
+#include "a64_transpose_interleave_16_1x4.hpp"
+#include "a64_transpose_interleave_16_1x8.hpp"
+#include "a64_transpose_interleave_16_2x2.hpp"
+#include "a64_transpose_interleave_16_2x4.hpp"
+#include "a64_transpose_interleave_16_2x4_fp32bf16.hpp"
+#include "a64_transpose_interleave_16.hpp"
+#include "a64_transpose_interleave_24_bf16fp32.hpp"
+#include "a64_transpose_interleave_24_fp16fp32.hpp"
+#include "a64_transpose_interleave_24_2x4_fp32bf16.hpp"
+#include "a64_transpose_interleave_24.hpp"
+#include "a64_transpose_interleave_32_1x4.hpp"
+#include "a64_transpose_interleave_32_2x2.hpp"
+#include "a64_transpose_interleave_4_1x16.hpp"
+#include "a64_transpose_interleave_4_1x4.hpp"
+#include "a64_transpose_interleave_48.hpp"
+#include "a64_transpose_interleave_64.hpp"
+#include "a64_transpose_interleave_96.hpp"
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_12VL_2x4_fp32bf16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_12VL_2x4_fp32bf16.hpp
new file mode 100644
index 0000000000..ef94cbad39
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_12VL_2x4_fp32bf16.hpp
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_12VL_2x4_fp32bf16(bfloat16 *out, const float *in, size_t width, size_t in_stride, size_t height)
+{
+ float *pad_row = reinterpret_cast<float *>(alloca(width * sizeof(float)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(float));
+ }
+
+ size_t out_stride = 12 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p6.b\n"
+ "1:" // Main row loop: Head
+ "mov x27, %x[in]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "mov x24, %x[width]\n"
+ "cnth x23, ALL, MUL #6\n"
+ "add x22, x25, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "add %x[in], x22, %x[in_stride]\n"
+ "csel x22, x22, %x[pad_row], GT\n"
+ "csel x25, x25, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x26, x26, %x[pad_row], GT\n"
+ "cmp x24, x23\n"
+ "mov x21, %x[out]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1w { z22.s }, p6/Z, [x27]\n"
+ "ld1w { z7.s }, p6/Z, [x27, #1, MUL VL]\n"
+ "mov x20, x21\n"
+ "add x21, x21, %x[out_stride]\n"
+ "ld1w { z19.s }, p6/Z, [x27, #2, MUL VL]\n"
+ "ld1w { z18.s }, p6/Z, [x27, #3, MUL VL]\n"
+ "mov x19, x21\n"
+ "sub x24, x24, x23\n"
+ "ld1w { z5.s }, p6/Z, [x27, #4, MUL VL]\n"
+ "ld1w { z25.s }, p6/Z, [x27, #5, MUL VL]\n"
+ "cmp x24, x23\n"
+ "add x21, x21, %x[out_stride]\n"
+ "ld1w { z20.s }, p6/Z, [x27, #6, MUL VL]\n"
+ "ld1w { z23.s }, p6/Z, [x27, #7, MUL VL]\n"
+ "addvl x27, x27, #12\n"
+ "ld1w { z4.s }, p6/Z, [x25]\n"
+ "ld1w { z10.s }, p6/Z, [x25, #1, MUL VL]\n"
+ "zip1 z14.s, z22.s, z4.s\n"
+ "zip2 z22.s, z22.s, z4.s\n"
+ "ld1w { z28.s }, p6/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z27.s }, p6/Z, [x25, #3, MUL VL]\n"
+ "zip1 z24.s, z7.s, z10.s\n"
+ "zip2 z15.s, z7.s, z10.s\n"
+ "ld1w { z7.s }, p6/Z, [x25, #4, MUL VL]\n"
+ "ld1w { z2.s }, p6/Z, [x25, #5, MUL VL]\n"
+ "zip1 z9.s, z19.s, z28.s\n"
+ "zip2 z0.s, z19.s, z28.s\n"
+ "ld1w { z19.s }, p6/Z, [x25, #6, MUL VL]\n"
+ "ld1w { z16.s }, p6/Z, [x25, #7, MUL VL]\n"
+ "addvl x25, x25, #12\n"
+ "zip1 z1.s, z18.s, z27.s\n"
+ "ld1w { z30.s }, p6/Z, [x27, #-4, MUL VL]\n"
+ "ld1w { z29.s }, p6/Z, [x27, #-3, MUL VL]\n"
+ "zip2 z17.s, z18.s, z27.s\n"
+ ".inst 0x658ab9d5 // bfcvt z21.h, p6/M, z14.s\n"
+ "ld1w { z31.s }, p6/Z, [x26]\n"
+ "ld1w { z8.s }, p6/Z, [x26, #1, MUL VL]\n"
+ ".inst 0x658abacc // bfcvt z12.h, p6/M, z22.s\n"
+ ".inst 0x658abb0e // bfcvt z14.h, p6/M, z24.s\n"
+ "ld1w { z22.s }, p6/Z, [x26, #2, MUL VL]\n"
+ "ld1w { z28.s }, p6/Z, [x26, #3, MUL VL]\n"
+ ".inst 0x658ab9ea // bfcvt z10.h, p6/M, z15.s\n"
+ ".inst 0x658ab92f // bfcvt z15.h, p6/M, z9.s\n"
+ "ld1w { z27.s }, p6/Z, [x26, #4, MUL VL]\n"
+ "ld1w { z13.s }, p6/Z, [x26, #5, MUL VL]\n"
+ ".inst 0x658ab803 // bfcvt z3.h, p6/M, z0.s\n"
+ ".inst 0x658ab832 // bfcvt z18.h, p6/M, z1.s\n"
+ "ld1w { z26.s }, p6/Z, [x26, #6, MUL VL]\n"
+ "ld1w { z9.s }, p6/Z, [x26, #7, MUL VL]\n"
+ "addvl x26, x26, #12\n"
+ ".inst 0x658aba26 // bfcvt z6.h, p6/M, z17.s\n"
+ "ld1w { z1.s }, p6/Z, [x25, #-4, MUL VL]\n"
+ "ld1w { z0.s }, p6/Z, [x25, #-3, MUL VL]\n"
+ "zip1 z17.s, z5.s, z7.s\n"
+ "zip2 z5.s, z5.s, z7.s\n"
+ "ld1w { z24.s }, p6/Z, [x22]\n"
+ "ld1w { z11.s }, p6/Z, [x22, #1, MUL VL]\n"
+ "zip1 z7.s, z31.s, z24.s\n"
+ "zip2 z31.s, z31.s, z24.s\n"
+ "ld1w { z4.s }, p6/Z, [x22, #2, MUL VL]\n"
+ "ld1w { z24.s }, p6/Z, [x22, #3, MUL VL]\n"
+ ".inst 0x648ab8f5 // bfcvtnt z21.h, p6/M, z7.s\n"
+ "zip1 z7.s, z8.s, z11.s\n"
+ "zip2 z11.s, z8.s, z11.s\n"
+ "ld1w { z8.s }, p6/Z, [x22, #4, MUL VL]\n"
+ ".inst 0x648abbec // bfcvtnt z12.h, p6/M, z31.s\n"
+ "ld1w { z31.s }, p6/Z, [x22, #5, MUL VL]\n"
+ ".inst 0x648ab8ee // bfcvtnt z14.h, p6/M, z7.s\n"
+ "ld1w { z7.s }, p6/Z, [x22, #6, MUL VL]\n"
+ ".inst 0x648ab96a // bfcvtnt z10.h, p6/M, z11.s\n"
+ "zip1 z11.s, z22.s, z4.s\n"
+ "zip2 z4.s, z22.s, z4.s\n"
+ "ld1w { z22.s }, p6/Z, [x22, #7, MUL VL]\n"
+ "addvl x22, x22, #12\n"
+ ".inst 0x648ab96f // bfcvtnt z15.h, p6/M, z11.s\n"
+ "ld1w { z11.s }, p6/Z, [x27, #-2, MUL VL]\n"
+ ".inst 0x648ab883 // bfcvtnt z3.h, p6/M, z4.s\n"
+ "zip1 z4.s, z28.s, z24.s\n"
+ "zip2 z24.s, z28.s, z24.s\n"
+ "ld1w { z28.s }, p6/Z, [x27, #-1, MUL VL]\n"
+ ".inst 0x648ab892 // bfcvtnt z18.h, p6/M, z4.s\n"
+ "ld1w { z4.s }, p6/Z, [x26, #-4, MUL VL]\n"
+ ".inst 0x648abb06 // bfcvtnt z6.h, p6/M, z24.s\n"
+ "zip1 z24.s, z25.s, z2.s\n"
+ "zip2 z25.s, z25.s, z2.s\n"
+ "zip1 z2.s, z20.s, z19.s\n"
+ "zip2 z20.s, z20.s, z19.s\n"
+ "zip1 z19.s, z23.s, z16.s\n"
+ "zip2 z16.s, z23.s, z16.s\n"
+ "zip1 z23.s, z30.s, z1.s\n"
+ "zip2 z30.s, z30.s, z1.s\n"
+ "zip1 z1.s, z29.s, z0.s\n"
+ "zip2 z0.s, z29.s, z0.s\n"
+ ".inst 0x658aba31 // bfcvt z17.h, p6/M, z17.s\n"
+ "zip1 z29.s, z27.s, z8.s\n"
+ ".inst 0x658ab8a5 // bfcvt z5.h, p6/M, z5.s\n"
+ "zip2 z27.s, z27.s, z8.s\n"
+ "ld1w { z8.s }, p6/Z, [x26, #-3, MUL VL]\n"
+ ".inst 0x658abb18 // bfcvt z24.h, p6/M, z24.s\n"
+ ".inst 0x658abb39 // bfcvt z25.h, p6/M, z25.s\n"
+ ".inst 0x658ab842 // bfcvt z2.h, p6/M, z2.s\n"
+ ".inst 0x658aba94 // bfcvt z20.h, p6/M, z20.s\n"
+ ".inst 0x658aba73 // bfcvt z19.h, p6/M, z19.s\n"
+ ".inst 0x658aba10 // bfcvt z16.h, p6/M, z16.s\n"
+ ".inst 0x658abaf7 // bfcvt z23.h, p6/M, z23.s\n"
+ ".inst 0x658abbde // bfcvt z30.h, p6/M, z30.s\n"
+ ".inst 0x658ab821 // bfcvt z1.h, p6/M, z1.s\n"
+ ".inst 0x658ab800 // bfcvt z0.h, p6/M, z0.s\n"
+ ".inst 0x648abbb1 // bfcvtnt z17.h, p6/M, z29.s\n"
+ "ld1w { z29.s }, p6/Z, [x25, #-2, MUL VL]\n"
+ ".inst 0x648abb65 // bfcvtnt z5.h, p6/M, z27.s\n"
+ "zip1 z27.s, z13.s, z31.s\n"
+ "zip2 z31.s, z13.s, z31.s\n"
+ "ld1w { z13.s }, p6/Z, [x25, #-1, MUL VL]\n"
+ ".inst 0x648abb78 // bfcvtnt z24.h, p6/M, z27.s\n"
+ "ld1w { z27.s }, p6/Z, [x22, #-4, MUL VL]\n"
+ ".inst 0x648abbf9 // bfcvtnt z25.h, p6/M, z31.s\n"
+ "zip1 z31.s, z26.s, z7.s\n"
+ "zip2 z26.s, z26.s, z7.s\n"
+ "ld1w { z7.s }, p6/Z, [x22, #-3, MUL VL]\n"
+ ".inst 0x648abbe2 // bfcvtnt z2.h, p6/M, z31.s\n"
+ "ld1w { z31.s }, p6/Z, [x26, #-2, MUL VL]\n"
+ ".inst 0x648abb54 // bfcvtnt z20.h, p6/M, z26.s\n"
+ "zip1 z26.s, z9.s, z22.s\n"
+ "zip2 z9.s, z9.s, z22.s\n"
+ "ld1w { z22.s }, p6/Z, [x26, #-1, MUL VL]\n"
+ ".inst 0x648abb53 // bfcvtnt z19.h, p6/M, z26.s\n"
+ "ld1w { z26.s }, p6/Z, [x22, #-2, MUL VL]\n"
+ ".inst 0x648ab930 // bfcvtnt z16.h, p6/M, z9.s\n"
+ "ld1w { z9.s }, p6/Z, [x22, #-1, MUL VL]\n"
+ "st1h { z21.h }, p6, [x20]\n"
+ "zip1 z21.s, z4.s, z27.s\n"
+ "zip2 z27.s, z4.s, z27.s\n"
+ "zip1 z4.s, z8.s, z7.s\n"
+ "zip2 z8.s, z8.s, z7.s\n"
+ "st1h { z12.h }, p6, [x20, #1, MUL VL]\n"
+ "zip1 z7.s, z11.s, z29.s\n"
+ "zip2 z11.s, z11.s, z29.s\n"
+ "st1h { z14.h }, p6, [x20, #2, MUL VL]\n"
+ "zip1 z29.s, z28.s, z13.s\n"
+ "zip2 z12.s, z28.s, z13.s\n"
+ "st1h { z10.h }, p6, [x20, #3, MUL VL]\n"
+ "st1h { z15.h }, p6, [x20, #4, MUL VL]\n"
+ ".inst 0x648abab7 // bfcvtnt z23.h, p6/M, z21.s\n"
+ ".inst 0x648abb7e // bfcvtnt z30.h, p6/M, z27.s\n"
+ "st1h { z3.h }, p6, [x20, #5, MUL VL]\n"
+ ".inst 0x648ab881 // bfcvtnt z1.h, p6/M, z4.s\n"
+ ".inst 0x648ab900 // bfcvtnt z0.h, p6/M, z8.s\n"
+ "st1h { z18.h }, p6, [x20, #6, MUL VL]\n"
+ ".inst 0x658ab8e8 // bfcvt z8.h, p6/M, z7.s\n"
+ "zip1 z27.s, z31.s, z26.s\n"
+ "st1h { z6.h }, p6, [x20, #7, MUL VL]\n"
+ "addvl x20, x20, #12\n"
+ ".inst 0x658ab96e // bfcvt z14.h, p6/M, z11.s\n"
+ "zip2 z28.s, z31.s, z26.s\n"
+ ".inst 0x658abbbd // bfcvt z29.h, p6/M, z29.s\n"
+ "zip1 z21.s, z22.s, z9.s\n"
+ "st1h { z17.h }, p6, [x20, #-4, MUL VL]\n"
+ ".inst 0x658ab992 // bfcvt z18.h, p6/M, z12.s\n"
+ "zip2 z17.s, z22.s, z9.s\n"
+ "st1h { z5.h }, p6, [x20, #-3, MUL VL]\n"
+ "st1h { z24.h }, p6, [x20, #-2, MUL VL]\n"
+ ".inst 0x648abb68 // bfcvtnt z8.h, p6/M, z27.s\n"
+ ".inst 0x648abb8e // bfcvtnt z14.h, p6/M, z28.s\n"
+ "st1h { z25.h }, p6, [x20, #-1, MUL VL]\n"
+ ".inst 0x648ababd // bfcvtnt z29.h, p6/M, z21.s\n"
+ ".inst 0x648aba32 // bfcvtnt z18.h, p6/M, z17.s\n"
+ "st1h { z2.h }, p6, [x19]\n"
+ "st1h { z20.h }, p6, [x19, #1, MUL VL]\n"
+ "st1h { z19.h }, p6, [x19, #2, MUL VL]\n"
+ "st1h { z16.h }, p6, [x19, #3, MUL VL]\n"
+ "st1h { z23.h }, p6, [x19, #4, MUL VL]\n"
+ "st1h { z30.h }, p6, [x19, #5, MUL VL]\n"
+ "st1h { z1.h }, p6, [x19, #6, MUL VL]\n"
+ "st1h { z0.h }, p6, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ "st1h { z8.h }, p6, [x19, #-4, MUL VL]\n"
+ "st1h { z14.h }, p6, [x19, #-3, MUL VL]\n"
+ "st1h { z29.h }, p6, [x19, #-2, MUL VL]\n"
+ "st1h { z18.h }, p6, [x19, #-1, MUL VL]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x24, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x19, x24\n"
+ "whilelt p5.s, XZR, x19\n"
+ "ld1w { z22.s }, p5/Z, [x27]\n"
+ "ld1w { z21.s }, p5/Z, [x25]\n"
+ "decw x19\n"
+ "whilelt p4.s, XZR, x19\n"
+ "ld1w { z20.s }, p4/Z, [x27, #1, MUL VL]\n"
+ "ld1w { z19.s }, p4/Z, [x25, #1, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p3.s, XZR, x19\n"
+ "ld1w { z18.s }, p3/Z, [x27, #2, MUL VL]\n"
+ "ld1w { z17.s }, p3/Z, [x25, #2, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p2.s, XZR, x19\n"
+ "ld1w { z30.s }, p2/Z, [x27, #3, MUL VL]\n"
+ "ld1w { z16.s }, p2/Z, [x25, #3, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p1.s, XZR, x19\n"
+ "ld1w { z13.s }, p1/Z, [x27, #4, MUL VL]\n"
+ "ld1w { z29.s }, p5/Z, [x26]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z12.s }, p0/Z, [x27, #5, MUL VL]\n"
+ "ld1w { z28.s }, p4/Z, [x26, #1, MUL VL]\n"
+ "ld1w { z11.s }, p3/Z, [x26, #2, MUL VL]\n"
+ "ld1w { z10.s }, p2/Z, [x26, #3, MUL VL]\n"
+ "zip1 z27.s, z22.s, z21.s\n"
+ "zip2 z26.s, z22.s, z21.s\n"
+ "ld1w { z9.s }, p1/Z, [x25, #4, MUL VL]\n"
+ "ld1w { z8.s }, p0/Z, [x25, #5, MUL VL]\n"
+ "zip1 z25.s, z20.s, z19.s\n"
+ "zip2 z24.s, z20.s, z19.s\n"
+ "ld1w { z23.s }, p5/Z, [x22]\n"
+ "ld1w { z22.s }, p4/Z, [x22, #1, MUL VL]\n"
+ "zip1 z21.s, z18.s, z17.s\n"
+ "zip2 z20.s, z18.s, z17.s\n"
+ "ld1w { z19.s }, p3/Z, [x22, #2, MUL VL]\n"
+ "ld1w { z18.s }, p2/Z, [x22, #3, MUL VL]\n"
+ "zip1 z17.s, z30.s, z16.s\n"
+ "zip2 z16.s, z30.s, z16.s\n"
+ "ld1w { z7.s }, p1/Z, [x26, #4, MUL VL]\n"
+ "ld1w { z6.s }, p0/Z, [x26, #5, MUL VL]\n"
+ ".inst 0x658abb65 // bfcvt z5.h, p6/M, z27.s\n"
+ "zip1 z4.s, z29.s, z23.s\n"
+ "ld1w { z3.s }, p1/Z, [x22, #4, MUL VL]\n"
+ "ld1w { z2.s }, p0/Z, [x22, #5, MUL VL]\n"
+ ".inst 0x658abb41 // bfcvt z1.h, p6/M, z26.s\n"
+ "zip2 z0.s, z29.s, z23.s\n"
+ ".inst 0x658abb3f // bfcvt z31.h, p6/M, z25.s\n"
+ "zip1 z30.s, z28.s, z22.s\n"
+ "mov x19, x21\n"
+ "decd x24, ALL, MUL #12\n"
+ ".inst 0x658abb1d // bfcvt z29.h, p6/M, z24.s\n"
+ "zip2 z28.s, z28.s, z22.s\n"
+ "cmp x24, #0x0\n"
+ "addvl x27, x27, #6\n"
+ ".inst 0x658ababb // bfcvt z27.h, p6/M, z21.s\n"
+ "zip1 z23.s, z11.s, z19.s\n"
+ "addvl x26, x26, #6\n"
+ "addvl x25, x25, #6\n"
+ ".inst 0x658aba9a // bfcvt z26.h, p6/M, z20.s\n"
+ "zip2 z22.s, z11.s, z19.s\n"
+ "addvl x22, x22, #6\n"
+ "add x21, x21, %x[out_stride]\n"
+ ".inst 0x658aba39 // bfcvt z25.h, p6/M, z17.s\n"
+ "zip1 z21.s, z10.s, z18.s\n"
+ ".inst 0x658aba18 // bfcvt z24.h, p6/M, z16.s\n"
+ "zip2 z20.s, z10.s, z18.s\n"
+ "zip1 z19.s, z13.s, z9.s\n"
+ "zip2 z18.s, z13.s, z9.s\n"
+ "zip1 z17.s, z12.s, z8.s\n"
+ "zip2 z16.s, z12.s, z8.s\n"
+ ".inst 0x648ab885 // bfcvtnt z5.h, p6/M, z4.s\n"
+ ".inst 0x648ab801 // bfcvtnt z1.h, p6/M, z0.s\n"
+ "st1h { z5.h }, p6, [x19]\n"
+ ".inst 0x648abbdf // bfcvtnt z31.h, p6/M, z30.s\n"
+ ".inst 0x648abb9d // bfcvtnt z29.h, p6/M, z28.s\n"
+ "st1h { z1.h }, p6, [x19, #1, MUL VL]\n"
+ ".inst 0x648abafb // bfcvtnt z27.h, p6/M, z23.s\n"
+ ".inst 0x648abada // bfcvtnt z26.h, p6/M, z22.s\n"
+ "st1h { z31.h }, p6, [x19, #2, MUL VL]\n"
+ ".inst 0x648abab9 // bfcvtnt z25.h, p6/M, z21.s\n"
+ ".inst 0x648aba98 // bfcvtnt z24.h, p6/M, z20.s\n"
+ "st1h { z29.h }, p6, [x19, #3, MUL VL]\n"
+ ".inst 0x658aba77 // bfcvt z23.h, p6/M, z19.s\n"
+ "zip1 z22.s, z7.s, z3.s\n"
+ "st1h { z27.h }, p6, [x19, #4, MUL VL]\n"
+ ".inst 0x658aba55 // bfcvt z21.h, p6/M, z18.s\n"
+ "zip2 z20.s, z7.s, z3.s\n"
+ "st1h { z26.h }, p6, [x19, #5, MUL VL]\n"
+ ".inst 0x658aba33 // bfcvt z19.h, p6/M, z17.s\n"
+ "zip1 z18.s, z6.s, z2.s\n"
+ "st1h { z25.h }, p6, [x19, #6, MUL VL]\n"
+ ".inst 0x658aba11 // bfcvt z17.h, p6/M, z16.s\n"
+ "zip2 z16.s, z6.s, z2.s\n"
+ "st1h { z24.h }, p6, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ ".inst 0x648abad7 // bfcvtnt z23.h, p6/M, z22.s\n"
+ ".inst 0x648aba95 // bfcvtnt z21.h, p6/M, z20.s\n"
+ "st1h { z23.h }, p6, [x19, #-4, MUL VL]\n"
+ ".inst 0x648aba53 // bfcvtnt z19.h, p6/M, z18.s\n"
+ ".inst 0x648aba11 // bfcvtnt z17.h, p6/M, z16.s\n"
+ "st1h { z21.h }, p6, [x19, #-3, MUL VL]\n"
+ "st1h { z19.h }, p6, [x19, #-2, MUL VL]\n"
+ "st1h { z17.h }, p6, [x19, #-1, MUL VL]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp %x[height], #0x1\n"
+ "addvl %x[out], %x[out], #12\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "p5", "p6", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<12, 4, true, VLType::SVE>(
+ bfloat16 *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_12VL_2x4_fp32bf16(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_1VL.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_1VL.hpp
new file mode 100644
index 0000000000..33694dfb0c
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_1VL.hpp
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_1VL(uint32_t *out, const uint32_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 1 * height * get_vector_length<uint8_t>();
+
+ __asm__ __volatile__(
+ "ptrue p1.b\n"
+ "cmp %x[height], #0x4\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x25, %x[in]\n"
+ "mov x24, %x[out]\n"
+ "add x23, x25, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x20, %x[width]\n"
+ "cntw x19, ALL, MUL #2\n"
+ "cmp x20, x19\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1w { z23.s }, p1/Z, [x25]\n"
+ "sub x20, x20, x19\n"
+ "ld1w { z22.s }, p1/Z, [x25, #1, MUL VL]\n"
+ "addvl x25, x25, #2\n"
+ "ld1w { z21.s }, p1/Z, [x23]\n"
+ "cmp x20, x19\n"
+ "ld1w { z20.s }, p1/Z, [x23, #1, MUL VL]\n"
+ "addvl x23, x23, #2\n"
+ "ld1w { z19.s }, p1/Z, [x22]\n"
+ "ld1w { z18.s }, p1/Z, [x22, #1, MUL VL]\n"
+ "addvl x22, x22, #2\n"
+ "ld1w { z17.s }, p1/Z, [x21]\n"
+ "ld1w { z16.s }, p1/Z, [x21, #1, MUL VL]\n"
+ "addvl x21, x21, #2\n"
+ "st1w { z23.s }, p1, [x24]\n"
+ "st1w { z21.s }, p1, [x24, #1, MUL VL]\n"
+ "st1w { z19.s }, p1, [x24, #2, MUL VL]\n"
+ "st1w { z17.s }, p1, [x24, #3, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "st1w { z22.s }, p1, [x24]\n"
+ "st1w { z20.s }, p1, [x24, #1, MUL VL]\n"
+ "st1w { z18.s }, p1, [x24, #2, MUL VL]\n"
+ "st1w { z16.s }, p1, [x24, #3, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x20, 5f\n"
+ "4:" // Main row loop: Column loop
+ "whilelt p0.s, XZR, x20\n"
+ "ld1w { z19.s }, p0/Z, [x25]\n"
+ "addvl x25, x25, #1\n"
+ "ld1w { z18.s }, p0/Z, [x23]\n"
+ "addvl x23, x23, #1\n"
+ "ld1w { z17.s }, p0/Z, [x22]\n"
+ "addvl x22, x22, #1\n"
+ "ld1w { z16.s }, p0/Z, [x21]\n"
+ "addvl x21, x21, #1\n"
+ "st1w { z19.s }, p1, [x24]\n"
+ "decw x20\n"
+ "st1w { z18.s }, p1, [x24, #1, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "st1w { z17.s }, p1, [x24, #2, MUL VL]\n"
+ "st1w { z16.s }, p1, [x24, #3, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #4\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x25, %x[in]\n"
+ "mov x24, %x[out]\n"
+ "add %x[in], x25, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x20, %x[width]\n"
+ "cntw x19, ALL, MUL #2\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1w { z17.s }, p1/Z, [x25]\n"
+ "sub x20, x20, x19\n"
+ "ld1w { z16.s }, p1/Z, [x25, #1, MUL VL]\n"
+ "addvl x25, x25, #2\n"
+ "cmp x20, x19\n"
+ "st1w { z17.s }, p1, [x24]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "st1w { z16.s }, p1, [x24]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "whilelt p0.s, XZR, x20\n"
+ "ld1w { z16.s }, p0/Z, [x25]\n"
+ "addvl x25, x25, #1\n"
+ "decw x20\n"
+ "st1w { z16.s }, p1, [x24]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "cmp x20, #0x0\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #1\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<1, 1, true, VLType::SVE>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_1VL(
+ reinterpret_cast<uint32_t *>(out),
+ reinterpret_cast<const uint32_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 4,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_1VL_1x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_1VL_1x4.hpp
new file mode 100644
index 0000000000..e4fb7ea4c1
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_1VL_1x4.hpp
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_1VL_1x4(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 1 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p1.b\n"
+ "cmp %x[height], #0x8\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x9, %x[in]\n"
+ "mov x28, %x[out]\n"
+ "add x27, x9, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #2\n"
+ "cmp x20, x19\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1b { z17.b }, p1/Z, [x9]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z3.b }, p1/Z, [x9, #1, MUL VL]\n"
+ "addvl x9, x9, #2\n"
+ "ld1b { z21.b }, p1/Z, [x27]\n"
+ "cmp x20, x19\n"
+ "ld1b { z2.b }, p1/Z, [x27, #1, MUL VL]\n"
+ "addvl x27, x27, #2\n"
+ "ld1b { z16.b }, p1/Z, [x26]\n"
+ "zip1 z20.b, z17.b, z16.b\n"
+ "ld1b { z1.b }, p1/Z, [x26, #1, MUL VL]\n"
+ "addvl x26, x26, #2\n"
+ "zip2 z19.b, z17.b, z16.b\n"
+ "ld1b { z17.b }, p1/Z, [x25]\n"
+ "ld1b { z0.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "zip1 z31.b, z3.b, z1.b\n"
+ "ld1b { z30.b }, p1/Z, [x24]\n"
+ "addvl x25, x25, #2\n"
+ "zip1 z16.b, z21.b, z17.b\n"
+ "ld1b { z29.b }, p1/Z, [x24, #1, MUL VL]\n"
+ "addvl x24, x24, #2\n"
+ "zip1 z18.b, z20.b, z16.b\n"
+ "ld1b { z28.b }, p1/Z, [x23]\n"
+ "zip2 z27.b, z20.b, z16.b\n"
+ "ld1b { z26.b }, p1/Z, [x23, #1, MUL VL]\n"
+ "addvl x23, x23, #2\n"
+ "zip2 z17.b, z21.b, z17.b\n"
+ "ld1b { z16.b }, p1/Z, [x22]\n"
+ "zip1 z25.b, z2.b, z0.b\n"
+ "ld1b { z24.b }, p1/Z, [x22, #1, MUL VL]\n"
+ "addvl x22, x22, #2\n"
+ "zip1 z23.b, z19.b, z17.b\n"
+ "ld1b { z22.b }, p1/Z, [x21]\n"
+ "zip2 z20.b, z19.b, z17.b\n"
+ "ld1b { z21.b }, p1/Z, [x21, #1, MUL VL]\n"
+ "addvl x21, x21, #2\n"
+ "zip1 z19.b, z30.b, z16.b\n"
+ "st1b { z18.b }, p1, [x28]\n"
+ "zip2 z18.b, z30.b, z16.b\n"
+ "zip1 z17.b, z28.b, z22.b\n"
+ "zip1 z16.b, z19.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z16.b, z19.b, z17.b\n"
+ "st1b { z27.b }, p1, [x28]\n"
+ "zip2 z17.b, z28.b, z22.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z23.b }, p1, [x28]\n"
+ "zip2 z17.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z16.b, z31.b, z25.b\n"
+ "st1b { z20.b }, p1, [x28]\n"
+ "zip1 z19.b, z29.b, z24.b\n"
+ "st1b { z17.b }, p1, [x28, #1, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z18.b, z26.b, z21.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z17.b, z31.b, z25.b\n"
+ "zip1 z16.b, z19.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z16.b, z19.b, z18.b\n"
+ "st1b { z17.b }, p1, [x28]\n"
+ "zip2 z20.b, z3.b, z1.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z19.b, z2.b, z0.b\n"
+ "zip2 z18.b, z29.b, z24.b\n"
+ "zip1 z16.b, z20.b, z19.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z17.b, z26.b, z21.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z16.b, z20.b, z19.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x20, 5f\n"
+ "4:" // Main row loop: Column loop
+ "whilelt p0.b, XZR, x20\n"
+ "ld1b { z18.b }, p0/Z, [x9]\n"
+ "incd x9, ALL, MUL #2\n"
+ "ld1b { z17.b }, p0/Z, [x27]\n"
+ "incd x27, ALL, MUL #2\n"
+ "ld1b { z16.b }, p0/Z, [x26]\n"
+ "zip1 z18.b, z18.b, z16.b\n"
+ "ld1b { z16.b }, p0/Z, [x25]\n"
+ "incd x26, ALL, MUL #2\n"
+ "zip1 z16.b, z17.b, z16.b\n"
+ "ld1b { z17.b }, p0/Z, [x24]\n"
+ "incd x25, ALL, MUL #2\n"
+ "zip1 z19.b, z18.b, z16.b\n"
+ "ld1b { z18.b }, p0/Z, [x23]\n"
+ "incd x24, ALL, MUL #2\n"
+ "ld1b { z16.b }, p0/Z, [x22]\n"
+ "zip1 z17.b, z17.b, z16.b\n"
+ "ld1b { z16.b }, p0/Z, [x21]\n"
+ "incd x23, ALL, MUL #2\n"
+ "zip1 z16.b, z18.b, z16.b\n"
+ "st1b { z19.b }, p1, [x28]\n"
+ "incd x22, ALL, MUL #2\n"
+ "zip1 z16.b, z17.b, z16.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "incd x21, ALL, MUL #2\n"
+ "add x28, x28, %x[out_stride]\n"
+ "decw x20\n"
+ "cmp x20, #0x0\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #2\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x9, %x[in]\n"
+ "mov x28, %x[out]\n"
+ "add x27, x9, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add %x[in], x25, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x25, x25, %x[pad_row], GT\n"
+ "csel x26, x26, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x27, x27, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #2\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1b { z19.b }, p1/Z, [x9]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z18.b }, p1/Z, [x9, #1, MUL VL]\n"
+ "addvl x9, x9, #2\n"
+ "ld1b { z25.b }, p1/Z, [x27]\n"
+ "cmp x20, x19\n"
+ "ld1b { z24.b }, p1/Z, [x27, #1, MUL VL]\n"
+ "addvl x27, x27, #2\n"
+ "ld1b { z17.b }, p1/Z, [x26]\n"
+ "zip1 z23.b, z19.b, z17.b\n"
+ "ld1b { z16.b }, p1/Z, [x26, #1, MUL VL]\n"
+ "addvl x26, x26, #2\n"
+ "zip2 z22.b, z19.b, z17.b\n"
+ "ld1b { z21.b }, p1/Z, [x25]\n"
+ "ld1b { z20.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "zip1 z19.b, z18.b, z16.b\n"
+ "addvl x25, x25, #2\n"
+ "zip2 z18.b, z18.b, z16.b\n"
+ "zip1 z17.b, z25.b, z21.b\n"
+ "zip1 z16.b, z23.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z16.b, z23.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z17.b, z25.b, z21.b\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z16.b, z22.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z22.b, z17.b\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z17.b, z24.b, z20.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z16.b, z19.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z19.b, z17.b\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z17.b, z24.b, z20.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "add x28, x28, %x[out_stride]\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "whilelt p0.b, XZR, x20\n"
+ "ld1b { z17.b }, p0/Z, [x9]\n"
+ "incd x9, ALL, MUL #2\n"
+ "ld1b { z18.b }, p0/Z, [x27]\n"
+ "incd x27, ALL, MUL #2\n"
+ "ld1b { z16.b }, p0/Z, [x26]\n"
+ "zip1 z17.b, z17.b, z16.b\n"
+ "ld1b { z16.b }, p0/Z, [x25]\n"
+ "incd x26, ALL, MUL #2\n"
+ "zip1 z16.b, z18.b, z16.b\n"
+ "incd x25, ALL, MUL #2\n"
+ "decw x20\n"
+ "zip1 z16.b, z17.b, z16.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "cmp x20, #0x0\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #1\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "x9", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<1, 4, true, VLType::SVE>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_1VL_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<1, 4, true, VLType::SVE>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_1VL_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL.hpp
new file mode 100644
index 0000000000..0d694f3ec0
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL.hpp
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_3VL(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 3 * height * get_vector_length<uint8_t>();
+
+ __asm__ __volatile__(
+ "ptrue p2.b\n"
+ "cmp %x[height], #0x4\n"
+ "blt 4f\n"
+ "1:" // Main row loop: Head
+ "mov x26, %x[in]\n"
+ "mov x25, %x[out]\n"
+ "add x24, x26, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add %x[in], x22, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x21, %x[width]\n"
+ "2:" // Main row loop: Column loop
+ "mov x20, x21\n"
+ "mov x19, x25\n"
+ "whilelt p0.h, XZR, x20\n"
+ "ld1h { z27.h }, p0/Z, [x26]\n"
+ "ld1h { z26.h }, p0/Z, [x24]\n"
+ "dech x20\n"
+ "ld1h { z25.h }, p0/Z, [x23]\n"
+ "whilelt p1.h, XZR, x20\n"
+ "ld1h { z24.h }, p0/Z, [x22]\n"
+ "dech x20\n"
+ "ld1h { z23.h }, p1/Z, [x26, #1, MUL VL]\n"
+ "whilelt p0.h, XZR, x20\n"
+ "ld1h { z22.h }, p1/Z, [x24, #1, MUL VL]\n"
+ "add x25, x25, %x[out_stride]\n"
+ "ld1h { z21.h }, p0/Z, [x26, #2, MUL VL]\n"
+ "addvl x26, x26, #3\n"
+ "ld1h { z20.h }, p0/Z, [x24, #2, MUL VL]\n"
+ "addvl x24, x24, #3\n"
+ "ld1h { z19.h }, p1/Z, [x23, #1, MUL VL]\n"
+ "dech x21, ALL, MUL #3\n"
+ "ld1h { z18.h }, p0/Z, [x23, #2, MUL VL]\n"
+ "addvl x23, x23, #3\n"
+ "ld1h { z17.h }, p1/Z, [x22, #1, MUL VL]\n"
+ "cmp x21, #0x0\n"
+ "ld1h { z16.h }, p0/Z, [x22, #2, MUL VL]\n"
+ "addvl x22, x22, #3\n"
+ "st1h { z27.h }, p2, [x19]\n"
+ "st1h { z23.h }, p2, [x19, #1, MUL VL]\n"
+ "st1h { z21.h }, p2, [x19, #2, MUL VL]\n"
+ "st1h { z26.h }, p2, [x19, #3, MUL VL]\n"
+ "st1h { z22.h }, p2, [x19, #4, MUL VL]\n"
+ "st1h { z20.h }, p2, [x19, #5, MUL VL]\n"
+ "st1h { z25.h }, p2, [x19, #6, MUL VL]\n"
+ "st1h { z19.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ "st1h { z18.h }, p2, [x19, #-4, MUL VL]\n"
+ "st1h { z24.h }, p2, [x19, #-3, MUL VL]\n"
+ "st1h { z17.h }, p2, [x19, #-2, MUL VL]\n"
+ "st1h { z16.h }, p2, [x19, #-1, MUL VL]\n"
+ "bgt 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #12\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 8f\n"
+ "4:" // Main loop skip
+
+ "5:" // Tail row loop: Head
+ "mov x26, %x[in]\n"
+ "mov x25, %x[out]\n"
+ "add %x[in], x26, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x20, %x[width]\n"
+ "6:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "dech x20, ALL, MUL #3\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z18.h }, p0/Z, [x26]\n"
+ "dech x19\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x26, #1, MUL VL]\n"
+ "dech x19\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z16.h }, p0/Z, [x26, #2, MUL VL]\n"
+ "st1h { z18.h }, p2, [x25]\n"
+ "addvl x26, x26, #3\n"
+ "st1h { z17.h }, p2, [x25, #1, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "st1h { z16.h }, p2, [x25, #2, MUL VL]\n"
+ "add x25, x25, %x[out_stride]\n"
+ "bgt 6b\n"
+ "7:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #3\n"
+ "cmp %x[height], #0x1\n"
+ "bge 5b\n"
+ "8:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<3, 1, true, VLType::SVE>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_3VL(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 2,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<3, 1, true, VLType::SVE>(
+ __fp16 *out, const __fp16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_3VL(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(__fp16) / 2,
+ stride * sizeof(__fp16),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<3, 1, true, VLType::SVE>(
+ double *out, const double *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_3VL(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(double) / 2,
+ stride * sizeof(double),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL_1x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL_1x4.hpp
new file mode 100644
index 0000000000..15b32c804f
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL_1x4.hpp
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_3VL_1x4(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 3 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p1.b\n"
+ "cmp %x[height], #0x8\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x9, %x[in]\n"
+ "mov x28, %x[out]\n"
+ "add x27, x9, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #3\n"
+ "cmp x20, x19\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1b { z18.b }, p1/Z, [x9]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z19.b }, p1/Z, [x9, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1b { z10.b }, p1/Z, [x9, #2, MUL VL]\n"
+ "addvl x9, x9, #3\n"
+ "ld1b { z24.b }, p1/Z, [x27]\n"
+ "ld1b { z23.b }, p1/Z, [x27, #1, MUL VL]\n"
+ "ld1b { z9.b }, p1/Z, [x27, #2, MUL VL]\n"
+ "addvl x27, x27, #3\n"
+ "ld1b { z16.b }, p1/Z, [x26]\n"
+ "zip1 z21.b, z18.b, z16.b\n"
+ "ld1b { z17.b }, p1/Z, [x26, #1, MUL VL]\n"
+ "zip2 z18.b, z18.b, z16.b\n"
+ "ld1b { z8.b }, p1/Z, [x26, #2, MUL VL]\n"
+ "addvl x26, x26, #3\n"
+ "zip1 z22.b, z19.b, z17.b\n"
+ "ld1b { z16.b }, p1/Z, [x25]\n"
+ "zip2 z7.b, z19.b, z17.b\n"
+ "ld1b { z20.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "zip1 z6.b, z10.b, z8.b\n"
+ "ld1b { z5.b }, p1/Z, [x25, #2, MUL VL]\n"
+ "addvl x25, x25, #3\n"
+ "zip1 z17.b, z24.b, z16.b\n"
+ "ld1b { z19.b }, p1/Z, [x24]\n"
+ "zip2 z16.b, z24.b, z16.b\n"
+ "ld1b { z4.b }, p1/Z, [x24, #1, MUL VL]\n"
+ "zip1 z3.b, z21.b, z17.b\n"
+ "ld1b { z2.b }, p1/Z, [x24, #2, MUL VL]\n"
+ "addvl x24, x24, #3\n"
+ "zip2 z1.b, z21.b, z17.b\n"
+ "ld1b { z0.b }, p1/Z, [x23]\n"
+ "zip1 z31.b, z18.b, z16.b\n"
+ "ld1b { z30.b }, p1/Z, [x23, #1, MUL VL]\n"
+ "zip2 z29.b, z18.b, z16.b\n"
+ "ld1b { z28.b }, p1/Z, [x23, #2, MUL VL]\n"
+ "addvl x23, x23, #3\n"
+ "zip1 z18.b, z23.b, z20.b\n"
+ "ld1b { z17.b }, p1/Z, [x22]\n"
+ "zip2 z27.b, z23.b, z20.b\n"
+ "ld1b { z26.b }, p1/Z, [x22, #1, MUL VL]\n"
+ "zip1 z25.b, z22.b, z18.b\n"
+ "ld1b { z24.b }, p1/Z, [x22, #2, MUL VL]\n"
+ "addvl x22, x22, #3\n"
+ "zip1 z21.b, z19.b, z17.b\n"
+ "ld1b { z16.b }, p1/Z, [x21]\n"
+ "zip2 z19.b, z19.b, z17.b\n"
+ "ld1b { z23.b }, p1/Z, [x21, #1, MUL VL]\n"
+ "zip2 z20.b, z22.b, z18.b\n"
+ "ld1b { z22.b }, p1/Z, [x21, #2, MUL VL]\n"
+ "addvl x21, x21, #3\n"
+ "zip1 z17.b, z0.b, z16.b\n"
+ "st1b { z3.b }, p1, [x28]\n"
+ "zip2 z18.b, z0.b, z16.b\n"
+ "st1b { z1.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z21.b, z17.b\n"
+ "st1b { z31.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z17.b, z21.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z16.b, z19.b, z18.b\n"
+ "st1b { z17.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z19.b, z19.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z18.b, z4.b, z26.b\n"
+ "st1b { z29.b }, p1, [x28]\n"
+ "zip1 z17.b, z30.b, z23.b\n"
+ "st1b { z25.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z20.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z18.b, z18.b, z17.b\n"
+ "st1b { z19.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z17.b, z7.b, z27.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z7.b, z27.b\n"
+ "st1b { z18.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z21.b, z9.b, z5.b\n"
+ "st1b { z17.b }, p1, [x28]\n"
+ "zip2 z18.b, z4.b, z26.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z6.b, z21.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z17.b, z30.b, z23.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip1 z20.b, z2.b, z24.b\n"
+ "zip1 z19.b, z28.b, z22.b\n"
+ "zip1 z16.b, z20.b, z19.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z16.b, z6.b, z21.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z18.b, z10.b, z8.b\n"
+ "zip2 z17.b, z9.b, z5.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z20.b, z19.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip2 z18.b, z2.b, z24.b\n"
+ "zip2 z17.b, z28.b, z22.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x20, 5f\n"
+ "4:" // Main row loop: Column loop
+ "whilelt p0.b, XZR, x20\n"
+ "ld1b { z18.b }, p0/Z, [x9]\n"
+ "incd x9, ALL, MUL #6\n"
+ "ld1b { z25.b }, p0/Z, [x27]\n"
+ "incd x27, ALL, MUL #6\n"
+ "ld1b { z16.b }, p0/Z, [x26]\n"
+ "zip1 z17.b, z18.b, z16.b\n"
+ "ld1b { z24.b }, p0/Z, [x25]\n"
+ "incd x26, ALL, MUL #6\n"
+ "zip2 z19.b, z18.b, z16.b\n"
+ "ld1b { z23.b }, p0/Z, [x24]\n"
+ "incd x25, ALL, MUL #6\n"
+ "zip1 z16.b, z25.b, z24.b\n"
+ "ld1b { z22.b }, p0/Z, [x23]\n"
+ "incd x24, ALL, MUL #6\n"
+ "zip1 z18.b, z17.b, z16.b\n"
+ "ld1b { z21.b }, p0/Z, [x22]\n"
+ "incd x23, ALL, MUL #6\n"
+ "zip2 z17.b, z17.b, z16.b\n"
+ "ld1b { z20.b }, p0/Z, [x21]\n"
+ "incd x22, ALL, MUL #6\n"
+ "zip2 z16.b, z25.b, z24.b\n"
+ "st1b { z18.b }, p1, [x28]\n"
+ "incd x21, ALL, MUL #6\n"
+ "zip1 z16.b, z19.b, z16.b\n"
+ "st1b { z17.b }, p1, [x28, #1, MUL VL]\n"
+ "decw x20, ALL, MUL #3\n"
+ "zip1 z19.b, z23.b, z21.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "zip1 z18.b, z22.b, z20.b\n"
+ "zip2 z17.b, z23.b, z21.b\n"
+ "zip1 z16.b, z19.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip2 z16.b, z19.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z22.b, z20.b\n"
+ "zip1 z16.b, z17.b, z16.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #6\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x9, %x[in]\n"
+ "mov x28, %x[out]\n"
+ "add x27, x9, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add %x[in], x25, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x25, x25, %x[pad_row], GT\n"
+ "csel x26, x26, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x27, x27, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #3\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1b { z19.b }, p1/Z, [x9]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z18.b }, p1/Z, [x9, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1b { z30.b }, p1/Z, [x9, #2, MUL VL]\n"
+ "addvl x9, x9, #3\n"
+ "ld1b { z29.b }, p1/Z, [x27]\n"
+ "ld1b { z28.b }, p1/Z, [x27, #1, MUL VL]\n"
+ "ld1b { z27.b }, p1/Z, [x27, #2, MUL VL]\n"
+ "addvl x27, x27, #3\n"
+ "ld1b { z16.b }, p1/Z, [x26]\n"
+ "zip1 z26.b, z19.b, z16.b\n"
+ "ld1b { z17.b }, p1/Z, [x26, #1, MUL VL]\n"
+ "zip2 z25.b, z19.b, z16.b\n"
+ "ld1b { z24.b }, p1/Z, [x26, #2, MUL VL]\n"
+ "addvl x26, x26, #3\n"
+ "zip1 z23.b, z18.b, z17.b\n"
+ "ld1b { z16.b }, p1/Z, [x25]\n"
+ "zip2 z22.b, z18.b, z17.b\n"
+ "ld1b { z21.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "zip1 z20.b, z30.b, z24.b\n"
+ "ld1b { z19.b }, p1/Z, [x25, #2, MUL VL]\n"
+ "addvl x25, x25, #3\n"
+ "zip1 z18.b, z29.b, z16.b\n"
+ "zip2 z17.b, z29.b, z16.b\n"
+ "zip1 z16.b, z26.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z26.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z25.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z16.b, z25.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip1 z18.b, z28.b, z21.b\n"
+ "zip2 z17.b, z28.b, z21.b\n"
+ "zip1 z16.b, z23.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z16.b, z23.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z16.b, z22.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z22.b, z17.b\n"
+ "zip1 z17.b, z27.b, z19.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z20.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z16.b, z20.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z18.b, z30.b, z24.b\n"
+ "zip2 z17.b, z27.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "whilelt p0.b, XZR, x20\n"
+ "ld1b { z18.b }, p0/Z, [x9]\n"
+ "incd x9, ALL, MUL #6\n"
+ "ld1b { z21.b }, p0/Z, [x27]\n"
+ "incd x27, ALL, MUL #6\n"
+ "ld1b { z17.b }, p0/Z, [x26]\n"
+ "zip1 z20.b, z18.b, z17.b\n"
+ "ld1b { z16.b }, p0/Z, [x25]\n"
+ "incd x26, ALL, MUL #6\n"
+ "zip2 z19.b, z18.b, z17.b\n"
+ "incd x25, ALL, MUL #6\n"
+ "decw x20, ALL, MUL #3\n"
+ "zip1 z18.b, z21.b, z16.b\n"
+ "cmp x20, #0x0\n"
+ "zip2 z17.b, z21.b, z16.b\n"
+ "zip1 z16.b, z20.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z20.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z19.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #3\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "x9", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<3, 4, true, VLType::SVE>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_3VL_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<3, 4, true, VLType::SVE>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_3VL_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL_2x2.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL_2x2.hpp
new file mode 100644
index 0000000000..1864a16758
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_3VL_2x2.hpp
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_3VL_2x2(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 2) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 3 * roundup<size_t>(height, 2) * get_vector_length<uint16_t>();
+
+ __asm__ __volatile__(
+ "ptrue p2.b\n"
+ "cmp %x[height], #0x8\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x11, %x[in]\n"
+ "mov x10, %x[out]\n"
+ "add x9, x11, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add %x[in], x23, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x22, %x[width]\n"
+ "cnth x21, ALL, MUL #3\n"
+ "cmp x22, x21\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1h { z19.h }, p2/Z, [x11]\n"
+ "mov x20, x10\n"
+ "ld1h { z18.h }, p2/Z, [x11, #1, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "ld1h { z21.h }, p2/Z, [x11, #2, MUL VL]\n"
+ "addvl x11, x11, #3\n"
+ "ld1h { z16.h }, p2/Z, [x9]\n"
+ "zip1 z9.h, z19.h, z16.h\n"
+ "ld1h { z17.h }, p2/Z, [x9, #1, MUL VL]\n"
+ "mov x19, x10\n"
+ "zip2 z8.h, z19.h, z16.h\n"
+ "ld1h { z16.h }, p2/Z, [x9, #2, MUL VL]\n"
+ "addvl x9, x9, #3\n"
+ "zip1 z7.h, z18.h, z17.h\n"
+ "ld1h { z19.h }, p2/Z, [x28]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip2 z6.h, z18.h, z17.h\n"
+ "ld1h { z20.h }, p2/Z, [x28, #1, MUL VL]\n"
+ "sub x22, x22, x21\n"
+ "zip1 z5.h, z21.h, z16.h\n"
+ "ld1h { z18.h }, p2/Z, [x28, #2, MUL VL]\n"
+ "addvl x28, x28, #3\n"
+ "zip2 z4.h, z21.h, z16.h\n"
+ "ld1h { z16.h }, p2/Z, [x27]\n"
+ "cmp x22, x21\n"
+ "zip1 z3.h, z19.h, z16.h\n"
+ "ld1h { z17.h }, p2/Z, [x27, #1, MUL VL]\n"
+ "zip2 z2.h, z19.h, z16.h\n"
+ "ld1h { z16.h }, p2/Z, [x27, #2, MUL VL]\n"
+ "addvl x27, x27, #3\n"
+ "zip1 z1.h, z20.h, z17.h\n"
+ "ld1h { z19.h }, p2/Z, [x26]\n"
+ "zip2 z0.h, z20.h, z17.h\n"
+ "ld1h { z21.h }, p2/Z, [x26, #1, MUL VL]\n"
+ "zip1 z31.h, z18.h, z16.h\n"
+ "ld1h { z20.h }, p2/Z, [x26, #2, MUL VL]\n"
+ "addvl x26, x26, #3\n"
+ "zip2 z30.h, z18.h, z16.h\n"
+ "ld1h { z18.h }, p2/Z, [x25]\n"
+ "ld1h { z17.h }, p2/Z, [x25, #1, MUL VL]\n"
+ "zip1 z29.h, z19.h, z18.h\n"
+ "ld1h { z16.h }, p2/Z, [x25, #2, MUL VL]\n"
+ "addvl x25, x25, #3\n"
+ "zip2 z28.h, z19.h, z18.h\n"
+ "ld1h { z19.h }, p2/Z, [x24]\n"
+ "zip1 z27.h, z21.h, z17.h\n"
+ "ld1h { z26.h }, p2/Z, [x24, #1, MUL VL]\n"
+ "zip2 z25.h, z21.h, z17.h\n"
+ "ld1h { z24.h }, p2/Z, [x24, #2, MUL VL]\n"
+ "addvl x24, x24, #3\n"
+ "zip1 z23.h, z20.h, z16.h\n"
+ "ld1h { z18.h }, p2/Z, [x23]\n"
+ "zip2 z22.h, z20.h, z16.h\n"
+ "ld1h { z17.h }, p2/Z, [x23, #1, MUL VL]\n"
+ "ld1h { z16.h }, p2/Z, [x23, #2, MUL VL]\n"
+ "zip1 z21.h, z19.h, z18.h\n"
+ "st1h { z9.h }, p2, [x20]\n"
+ "addvl x23, x23, #3\n"
+ "zip2 z20.h, z19.h, z18.h\n"
+ "st1h { z8.h }, p2, [x20, #1, MUL VL]\n"
+ "zip1 z19.h, z26.h, z17.h\n"
+ "st1h { z7.h }, p2, [x20, #2, MUL VL]\n"
+ "zip2 z18.h, z26.h, z17.h\n"
+ "st1h { z3.h }, p2, [x20, #3, MUL VL]\n"
+ "zip1 z17.h, z24.h, z16.h\n"
+ "st1h { z2.h }, p2, [x20, #4, MUL VL]\n"
+ "zip2 z16.h, z24.h, z16.h\n"
+ "st1h { z1.h }, p2, [x20, #5, MUL VL]\n"
+ "st1h { z29.h }, p2, [x20, #6, MUL VL]\n"
+ "st1h { z28.h }, p2, [x20, #7, MUL VL]\n"
+ "addvl x20, x20, #12\n"
+ "st1h { z27.h }, p2, [x20, #-4, MUL VL]\n"
+ "st1h { z21.h }, p2, [x20, #-3, MUL VL]\n"
+ "st1h { z20.h }, p2, [x20, #-2, MUL VL]\n"
+ "st1h { z19.h }, p2, [x20, #-1, MUL VL]\n"
+ "st1h { z6.h }, p2, [x19]\n"
+ "st1h { z5.h }, p2, [x19, #1, MUL VL]\n"
+ "st1h { z4.h }, p2, [x19, #2, MUL VL]\n"
+ "st1h { z0.h }, p2, [x19, #3, MUL VL]\n"
+ "st1h { z31.h }, p2, [x19, #4, MUL VL]\n"
+ "st1h { z30.h }, p2, [x19, #5, MUL VL]\n"
+ "st1h { z25.h }, p2, [x19, #6, MUL VL]\n"
+ "st1h { z23.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ "st1h { z22.h }, p2, [x19, #-4, MUL VL]\n"
+ "st1h { z18.h }, p2, [x19, #-3, MUL VL]\n"
+ "st1h { z17.h }, p2, [x19, #-2, MUL VL]\n"
+ "st1h { z16.h }, p2, [x19, #-1, MUL VL]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x20, x22\n"
+ "mov x19, x10\n"
+ "whilelt p1.h, XZR, x20\n"
+ "ld1h { z17.h }, p1/Z, [x11]\n"
+ "ld1h { z16.h }, p1/Z, [x9]\n"
+ "zip1 z29.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p1/Z, [x28]\n"
+ "dech x20\n"
+ "zip2 z28.h, z17.h, z16.h\n"
+ "ld1h { z16.h }, p1/Z, [x27]\n"
+ "whilelt p0.h, XZR, x20\n"
+ "zip1 z27.h, z18.h, z16.h\n"
+ "ld1h { z17.h }, p0/Z, [x11, #1, MUL VL]\n"
+ "addvl x11, x11, #1\n"
+ "zip2 z26.h, z18.h, z16.h\n"
+ "ld1h { z16.h }, p0/Z, [x9, #1, MUL VL]\n"
+ "incd x11, ALL, MUL #4\n"
+ "zip1 z25.h, z17.h, z16.h\n"
+ "ld1h { z17.h }, p0/Z, [x28, #1, MUL VL]\n"
+ "addvl x9, x9, #1\n"
+ "ld1h { z16.h }, p0/Z, [x27, #1, MUL VL]\n"
+ "zip1 z24.h, z17.h, z16.h\n"
+ "ld1h { z19.h }, p1/Z, [x26]\n"
+ "incd x9, ALL, MUL #4\n"
+ "ld1h { z18.h }, p0/Z, [x26, #1, MUL VL]\n"
+ "addvl x28, x28, #1\n"
+ "ld1h { z17.h }, p1/Z, [x25]\n"
+ "zip1 z23.h, z19.h, z17.h\n"
+ "ld1h { z16.h }, p0/Z, [x25, #1, MUL VL]\n"
+ "incd x28, ALL, MUL #4\n"
+ "zip2 z22.h, z19.h, z17.h\n"
+ "ld1h { z21.h }, p1/Z, [x24]\n"
+ "addvl x27, x27, #1\n"
+ "zip1 z20.h, z18.h, z16.h\n"
+ "ld1h { z19.h }, p0/Z, [x24, #1, MUL VL]\n"
+ "incd x27, ALL, MUL #4\n"
+ "ld1h { z17.h }, p1/Z, [x23]\n"
+ "zip1 z18.h, z21.h, z17.h\n"
+ "ld1h { z16.h }, p0/Z, [x23, #1, MUL VL]\n"
+ "addvl x26, x26, #1\n"
+ "zip2 z17.h, z21.h, z17.h\n"
+ "st1h { z29.h }, p2, [x19]\n"
+ "incd x26, ALL, MUL #4\n"
+ "zip1 z16.h, z19.h, z16.h\n"
+ "st1h { z28.h }, p2, [x19, #1, MUL VL]\n"
+ "addvl x25, x25, #1\n"
+ "st1h { z25.h }, p2, [x19, #2, MUL VL]\n"
+ "incd x25, ALL, MUL #4\n"
+ "st1h { z27.h }, p2, [x19, #3, MUL VL]\n"
+ "addvl x24, x24, #1\n"
+ "st1h { z26.h }, p2, [x19, #4, MUL VL]\n"
+ "incd x24, ALL, MUL #4\n"
+ "st1h { z24.h }, p2, [x19, #5, MUL VL]\n"
+ "addvl x23, x23, #1\n"
+ "st1h { z23.h }, p2, [x19, #6, MUL VL]\n"
+ "incd x23, ALL, MUL #4\n"
+ "st1h { z22.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ "add x10, x10, %x[out_stride]\n"
+ "st1h { z20.h }, p2, [x19, #-4, MUL VL]\n"
+ "st1h { z18.h }, p2, [x19, #-3, MUL VL]\n"
+ "decw x22, ALL, MUL #3\n"
+ "st1h { z17.h }, p2, [x19, #-2, MUL VL]\n"
+ "cmp x22, #0x0\n"
+ "st1h { z16.h }, p2, [x19, #-1, MUL VL]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #12\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x11, %x[in]\n"
+ "mov x10, %x[out]\n"
+ "add x9, x11, %x[in_stride]\n"
+ "add %x[in], x9, %x[in_stride]\n"
+ "cmp %x[height], #0x1\n"
+ "csel x9, x9, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x2\n"
+ "mov x20, %x[width]\n"
+ "cnth x19, ALL, MUL #3\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1h { z17.h }, p2/Z, [x11]\n"
+ "sub x20, x20, x19\n"
+ "ld1h { z22.h }, p2/Z, [x11, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1h { z21.h }, p2/Z, [x11, #2, MUL VL]\n"
+ "addvl x11, x11, #3\n"
+ "ld1h { z16.h }, p2/Z, [x9]\n"
+ "zip1 z20.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p2/Z, [x9, #1, MUL VL]\n"
+ "zip2 z17.h, z17.h, z16.h\n"
+ "ld1h { z19.h }, p2/Z, [x9, #2, MUL VL]\n"
+ "addvl x9, x9, #3\n"
+ "zip1 z16.h, z22.h, z18.h\n"
+ "st1h { z20.h }, p2, [x10]\n"
+ "zip2 z18.h, z22.h, z18.h\n"
+ "st1h { z17.h }, p2, [x10, #1, MUL VL]\n"
+ "zip1 z17.h, z21.h, z19.h\n"
+ "st1h { z16.h }, p2, [x10, #2, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip2 z16.h, z21.h, z19.h\n"
+ "st1h { z18.h }, p2, [x10]\n"
+ "st1h { z17.h }, p2, [x10, #1, MUL VL]\n"
+ "st1h { z16.h }, p2, [x10, #2, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "decw x20, ALL, MUL #3\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x11]\n"
+ "ld1h { z16.h }, p0/Z, [x9]\n"
+ "zip1 z19.h, z17.h, z16.h\n"
+ "dech x19\n"
+ "zip2 z18.h, z17.h, z16.h\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x11, #1, MUL VL]\n"
+ "addvl x11, x11, #1\n"
+ "ld1h { z16.h }, p0/Z, [x9, #1, MUL VL]\n"
+ "zip1 z16.h, z17.h, z16.h\n"
+ "st1h { z19.h }, p2, [x10]\n"
+ "incd x11, ALL, MUL #4\n"
+ "st1h { z18.h }, p2, [x10, #1, MUL VL]\n"
+ "addvl x9, x9, #1\n"
+ "st1h { z16.h }, p2, [x10, #2, MUL VL]\n"
+ "incd x9, ALL, MUL #4\n"
+ "add x10, x10, %x[out_stride]\n"
+ "cmp x20, #0x0\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #3\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "x9", "x10", "x11", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<3, 2, true, VLType::SVE>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_3VL_2x2(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL.hpp
new file mode 100644
index 0000000000..aa9d7220fe
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL.hpp
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_4VL(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 4 * height * get_vector_length<uint8_t>();
+
+ __asm__ __volatile__(
+ "ptrue p3.b\n"
+ "cmp %x[height], #0x4\n"
+ "blt 4f\n"
+ "1:" // Main row loop: Head
+ "mov x26, %x[in]\n"
+ "mov x25, %x[out]\n"
+ "add x24, x26, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add %x[in], x22, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x21, %x[width]\n"
+ "2:" // Main row loop: Column loop
+ "mov x20, x21\n"
+ "mov x19, x25\n"
+ "whilelt p0.h, XZR, x20\n"
+ "ld1h { z31.h }, p0/Z, [x26]\n"
+ "ld1h { z30.h }, p0/Z, [x24]\n"
+ "dech x20\n"
+ "ld1h { z29.h }, p0/Z, [x23]\n"
+ "whilelt p2.h, XZR, x20\n"
+ "ld1h { z28.h }, p0/Z, [x22]\n"
+ "dech x20\n"
+ "ld1h { z27.h }, p2/Z, [x26, #1, MUL VL]\n"
+ "whilelt p1.h, XZR, x20\n"
+ "ld1h { z26.h }, p2/Z, [x24, #1, MUL VL]\n"
+ "dech x20\n"
+ "ld1h { z25.h }, p1/Z, [x26, #2, MUL VL]\n"
+ "whilelt p0.h, XZR, x20\n"
+ "ld1h { z24.h }, p1/Z, [x24, #2, MUL VL]\n"
+ "add x25, x25, %x[out_stride]\n"
+ "ld1h { z23.h }, p0/Z, [x26, #3, MUL VL]\n"
+ "addvl x26, x26, #4\n"
+ "ld1h { z22.h }, p0/Z, [x24, #3, MUL VL]\n"
+ "addvl x24, x24, #4\n"
+ "ld1h { z21.h }, p2/Z, [x23, #1, MUL VL]\n"
+ "dech x21, ALL, MUL #4\n"
+ "ld1h { z20.h }, p1/Z, [x23, #2, MUL VL]\n"
+ "cmp x21, #0x0\n"
+ "ld1h { z19.h }, p0/Z, [x23, #3, MUL VL]\n"
+ "addvl x23, x23, #4\n"
+ "ld1h { z18.h }, p2/Z, [x22, #1, MUL VL]\n"
+ "ld1h { z17.h }, p1/Z, [x22, #2, MUL VL]\n"
+ "ld1h { z16.h }, p0/Z, [x22, #3, MUL VL]\n"
+ "addvl x22, x22, #4\n"
+ "st1h { z31.h }, p3, [x19]\n"
+ "st1h { z27.h }, p3, [x19, #1, MUL VL]\n"
+ "st1h { z25.h }, p3, [x19, #2, MUL VL]\n"
+ "st1h { z23.h }, p3, [x19, #3, MUL VL]\n"
+ "st1h { z30.h }, p3, [x19, #4, MUL VL]\n"
+ "st1h { z26.h }, p3, [x19, #5, MUL VL]\n"
+ "st1h { z24.h }, p3, [x19, #6, MUL VL]\n"
+ "st1h { z22.h }, p3, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "st1h { z29.h }, p3, [x19, #-8, MUL VL]\n"
+ "st1h { z21.h }, p3, [x19, #-7, MUL VL]\n"
+ "st1h { z20.h }, p3, [x19, #-6, MUL VL]\n"
+ "st1h { z19.h }, p3, [x19, #-5, MUL VL]\n"
+ "st1h { z28.h }, p3, [x19, #-4, MUL VL]\n"
+ "st1h { z18.h }, p3, [x19, #-3, MUL VL]\n"
+ "st1h { z17.h }, p3, [x19, #-2, MUL VL]\n"
+ "st1h { z16.h }, p3, [x19, #-1, MUL VL]\n"
+ "bgt 2b\n"
+ "3:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #16\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 8f\n"
+ "4:" // Main loop skip
+
+ "5:" // Tail row loop: Head
+ "mov x26, %x[in]\n"
+ "mov x25, %x[out]\n"
+ "add %x[in], x26, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x20, %x[width]\n"
+ "6:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "dech x20, ALL, MUL #4\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z19.h }, p0/Z, [x26]\n"
+ "dech x19\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z18.h }, p0/Z, [x26, #1, MUL VL]\n"
+ "dech x19\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x26, #2, MUL VL]\n"
+ "dech x19\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z16.h }, p0/Z, [x26, #3, MUL VL]\n"
+ "st1h { z19.h }, p3, [x25]\n"
+ "addvl x26, x26, #4\n"
+ "st1h { z18.h }, p3, [x25, #1, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "st1h { z17.h }, p3, [x25, #2, MUL VL]\n"
+ "st1h { z16.h }, p3, [x25, #3, MUL VL]\n"
+ "add x25, x25, %x[out_stride]\n"
+ "bgt 6b\n"
+ "7:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #4\n"
+ "cmp %x[height], #0x1\n"
+ "bge 5b\n"
+ "8:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "p3", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<4, 1, true, VLType::SVE>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_4VL(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 2,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<4, 1, true, VLType::SVE>(
+ __fp16 *out, const __fp16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_4VL(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(__fp16) / 2,
+ stride * sizeof(__fp16),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<4, 1, true, VLType::SVE>(
+ double *out, const double *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_4VL(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(double) / 2,
+ stride * sizeof(double),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL_1x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL_1x4.hpp
new file mode 100644
index 0000000000..5e5f7a53a7
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL_1x4.hpp
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_4VL_1x4(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 4 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p1.b\n"
+ "cmp %x[height], #0x8\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x9, %x[in]\n"
+ "mov x28, %x[out]\n"
+ "add x27, x9, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #2\n"
+ "cmp x20, x19\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1b { z17.b }, p1/Z, [x9]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z3.b }, p1/Z, [x9, #1, MUL VL]\n"
+ "addvl x9, x9, #2\n"
+ "ld1b { z20.b }, p1/Z, [x27]\n"
+ "cmp x20, x19\n"
+ "ld1b { z2.b }, p1/Z, [x27, #1, MUL VL]\n"
+ "addvl x27, x27, #2\n"
+ "ld1b { z16.b }, p1/Z, [x26]\n"
+ "zip1 z18.b, z17.b, z16.b\n"
+ "ld1b { z1.b }, p1/Z, [x26, #1, MUL VL]\n"
+ "addvl x26, x26, #2\n"
+ "zip2 z19.b, z17.b, z16.b\n"
+ "ld1b { z17.b }, p1/Z, [x25]\n"
+ "ld1b { z0.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "zip1 z31.b, z3.b, z1.b\n"
+ "ld1b { z30.b }, p1/Z, [x24]\n"
+ "addvl x25, x25, #2\n"
+ "zip1 z16.b, z20.b, z17.b\n"
+ "ld1b { z29.b }, p1/Z, [x24, #1, MUL VL]\n"
+ "addvl x24, x24, #2\n"
+ "zip1 z28.b, z18.b, z16.b\n"
+ "ld1b { z27.b }, p1/Z, [x23]\n"
+ "zip2 z26.b, z18.b, z16.b\n"
+ "ld1b { z25.b }, p1/Z, [x23, #1, MUL VL]\n"
+ "addvl x23, x23, #2\n"
+ "zip2 z18.b, z20.b, z17.b\n"
+ "ld1b { z16.b }, p1/Z, [x22]\n"
+ "zip1 z24.b, z2.b, z0.b\n"
+ "ld1b { z23.b }, p1/Z, [x22, #1, MUL VL]\n"
+ "addvl x22, x22, #2\n"
+ "zip1 z17.b, z19.b, z18.b\n"
+ "ld1b { z22.b }, p1/Z, [x21]\n"
+ "zip2 z21.b, z19.b, z18.b\n"
+ "ld1b { z20.b }, p1/Z, [x21, #1, MUL VL]\n"
+ "addvl x21, x21, #2\n"
+ "zip1 z19.b, z30.b, z16.b\n"
+ "st1b { z28.b }, p1, [x28]\n"
+ "zip2 z18.b, z30.b, z16.b\n"
+ "st1b { z26.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z27.b, z22.b\n"
+ "st1b { z17.b }, p1, [x28, #2, MUL VL]\n"
+ "zip1 z17.b, z19.b, z16.b\n"
+ "st1b { z21.b }, p1, [x28, #3, MUL VL]\n"
+ "zip2 z16.b, z19.b, z16.b\n"
+ "st1b { z17.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z17.b, z27.b, z22.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #7, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z16.b, z31.b, z24.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z31.b, z24.b\n"
+ "zip2 z18.b, z3.b, z1.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z17.b, z2.b, z0.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z18.b, z29.b, z23.b\n"
+ "zip1 z17.b, z25.b, z20.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "zip2 z18.b, z29.b, z23.b\n"
+ "zip2 z17.b, z25.b, z20.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #7, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x20, 5f\n"
+ "4:" // Main row loop: Column loop
+ "whilelt p0.b, XZR, x20\n"
+ "ld1b { z17.b }, p0/Z, [x9]\n"
+ "addvl x9, x9, #1\n"
+ "ld1b { z25.b }, p0/Z, [x27]\n"
+ "addvl x27, x27, #1\n"
+ "ld1b { z16.b }, p0/Z, [x26]\n"
+ "zip1 z18.b, z17.b, z16.b\n"
+ "ld1b { z24.b }, p0/Z, [x25]\n"
+ "addvl x26, x26, #1\n"
+ "zip2 z23.b, z17.b, z16.b\n"
+ "ld1b { z22.b }, p0/Z, [x24]\n"
+ "addvl x25, x25, #1\n"
+ "zip1 z16.b, z25.b, z24.b\n"
+ "ld1b { z21.b }, p0/Z, [x23]\n"
+ "addvl x24, x24, #1\n"
+ "zip1 z17.b, z18.b, z16.b\n"
+ "ld1b { z20.b }, p0/Z, [x22]\n"
+ "addvl x23, x23, #1\n"
+ "zip2 z18.b, z18.b, z16.b\n"
+ "ld1b { z19.b }, p0/Z, [x21]\n"
+ "addvl x22, x22, #1\n"
+ "zip2 z16.b, z25.b, z24.b\n"
+ "st1b { z17.b }, p1, [x28]\n"
+ "addvl x21, x21, #1\n"
+ "zip1 z17.b, z23.b, z16.b\n"
+ "st1b { z18.b }, p1, [x28, #1, MUL VL]\n"
+ "decw x20, ALL, MUL #4\n"
+ "zip2 z16.b, z23.b, z16.b\n"
+ "st1b { z17.b }, p1, [x28, #2, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "zip1 z18.b, z22.b, z20.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z17.b, z21.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "zip2 z18.b, z22.b, z20.b\n"
+ "zip2 z17.b, z21.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #7, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #8\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x9, %x[in]\n"
+ "mov x28, %x[out]\n"
+ "add x27, x9, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add %x[in], x25, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x25, x25, %x[pad_row], GT\n"
+ "csel x26, x26, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x27, x27, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #2\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1b { z18.b }, p1/Z, [x9]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z19.b }, p1/Z, [x9, #1, MUL VL]\n"
+ "addvl x9, x9, #2\n"
+ "ld1b { z25.b }, p1/Z, [x27]\n"
+ "cmp x20, x19\n"
+ "ld1b { z24.b }, p1/Z, [x27, #1, MUL VL]\n"
+ "addvl x27, x27, #2\n"
+ "ld1b { z17.b }, p1/Z, [x26]\n"
+ "zip1 z23.b, z18.b, z17.b\n"
+ "ld1b { z16.b }, p1/Z, [x26, #1, MUL VL]\n"
+ "addvl x26, x26, #2\n"
+ "zip2 z22.b, z18.b, z17.b\n"
+ "ld1b { z18.b }, p1/Z, [x25]\n"
+ "ld1b { z21.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "zip1 z20.b, z19.b, z16.b\n"
+ "addvl x25, x25, #2\n"
+ "zip2 z19.b, z19.b, z16.b\n"
+ "zip1 z17.b, z25.b, z18.b\n"
+ "zip1 z16.b, z23.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z23.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z17.b, z25.b, z18.b\n"
+ "zip1 z16.b, z22.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z22.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z18.b, z24.b, z21.b\n"
+ "zip2 z17.b, z24.b, z21.b\n"
+ "zip1 z16.b, z20.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z20.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z19.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z19.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "whilelt p0.b, XZR, x20\n"
+ "ld1b { z18.b }, p0/Z, [x9]\n"
+ "addvl x9, x9, #1\n"
+ "ld1b { z21.b }, p0/Z, [x27]\n"
+ "addvl x27, x27, #1\n"
+ "ld1b { z17.b }, p0/Z, [x26]\n"
+ "zip1 z20.b, z18.b, z17.b\n"
+ "ld1b { z16.b }, p0/Z, [x25]\n"
+ "addvl x26, x26, #1\n"
+ "zip2 z19.b, z18.b, z17.b\n"
+ "addvl x25, x25, #1\n"
+ "decw x20, ALL, MUL #4\n"
+ "zip1 z18.b, z21.b, z16.b\n"
+ "cmp x20, #0x0\n"
+ "zip2 z17.b, z21.b, z16.b\n"
+ "zip1 z16.b, z20.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z20.b, z18.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z16.b, z19.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z19.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #4\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "x9", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<4, 4, true, VLType::SVE>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_4VL_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<4, 4, true, VLType::SVE>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_4VL_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL_2x2.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL_2x2.hpp
new file mode 100644
index 0000000000..48040f9edb
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_4VL_2x2.hpp
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_4VL_2x2(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 2) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 4 * roundup<size_t>(height, 2) * get_vector_length<uint16_t>();
+
+ __asm__ __volatile__(
+ "ptrue p2.b\n"
+ "cmp %x[height], #0x8\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x11, %x[in]\n"
+ "mov x10, %x[out]\n"
+ "add x9, x11, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add %x[in], x23, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x22, %x[width]\n"
+ "cnth x21, ALL, MUL #4\n"
+ "cmp x22, x21\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1h { z21.h }, p2/Z, [x11]\n"
+ "mov x20, x10\n"
+ "ld1h { z19.h }, p2/Z, [x11, #1, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "ld1h { z23.h }, p2/Z, [x11, #2, MUL VL]\n"
+ "mov x19, x10\n"
+ "ld1h { z31.h }, p2/Z, [x11, #3, MUL VL]\n"
+ "addvl x11, x11, #4\n"
+ "ld1h { z29.h }, p2/Z, [x9]\n"
+ "zip1 z0.h, z21.h, z29.h\n"
+ "ld1h { z17.h }, p2/Z, [x9, #1, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip2 z22.h, z21.h, z29.h\n"
+ "ld1h { z15.h }, p2/Z, [x9, #2, MUL VL]\n"
+ "sub x22, x22, x21\n"
+ "zip1 z13.h, z19.h, z17.h\n"
+ "ld1h { z6.h }, p2/Z, [x9, #3, MUL VL]\n"
+ "addvl x9, x9, #4\n"
+ "zip2 z12.h, z19.h, z17.h\n"
+ "ld1h { z20.h }, p2/Z, [x28]\n"
+ "cmp x22, x21\n"
+ "zip1 z14.h, z23.h, z15.h\n"
+ "ld1h { z1.h }, p2/Z, [x28, #1, MUL VL]\n"
+ "zip2 z3.h, z23.h, z15.h\n"
+ "ld1h { z19.h }, p2/Z, [x28, #2, MUL VL]\n"
+ "zip1 z16.h, z31.h, z6.h\n"
+ "ld1h { z11.h }, p2/Z, [x28, #3, MUL VL]\n"
+ "addvl x28, x28, #4\n"
+ "zip2 z10.h, z31.h, z6.h\n"
+ "ld1h { z27.h }, p2/Z, [x27]\n"
+ "ld1h { z18.h }, p2/Z, [x27, #1, MUL VL]\n"
+ "zip1 z9.h, z20.h, z27.h\n"
+ "ld1h { z2.h }, p2/Z, [x27, #2, MUL VL]\n"
+ "zip2 z24.h, z20.h, z27.h\n"
+ "ld1h { z5.h }, p2/Z, [x27, #3, MUL VL]\n"
+ "addvl x27, x27, #4\n"
+ "zip1 z8.h, z1.h, z18.h\n"
+ "ld1h { z30.h }, p2/Z, [x26]\n"
+ "zip2 z17.h, z1.h, z18.h\n"
+ "ld1h { z28.h }, p2/Z, [x26, #1, MUL VL]\n"
+ "zip1 z6.h, z19.h, z2.h\n"
+ "ld1h { z23.h }, p2/Z, [x26, #2, MUL VL]\n"
+ "zip2 z1.h, z19.h, z2.h\n"
+ "ld1h { z25.h }, p2/Z, [x26, #3, MUL VL]\n"
+ "addvl x26, x26, #4\n"
+ "zip1 z31.h, z11.h, z5.h\n"
+ "ld1h { z21.h }, p2/Z, [x25]\n"
+ "zip2 z11.h, z11.h, z5.h\n"
+ "ld1h { z19.h }, p2/Z, [x25, #1, MUL VL]\n"
+ "ld1h { z18.h }, p2/Z, [x25, #2, MUL VL]\n"
+ "zip1 z29.h, z30.h, z21.h\n"
+ "ld1h { z26.h }, p2/Z, [x25, #3, MUL VL]\n"
+ "addvl x25, x25, #4\n"
+ "zip2 z30.h, z30.h, z21.h\n"
+ "ld1h { z21.h }, p2/Z, [x24]\n"
+ "zip1 z27.h, z28.h, z19.h\n"
+ "ld1h { z20.h }, p2/Z, [x24, #1, MUL VL]\n"
+ "zip2 z28.h, z28.h, z19.h\n"
+ "ld1h { z4.h }, p2/Z, [x24, #2, MUL VL]\n"
+ "zip1 z2.h, z23.h, z18.h\n"
+ "ld1h { z15.h }, p2/Z, [x24, #3, MUL VL]\n"
+ "addvl x24, x24, #4\n"
+ "zip2 z5.h, z23.h, z18.h\n"
+ "ld1h { z23.h }, p2/Z, [x23]\n"
+ "zip1 z7.h, z25.h, z26.h\n"
+ "ld1h { z19.h }, p2/Z, [x23, #1, MUL VL]\n"
+ "zip2 z25.h, z25.h, z26.h\n"
+ "ld1h { z18.h }, p2/Z, [x23, #2, MUL VL]\n"
+ "ld1h { z26.h }, p2/Z, [x23, #3, MUL VL]\n"
+ "addvl x23, x23, #4\n"
+ "st1h { z0.h }, p2, [x20]\n"
+ "zip1 z0.h, z21.h, z23.h\n"
+ "zip2 z23.h, z21.h, z23.h\n"
+ "st1h { z22.h }, p2, [x20, #1, MUL VL]\n"
+ "zip1 z22.h, z20.h, z19.h\n"
+ "st1h { z13.h }, p2, [x20, #2, MUL VL]\n"
+ "zip2 z21.h, z20.h, z19.h\n"
+ "st1h { z12.h }, p2, [x20, #3, MUL VL]\n"
+ "zip1 z20.h, z4.h, z18.h\n"
+ "st1h { z9.h }, p2, [x20, #4, MUL VL]\n"
+ "zip2 z19.h, z4.h, z18.h\n"
+ "st1h { z24.h }, p2, [x20, #5, MUL VL]\n"
+ "zip1 z18.h, z15.h, z26.h\n"
+ "st1h { z8.h }, p2, [x20, #6, MUL VL]\n"
+ "zip2 z9.h, z15.h, z26.h\n"
+ "st1h { z17.h }, p2, [x20, #7, MUL VL]\n"
+ "addvl x20, x20, #16\n"
+ "st1h { z29.h }, p2, [x20, #-8, MUL VL]\n"
+ "st1h { z30.h }, p2, [x20, #-7, MUL VL]\n"
+ "st1h { z27.h }, p2, [x20, #-6, MUL VL]\n"
+ "st1h { z28.h }, p2, [x20, #-5, MUL VL]\n"
+ "st1h { z0.h }, p2, [x20, #-4, MUL VL]\n"
+ "st1h { z23.h }, p2, [x20, #-3, MUL VL]\n"
+ "st1h { z22.h }, p2, [x20, #-2, MUL VL]\n"
+ "st1h { z21.h }, p2, [x20, #-1, MUL VL]\n"
+ "st1h { z14.h }, p2, [x19]\n"
+ "st1h { z3.h }, p2, [x19, #1, MUL VL]\n"
+ "st1h { z16.h }, p2, [x19, #2, MUL VL]\n"
+ "st1h { z10.h }, p2, [x19, #3, MUL VL]\n"
+ "st1h { z6.h }, p2, [x19, #4, MUL VL]\n"
+ "st1h { z1.h }, p2, [x19, #5, MUL VL]\n"
+ "st1h { z31.h }, p2, [x19, #6, MUL VL]\n"
+ "st1h { z11.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "st1h { z2.h }, p2, [x19, #-8, MUL VL]\n"
+ "st1h { z5.h }, p2, [x19, #-7, MUL VL]\n"
+ "st1h { z7.h }, p2, [x19, #-6, MUL VL]\n"
+ "st1h { z25.h }, p2, [x19, #-5, MUL VL]\n"
+ "st1h { z20.h }, p2, [x19, #-4, MUL VL]\n"
+ "st1h { z19.h }, p2, [x19, #-3, MUL VL]\n"
+ "st1h { z18.h }, p2, [x19, #-2, MUL VL]\n"
+ "st1h { z9.h }, p2, [x19, #-1, MUL VL]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x20, x22\n"
+ "mov x19, x10\n"
+ "whilelt p1.h, XZR, x20\n"
+ "ld1h { z18.h }, p1/Z, [x11]\n"
+ "ld1h { z16.h }, p1/Z, [x9]\n"
+ "zip1 z0.h, z18.h, z16.h\n"
+ "ld1h { z17.h }, p1/Z, [x28]\n"
+ "dech x20\n"
+ "zip2 z31.h, z18.h, z16.h\n"
+ "ld1h { z16.h }, p1/Z, [x27]\n"
+ "whilelt p0.h, XZR, x20\n"
+ "zip1 z30.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p0/Z, [x11, #1, MUL VL]\n"
+ "addvl x11, x11, #2\n"
+ "zip2 z29.h, z17.h, z16.h\n"
+ "ld1h { z16.h }, p0/Z, [x9, #1, MUL VL]\n"
+ "addvl x9, x9, #2\n"
+ "zip1 z28.h, z18.h, z16.h\n"
+ "ld1h { z17.h }, p0/Z, [x28, #1, MUL VL]\n"
+ "addvl x28, x28, #2\n"
+ "zip2 z27.h, z18.h, z16.h\n"
+ "ld1h { z16.h }, p0/Z, [x27, #1, MUL VL]\n"
+ "addvl x27, x27, #2\n"
+ "zip1 z26.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p1/Z, [x26]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip2 z25.h, z17.h, z16.h\n"
+ "ld1h { z19.h }, p0/Z, [x26, #1, MUL VL]\n"
+ "addvl x26, x26, #2\n"
+ "ld1h { z17.h }, p1/Z, [x25]\n"
+ "zip1 z24.h, z18.h, z17.h\n"
+ "ld1h { z16.h }, p0/Z, [x25, #1, MUL VL]\n"
+ "addvl x25, x25, #2\n"
+ "zip2 z23.h, z18.h, z17.h\n"
+ "ld1h { z18.h }, p1/Z, [x24]\n"
+ "decw x22, ALL, MUL #4\n"
+ "zip1 z22.h, z19.h, z16.h\n"
+ "ld1h { z21.h }, p0/Z, [x24, #1, MUL VL]\n"
+ "addvl x24, x24, #2\n"
+ "zip2 z20.h, z19.h, z16.h\n"
+ "ld1h { z17.h }, p1/Z, [x23]\n"
+ "cmp x22, #0x0\n"
+ "zip1 z19.h, z18.h, z17.h\n"
+ "ld1h { z16.h }, p0/Z, [x23, #1, MUL VL]\n"
+ "addvl x23, x23, #2\n"
+ "zip2 z18.h, z18.h, z17.h\n"
+ "st1h { z0.h }, p2, [x19]\n"
+ "st1h { z31.h }, p2, [x19, #1, MUL VL]\n"
+ "zip1 z17.h, z21.h, z16.h\n"
+ "st1h { z28.h }, p2, [x19, #2, MUL VL]\n"
+ "zip2 z16.h, z21.h, z16.h\n"
+ "st1h { z27.h }, p2, [x19, #3, MUL VL]\n"
+ "st1h { z30.h }, p2, [x19, #4, MUL VL]\n"
+ "st1h { z29.h }, p2, [x19, #5, MUL VL]\n"
+ "st1h { z26.h }, p2, [x19, #6, MUL VL]\n"
+ "st1h { z25.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "st1h { z24.h }, p2, [x19, #-8, MUL VL]\n"
+ "st1h { z23.h }, p2, [x19, #-7, MUL VL]\n"
+ "st1h { z22.h }, p2, [x19, #-6, MUL VL]\n"
+ "st1h { z20.h }, p2, [x19, #-5, MUL VL]\n"
+ "st1h { z19.h }, p2, [x19, #-4, MUL VL]\n"
+ "st1h { z18.h }, p2, [x19, #-3, MUL VL]\n"
+ "st1h { z17.h }, p2, [x19, #-2, MUL VL]\n"
+ "st1h { z16.h }, p2, [x19, #-1, MUL VL]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #16\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x11, %x[in]\n"
+ "mov x10, %x[out]\n"
+ "add x9, x11, %x[in_stride]\n"
+ "add %x[in], x9, %x[in_stride]\n"
+ "cmp %x[height], #0x1\n"
+ "csel x9, x9, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x2\n"
+ "mov x20, %x[width]\n"
+ "cnth x19, ALL, MUL #4\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1h { z18.h }, p2/Z, [x11]\n"
+ "sub x20, x20, x19\n"
+ "ld1h { z24.h }, p2/Z, [x11, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1h { z23.h }, p2/Z, [x11, #2, MUL VL]\n"
+ "ld1h { z22.h }, p2/Z, [x11, #3, MUL VL]\n"
+ "addvl x11, x11, #4\n"
+ "ld1h { z16.h }, p2/Z, [x9]\n"
+ "zip1 z21.h, z18.h, z16.h\n"
+ "ld1h { z17.h }, p2/Z, [x9, #1, MUL VL]\n"
+ "zip2 z16.h, z18.h, z16.h\n"
+ "ld1h { z20.h }, p2/Z, [x9, #2, MUL VL]\n"
+ "ld1h { z19.h }, p2/Z, [x9, #3, MUL VL]\n"
+ "zip1 z18.h, z24.h, z17.h\n"
+ "st1h { z21.h }, p2, [x10]\n"
+ "addvl x9, x9, #4\n"
+ "zip2 z17.h, z24.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #1, MUL VL]\n"
+ "zip1 z16.h, z23.h, z20.h\n"
+ "st1h { z18.h }, p2, [x10, #2, MUL VL]\n"
+ "zip2 z18.h, z23.h, z20.h\n"
+ "st1h { z17.h }, p2, [x10, #3, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip1 z17.h, z22.h, z19.h\n"
+ "st1h { z16.h }, p2, [x10]\n"
+ "zip2 z16.h, z22.h, z19.h\n"
+ "st1h { z18.h }, p2, [x10, #1, MUL VL]\n"
+ "st1h { z17.h }, p2, [x10, #2, MUL VL]\n"
+ "st1h { z16.h }, p2, [x10, #3, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "decw x20, ALL, MUL #4\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x11]\n"
+ "ld1h { z16.h }, p0/Z, [x9]\n"
+ "zip1 z20.h, z17.h, z16.h\n"
+ "dech x19\n"
+ "zip2 z19.h, z17.h, z16.h\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z18.h }, p0/Z, [x11, #1, MUL VL]\n"
+ "addvl x11, x11, #2\n"
+ "ld1h { z16.h }, p0/Z, [x9, #1, MUL VL]\n"
+ "zip1 z17.h, z18.h, z16.h\n"
+ "st1h { z20.h }, p2, [x10]\n"
+ "addvl x9, x9, #2\n"
+ "zip2 z16.h, z18.h, z16.h\n"
+ "st1h { z19.h }, p2, [x10, #1, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "st1h { z17.h }, p2, [x10, #2, MUL VL]\n"
+ "st1h { z16.h }, p2, [x10, #3, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #4\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "x9", "x10", "x11", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<4, 2, true, VLType::SVE>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_4VL_2x2(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_1x8.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_1x8.hpp
new file mode 100644
index 0000000000..67ef738645
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_1x8.hpp
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_6VL_1x8(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 8) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 6 * roundup<size_t>(height, 8) * get_vector_length<uint64_t>();
+
+ __asm__ __volatile__(
+ "ptrue p1.b\n"
+ "1:" // Main row loop: Head
+ "mov x9, %x[in]\n"
+ "mov x28, %x[out]\n"
+ "add x27, x9, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "cmp %x[height], #0x7\n"
+ "csel x21, x21, %x[pad_row], GT\n"
+ "csel x22, x22, %x[pad_row], GE\n"
+ "cmp %x[height], #0x5\n"
+ "csel x23, x23, %x[pad_row], GT\n"
+ "csel x24, x24, %x[pad_row], GE\n"
+ "cmp %x[height], #0x3\n"
+ "csel x25, x25, %x[pad_row], GT\n"
+ "csel x26, x26, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x27, x27, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #3\n"
+ "cmp x20, x19\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1b { z22.b }, p1/Z, [x9]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z21.b }, p1/Z, [x9, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1b { z12.b }, p1/Z, [x9, #2, MUL VL]\n"
+ "addvl x9, x9, #3\n"
+ "ld1b { z20.b }, p1/Z, [x27]\n"
+ "ld1b { z11.b }, p1/Z, [x27, #1, MUL VL]\n"
+ "ld1b { z10.b }, p1/Z, [x27, #2, MUL VL]\n"
+ "addvl x27, x27, #3\n"
+ "ld1b { z19.b }, p1/Z, [x26]\n"
+ "ld1b { z9.b }, p1/Z, [x26, #1, MUL VL]\n"
+ "ld1b { z8.b }, p1/Z, [x26, #2, MUL VL]\n"
+ "addvl x26, x26, #3\n"
+ "ld1b { z7.b }, p1/Z, [x25]\n"
+ "ld1b { z6.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "ld1b { z5.b }, p1/Z, [x25, #2, MUL VL]\n"
+ "addvl x25, x25, #3\n"
+ "ld1b { z16.b }, p1/Z, [x24]\n"
+ "zip1 z18.b, z22.b, z16.b\n"
+ "ld1b { z17.b }, p1/Z, [x24, #1, MUL VL]\n"
+ "zip2 z4.b, z22.b, z16.b\n"
+ "ld1b { z3.b }, p1/Z, [x24, #2, MUL VL]\n"
+ "addvl x24, x24, #3\n"
+ "zip1 z2.b, z21.b, z17.b\n"
+ "ld1b { z16.b }, p1/Z, [x23]\n"
+ "zip2 z1.b, z21.b, z17.b\n"
+ "ld1b { z0.b }, p1/Z, [x23, #1, MUL VL]\n"
+ "zip1 z31.b, z12.b, z3.b\n"
+ "ld1b { z30.b }, p1/Z, [x23, #2, MUL VL]\n"
+ "addvl x23, x23, #3\n"
+ "zip1 z29.b, z20.b, z16.b\n"
+ "ld1b { z17.b }, p1/Z, [x22]\n"
+ "zip2 z28.b, z20.b, z16.b\n"
+ "ld1b { z27.b }, p1/Z, [x22, #1, MUL VL]\n"
+ "zip1 z26.b, z11.b, z0.b\n"
+ "ld1b { z25.b }, p1/Z, [x22, #2, MUL VL]\n"
+ "addvl x22, x22, #3\n"
+ "zip1 z16.b, z19.b, z17.b\n"
+ "ld1b { z24.b }, p1/Z, [x21]\n"
+ "zip2 z21.b, z19.b, z17.b\n"
+ "ld1b { z22.b }, p1/Z, [x21, #1, MUL VL]\n"
+ "zip1 z20.b, z18.b, z16.b\n"
+ "ld1b { z23.b }, p1/Z, [x21, #2, MUL VL]\n"
+ "addvl x21, x21, #3\n"
+ "zip1 z19.b, z7.b, z24.b\n"
+ "zip2 z18.b, z18.b, z16.b\n"
+ "zip1 z17.b, z29.b, z19.b\n"
+ "zip1 z16.b, z20.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z20.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z17.b, z29.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z18.b, z4.b, z21.b\n"
+ "zip2 z19.b, z7.b, z24.b\n"
+ "zip1 z17.b, z28.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z18.b, z4.b, z21.b\n"
+ "zip2 z17.b, z28.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip1 z20.b, z9.b, z27.b\n"
+ "zip1 z18.b, z2.b, z20.b\n"
+ "zip1 z19.b, z6.b, z22.b\n"
+ "zip1 z17.b, z26.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip2 z18.b, z2.b, z20.b\n"
+ "zip2 z17.b, z26.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z21.b, z9.b, z27.b\n"
+ "zip2 z20.b, z11.b, z0.b\n"
+ "zip1 z18.b, z1.b, z21.b\n"
+ "zip2 z19.b, z6.b, z22.b\n"
+ "zip1 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z18.b, z1.b, z21.b\n"
+ "zip2 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z21.b, z8.b, z25.b\n"
+ "zip1 z18.b, z31.b, z21.b\n"
+ "zip1 z20.b, z10.b, z30.b\n"
+ "zip1 z19.b, z5.b, z23.b\n"
+ "zip1 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip2 z18.b, z31.b, z21.b\n"
+ "zip2 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z22.b, z12.b, z3.b\n"
+ "zip2 z21.b, z8.b, z25.b\n"
+ "zip1 z18.b, z22.b, z21.b\n"
+ "zip2 z20.b, z10.b, z30.b\n"
+ "zip2 z19.b, z5.b, z23.b\n"
+ "zip1 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip2 z18.b, z22.b, z21.b\n"
+ "zip2 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x20, 5f\n"
+ "4:" // Main row loop: Column loop
+ "whilelt p0.b, XZR, x20\n"
+ "ld1b { z18.b }, p0/Z, [x9]\n"
+ "incd x9, ALL, MUL #6\n"
+ "ld1b { z28.b }, p0/Z, [x27]\n"
+ "incd x27, ALL, MUL #6\n"
+ "ld1b { z17.b }, p0/Z, [x26]\n"
+ "incd x26, ALL, MUL #6\n"
+ "ld1b { z27.b }, p0/Z, [x25]\n"
+ "incd x25, ALL, MUL #6\n"
+ "ld1b { z16.b }, p0/Z, [x24]\n"
+ "zip1 z26.b, z18.b, z16.b\n"
+ "ld1b { z25.b }, p0/Z, [x23]\n"
+ "incd x24, ALL, MUL #6\n"
+ "zip2 z24.b, z18.b, z16.b\n"
+ "ld1b { z16.b }, p0/Z, [x22]\n"
+ "incd x23, ALL, MUL #6\n"
+ "zip1 z23.b, z28.b, z25.b\n"
+ "ld1b { z22.b }, p0/Z, [x21]\n"
+ "incd x22, ALL, MUL #6\n"
+ "zip1 z21.b, z17.b, z16.b\n"
+ "incd x21, ALL, MUL #6\n"
+ "zip2 z20.b, z17.b, z16.b\n"
+ "decd x20, ALL, MUL #6\n"
+ "zip1 z18.b, z26.b, z21.b\n"
+ "cmp x20, #0x0\n"
+ "zip1 z19.b, z27.b, z22.b\n"
+ "zip1 z17.b, z23.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z18.b, z26.b, z21.b\n"
+ "zip2 z17.b, z23.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z18.b, z24.b, z20.b\n"
+ "zip2 z17.b, z28.b, z25.b\n"
+ "zip2 z16.b, z27.b, z22.b\n"
+ "zip1 z17.b, z17.b, z16.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #6\n"
+ "cmp %x[height], #0x1\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "x9", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<6, 8, true, VLType::SVE>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_6VL_1x8(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<6, 8, true, VLType::SVE>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_6VL_1x8(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_2x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_2x4.hpp
new file mode 100644
index 0000000000..19d3d9dfe4
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_2x4.hpp
@@ -0,0 +1,411 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_6VL_2x4(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 6 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p2.b\n"
+ "cmp %x[height], #0x8\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x11, %x[in]\n"
+ "mov x10, %x[out]\n"
+ "add x9, x11, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add %x[in], x23, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x22, %x[width]\n"
+ "cnth x21, ALL, MUL #3\n"
+ "cmp x22, x21\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1h { z19.h }, p2/Z, [x11]\n"
+ "mov x20, x10\n"
+ "ld1h { z18.h }, p2/Z, [x11, #1, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "ld1h { z10.h }, p2/Z, [x11, #2, MUL VL]\n"
+ "addvl x11, x11, #3\n"
+ "ld1h { z24.h }, p2/Z, [x9]\n"
+ "mov x19, x10\n"
+ "ld1h { z23.h }, p2/Z, [x9, #1, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "ld1h { z9.h }, p2/Z, [x9, #2, MUL VL]\n"
+ "addvl x9, x9, #3\n"
+ "ld1h { z16.h }, p2/Z, [x28]\n"
+ "zip1 z22.h, z19.h, z16.h\n"
+ "ld1h { z17.h }, p2/Z, [x28, #1, MUL VL]\n"
+ "sub x22, x22, x21\n"
+ "zip2 z21.h, z19.h, z16.h\n"
+ "ld1h { z8.h }, p2/Z, [x28, #2, MUL VL]\n"
+ "addvl x28, x28, #3\n"
+ "zip1 z20.h, z18.h, z17.h\n"
+ "ld1h { z16.h }, p2/Z, [x27]\n"
+ "cmp x22, x21\n"
+ "zip2 z7.h, z18.h, z17.h\n"
+ "ld1h { z19.h }, p2/Z, [x27, #1, MUL VL]\n"
+ "zip1 z6.h, z10.h, z8.h\n"
+ "ld1h { z5.h }, p2/Z, [x27, #2, MUL VL]\n"
+ "addvl x27, x27, #3\n"
+ "zip1 z17.h, z24.h, z16.h\n"
+ "ld1h { z18.h }, p2/Z, [x26]\n"
+ "zip2 z16.h, z24.h, z16.h\n"
+ "ld1h { z4.h }, p2/Z, [x26, #1, MUL VL]\n"
+ "zip1 z3.h, z22.h, z17.h\n"
+ "ld1h { z2.h }, p2/Z, [x26, #2, MUL VL]\n"
+ "addvl x26, x26, #3\n"
+ "zip2 z1.h, z22.h, z17.h\n"
+ "ld1h { z0.h }, p2/Z, [x25]\n"
+ "zip1 z31.h, z21.h, z16.h\n"
+ "ld1h { z30.h }, p2/Z, [x25, #1, MUL VL]\n"
+ "zip2 z29.h, z21.h, z16.h\n"
+ "ld1h { z28.h }, p2/Z, [x25, #2, MUL VL]\n"
+ "addvl x25, x25, #3\n"
+ "zip1 z16.h, z23.h, z19.h\n"
+ "ld1h { z17.h }, p2/Z, [x24]\n"
+ "zip2 z27.h, z23.h, z19.h\n"
+ "ld1h { z26.h }, p2/Z, [x24, #1, MUL VL]\n"
+ "zip1 z25.h, z20.h, z16.h\n"
+ "ld1h { z24.h }, p2/Z, [x24, #2, MUL VL]\n"
+ "addvl x24, x24, #3\n"
+ "zip2 z23.h, z20.h, z16.h\n"
+ "ld1h { z16.h }, p2/Z, [x23]\n"
+ "zip1 z20.h, z18.h, z17.h\n"
+ "ld1h { z22.h }, p2/Z, [x23, #1, MUL VL]\n"
+ "zip2 z19.h, z18.h, z17.h\n"
+ "ld1h { z21.h }, p2/Z, [x23, #2, MUL VL]\n"
+ "addvl x23, x23, #3\n"
+ "zip1 z18.h, z0.h, z16.h\n"
+ "st1h { z3.h }, p2, [x20]\n"
+ "zip2 z17.h, z0.h, z16.h\n"
+ "st1h { z1.h }, p2, [x20, #1, MUL VL]\n"
+ "zip1 z16.h, z20.h, z18.h\n"
+ "st1h { z31.h }, p2, [x20, #2, MUL VL]\n"
+ "zip2 z18.h, z20.h, z18.h\n"
+ "st1h { z29.h }, p2, [x20, #3, MUL VL]\n"
+ "zip1 z20.h, z19.h, z17.h\n"
+ "st1h { z25.h }, p2, [x20, #4, MUL VL]\n"
+ "zip2 z19.h, z19.h, z17.h\n"
+ "st1h { z23.h }, p2, [x20, #5, MUL VL]\n"
+ "zip1 z17.h, z4.h, z26.h\n"
+ "st1h { z16.h }, p2, [x20, #6, MUL VL]\n"
+ "zip1 z16.h, z30.h, z22.h\n"
+ "st1h { z18.h }, p2, [x20, #7, MUL VL]\n"
+ "addvl x20, x20, #12\n"
+ "zip1 z18.h, z17.h, z16.h\n"
+ "st1h { z20.h }, p2, [x20, #-4, MUL VL]\n"
+ "zip2 z16.h, z17.h, z16.h\n"
+ "st1h { z19.h }, p2, [x20, #-3, MUL VL]\n"
+ "zip1 z17.h, z7.h, z27.h\n"
+ "st1h { z18.h }, p2, [x20, #-2, MUL VL]\n"
+ "zip2 z18.h, z7.h, z27.h\n"
+ "st1h { z16.h }, p2, [x20, #-1, MUL VL]\n"
+ "zip1 z16.h, z9.h, z5.h\n"
+ "st1h { z17.h }, p2, [x19]\n"
+ "zip1 z17.h, z6.h, z16.h\n"
+ "st1h { z18.h }, p2, [x19, #1, MUL VL]\n"
+ "zip2 z16.h, z6.h, z16.h\n"
+ "st1h { z17.h }, p2, [x19, #2, MUL VL]\n"
+ "zip2 z18.h, z10.h, z8.h\n"
+ "st1h { z16.h }, p2, [x19, #3, MUL VL]\n"
+ "zip2 z17.h, z9.h, z5.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #4, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #5, MUL VL]\n"
+ "zip2 z18.h, z4.h, z26.h\n"
+ "zip2 z17.h, z30.h, z22.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #6, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ "zip1 z18.h, z2.h, z24.h\n"
+ "zip1 z17.h, z28.h, z21.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-4, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-3, MUL VL]\n"
+ "zip2 z18.h, z2.h, z24.h\n"
+ "zip2 z17.h, z28.h, z21.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-2, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-1, MUL VL]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x20, x22\n"
+ "mov x19, x10\n"
+ "whilelt p1.h, XZR, x20\n"
+ "ld1h { z18.h }, p1/Z, [x11]\n"
+ "ld1h { z23.h }, p1/Z, [x9]\n"
+ "dech x20\n"
+ "ld1h { z16.h }, p1/Z, [x28]\n"
+ "zip1 z17.h, z18.h, z16.h\n"
+ "ld1h { z20.h }, p1/Z, [x27]\n"
+ "whilelt p0.h, XZR, x20\n"
+ "zip2 z22.h, z18.h, z16.h\n"
+ "ld1h { z21.h }, p0/Z, [x11, #1, MUL VL]\n"
+ "addvl x11, x11, #1\n"
+ "zip1 z16.h, z23.h, z20.h\n"
+ "ld1h { z19.h }, p0/Z, [x9, #1, MUL VL]\n"
+ "incd x11, ALL, MUL #4\n"
+ "zip1 z0.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p0/Z, [x28, #1, MUL VL]\n"
+ "addvl x9, x9, #1\n"
+ "zip2 z31.h, z17.h, z16.h\n"
+ "ld1h { z17.h }, p0/Z, [x27, #1, MUL VL]\n"
+ "incd x9, ALL, MUL #4\n"
+ "zip2 z16.h, z23.h, z20.h\n"
+ "ld1h { z30.h }, p1/Z, [x26]\n"
+ "addvl x28, x28, #1\n"
+ "zip1 z20.h, z22.h, z16.h\n"
+ "ld1h { z29.h }, p0/Z, [x26, #1, MUL VL]\n"
+ "incd x28, ALL, MUL #4\n"
+ "zip2 z28.h, z22.h, z16.h\n"
+ "ld1h { z27.h }, p1/Z, [x25]\n"
+ "addvl x27, x27, #1\n"
+ "zip1 z18.h, z21.h, z18.h\n"
+ "ld1h { z26.h }, p0/Z, [x25, #1, MUL VL]\n"
+ "incd x27, ALL, MUL #4\n"
+ "zip1 z17.h, z19.h, z17.h\n"
+ "ld1h { z16.h }, p1/Z, [x24]\n"
+ "addvl x26, x26, #1\n"
+ "zip1 z25.h, z18.h, z17.h\n"
+ "ld1h { z24.h }, p0/Z, [x24, #1, MUL VL]\n"
+ "incd x26, ALL, MUL #4\n"
+ "zip2 z23.h, z18.h, z17.h\n"
+ "ld1h { z22.h }, p1/Z, [x23]\n"
+ "addvl x25, x25, #1\n"
+ "zip1 z19.h, z30.h, z16.h\n"
+ "ld1h { z21.h }, p0/Z, [x23, #1, MUL VL]\n"
+ "incd x25, ALL, MUL #4\n"
+ "zip2 z17.h, z30.h, z16.h\n"
+ "st1h { z0.h }, p2, [x19]\n"
+ "addvl x24, x24, #1\n"
+ "zip1 z16.h, z27.h, z22.h\n"
+ "st1h { z31.h }, p2, [x19, #1, MUL VL]\n"
+ "incd x24, ALL, MUL #4\n"
+ "zip1 z18.h, z19.h, z16.h\n"
+ "st1h { z20.h }, p2, [x19, #2, MUL VL]\n"
+ "addvl x23, x23, #1\n"
+ "zip2 z20.h, z19.h, z16.h\n"
+ "st1h { z28.h }, p2, [x19, #3, MUL VL]\n"
+ "incd x23, ALL, MUL #4\n"
+ "zip2 z16.h, z27.h, z22.h\n"
+ "st1h { z25.h }, p2, [x19, #4, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip1 z19.h, z17.h, z16.h\n"
+ "st1h { z23.h }, p2, [x19, #5, MUL VL]\n"
+ "decd x22, ALL, MUL #6\n"
+ "zip2 z17.h, z17.h, z16.h\n"
+ "st1h { z18.h }, p2, [x19, #6, MUL VL]\n"
+ "cmp x22, #0x0\n"
+ "zip1 z18.h, z29.h, z24.h\n"
+ "st1h { z20.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ "zip1 z16.h, z26.h, z21.h\n"
+ "st1h { z19.h }, p2, [x19, #-4, MUL VL]\n"
+ "st1h { z17.h }, p2, [x19, #-3, MUL VL]\n"
+ "zip1 z17.h, z18.h, z16.h\n"
+ "zip2 z16.h, z18.h, z16.h\n"
+ "st1h { z17.h }, p2, [x19, #-2, MUL VL]\n"
+ "st1h { z16.h }, p2, [x19, #-1, MUL VL]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #12\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x11, %x[in]\n"
+ "mov x10, %x[out]\n"
+ "add x9, x11, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add %x[in], x27, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x27, x27, %x[pad_row], GT\n"
+ "csel x28, x28, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x9, x9, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x20, %x[width]\n"
+ "cnth x19, ALL, MUL #3\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1h { z19.h }, p2/Z, [x11]\n"
+ "sub x20, x20, x19\n"
+ "ld1h { z18.h }, p2/Z, [x11, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1h { z30.h }, p2/Z, [x11, #2, MUL VL]\n"
+ "addvl x11, x11, #3\n"
+ "ld1h { z29.h }, p2/Z, [x9]\n"
+ "ld1h { z28.h }, p2/Z, [x9, #1, MUL VL]\n"
+ "ld1h { z27.h }, p2/Z, [x9, #2, MUL VL]\n"
+ "addvl x9, x9, #3\n"
+ "ld1h { z16.h }, p2/Z, [x28]\n"
+ "zip1 z26.h, z19.h, z16.h\n"
+ "ld1h { z17.h }, p2/Z, [x28, #1, MUL VL]\n"
+ "zip2 z25.h, z19.h, z16.h\n"
+ "ld1h { z24.h }, p2/Z, [x28, #2, MUL VL]\n"
+ "addvl x28, x28, #3\n"
+ "zip1 z23.h, z18.h, z17.h\n"
+ "ld1h { z16.h }, p2/Z, [x27]\n"
+ "zip2 z22.h, z18.h, z17.h\n"
+ "ld1h { z21.h }, p2/Z, [x27, #1, MUL VL]\n"
+ "zip1 z20.h, z30.h, z24.h\n"
+ "ld1h { z19.h }, p2/Z, [x27, #2, MUL VL]\n"
+ "addvl x27, x27, #3\n"
+ "zip1 z18.h, z29.h, z16.h\n"
+ "zip2 z17.h, z29.h, z16.h\n"
+ "zip1 z16.h, z26.h, z18.h\n"
+ "st1h { z16.h }, p2, [x10]\n"
+ "zip2 z16.h, z26.h, z18.h\n"
+ "st1h { z16.h }, p2, [x10, #1, MUL VL]\n"
+ "zip1 z16.h, z25.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #2, MUL VL]\n"
+ "zip2 z16.h, z25.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #3, MUL VL]\n"
+ "zip1 z17.h, z28.h, z21.h\n"
+ "zip1 z16.h, z23.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #4, MUL VL]\n"
+ "zip2 z16.h, z23.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #5, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip2 z18.h, z28.h, z21.h\n"
+ "zip1 z17.h, z27.h, z19.h\n"
+ "zip1 z16.h, z22.h, z18.h\n"
+ "st1h { z16.h }, p2, [x10]\n"
+ "zip2 z16.h, z22.h, z18.h\n"
+ "st1h { z16.h }, p2, [x10, #1, MUL VL]\n"
+ "zip1 z16.h, z20.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #2, MUL VL]\n"
+ "zip2 z16.h, z20.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #3, MUL VL]\n"
+ "zip2 z18.h, z30.h, z24.h\n"
+ "zip2 z17.h, z27.h, z19.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #4, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #5, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "decd x20, ALL, MUL #6\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x11]\n"
+ "ld1h { z25.h }, p0/Z, [x9]\n"
+ "dech x19\n"
+ "ld1h { z16.h }, p0/Z, [x28]\n"
+ "zip1 z18.h, z17.h, z16.h\n"
+ "ld1h { z24.h }, p0/Z, [x27]\n"
+ "whilelt p0.h, XZR, x19\n"
+ "zip2 z23.h, z17.h, z16.h\n"
+ "ld1h { z22.h }, p0/Z, [x11, #1, MUL VL]\n"
+ "addvl x11, x11, #1\n"
+ "zip1 z16.h, z25.h, z24.h\n"
+ "ld1h { z21.h }, p0/Z, [x9, #1, MUL VL]\n"
+ "incd x11, ALL, MUL #4\n"
+ "zip1 z17.h, z18.h, z16.h\n"
+ "ld1h { z20.h }, p0/Z, [x28, #1, MUL VL]\n"
+ "addvl x9, x9, #1\n"
+ "zip2 z18.h, z18.h, z16.h\n"
+ "ld1h { z19.h }, p0/Z, [x27, #1, MUL VL]\n"
+ "incd x9, ALL, MUL #4\n"
+ "zip2 z16.h, z25.h, z24.h\n"
+ "st1h { z17.h }, p2, [x10]\n"
+ "addvl x28, x28, #1\n"
+ "zip1 z17.h, z23.h, z16.h\n"
+ "st1h { z18.h }, p2, [x10, #1, MUL VL]\n"
+ "incd x28, ALL, MUL #4\n"
+ "zip2 z16.h, z23.h, z16.h\n"
+ "st1h { z17.h }, p2, [x10, #2, MUL VL]\n"
+ "addvl x27, x27, #1\n"
+ "zip1 z18.h, z22.h, z20.h\n"
+ "st1h { z16.h }, p2, [x10, #3, MUL VL]\n"
+ "incd x27, ALL, MUL #4\n"
+ "zip1 z17.h, z21.h, z19.h\n"
+ "cmp x20, #0x0\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #4, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #5, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #6\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "x9", "x10", "x11", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<6, 4, true, VLType::SVE>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_6VL_2x4(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_2x4_fp32bf16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_2x4_fp32bf16.hpp
new file mode 100644
index 0000000000..94ce157185
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_2x4_fp32bf16.hpp
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_6VL_2x4_fp32bf16(bfloat16 *out, const float *in, size_t width, size_t in_stride, size_t height)
+{
+ float *pad_row = reinterpret_cast<float *>(alloca(width * sizeof(float)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(float));
+ }
+
+ size_t out_stride = 6 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p3.b\n"
+ "1:" // Main row loop: Head
+ "mov x25, %x[in]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "mov x22, %x[width]\n"
+ "cnth x19, ALL, MUL #3\n"
+ "add x21, x23, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "csel x21, x21, %x[pad_row], GT\n"
+ "csel x23, x23, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "cmp x22, x19\n"
+ "mov x20, %x[out]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1w { z17.s }, p3/Z, [x25]\n"
+ "ld1w { z18.s }, p3/Z, [x25, #1, MUL VL]\n"
+ "sub x22, x22, x19\n"
+ "cmp x22, x19\n"
+ "ld1w { z19.s }, p3/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z16.s }, p3/Z, [x23]\n"
+ "zip1 z21.s, z17.s, z16.s\n"
+ "zip2 z20.s, z17.s, z16.s\n"
+ "ld1w { z17.s }, p3/Z, [x23, #1, MUL VL]\n"
+ "ld1w { z16.s }, p3/Z, [x23, #2, MUL VL]\n"
+ "zip1 z29.s, z18.s, z17.s\n"
+ "zip2 z28.s, z18.s, z17.s\n"
+ "ld1w { z17.s }, p3/Z, [x25, #3, MUL VL]\n"
+ "ld1w { z18.s }, p3/Z, [x25, #4, MUL VL]\n"
+ "zip1 z27.s, z19.s, z16.s\n"
+ "zip2 z26.s, z19.s, z16.s\n"
+ "ld1w { z19.s }, p3/Z, [x25, #5, MUL VL]\n"
+ "ld1w { z16.s }, p3/Z, [x23, #3, MUL VL]\n"
+ "zip1 z25.s, z17.s, z16.s\n"
+ "zip2 z24.s, z17.s, z16.s\n"
+ "ld1w { z17.s }, p3/Z, [x23, #4, MUL VL]\n"
+ "ld1w { z16.s }, p3/Z, [x23, #5, MUL VL]\n"
+ "zip1 z12.s, z18.s, z17.s\n"
+ "zip2 z11.s, z18.s, z17.s\n"
+ "ld1w { z18.s }, p3/Z, [x24]\n"
+ "ld1w { z23.s }, p3/Z, [x24, #1, MUL VL]\n"
+ "zip1 z10.s, z19.s, z16.s\n"
+ "zip2 z9.s, z19.s, z16.s\n"
+ "ld1w { z22.s }, p3/Z, [x24, #2, MUL VL]\n"
+ "ld1w { z17.s }, p3/Z, [x21]\n"
+ ".inst 0x658aaea8 // bfcvt z8.h, p3/M, z21.s\n"
+ "zip1 z7.s, z18.s, z17.s\n"
+ "ld1w { z16.s }, p3/Z, [x21, #1, MUL VL]\n"
+ "ld1w { z21.s }, p3/Z, [x21, #2, MUL VL]\n"
+ ".inst 0x658aae86 // bfcvt z6.h, p3/M, z20.s\n"
+ "zip2 z5.s, z18.s, z17.s\n"
+ "ld1w { z20.s }, p3/Z, [x24, #3, MUL VL]\n"
+ "ld1w { z19.s }, p3/Z, [x24, #4, MUL VL]\n"
+ ".inst 0x658aafa4 // bfcvt z4.h, p3/M, z29.s\n"
+ "zip1 z3.s, z23.s, z16.s\n"
+ "ld1w { z2.s }, p3/Z, [x24, #5, MUL VL]\n"
+ "ld1w { z18.s }, p3/Z, [x21, #3, MUL VL]\n"
+ ".inst 0x658aaf81 // bfcvt z1.h, p3/M, z28.s\n"
+ "zip2 z0.s, z23.s, z16.s\n"
+ "ld1w { z17.s }, p3/Z, [x21, #4, MUL VL]\n"
+ "ld1w { z16.s }, p3/Z, [x21, #5, MUL VL]\n"
+ ".inst 0x658aaf7f // bfcvt z31.h, p3/M, z27.s\n"
+ "zip1 z30.s, z22.s, z21.s\n"
+ ".inst 0x658aaf5d // bfcvt z29.h, p3/M, z26.s\n"
+ "zip2 z28.s, z22.s, z21.s\n"
+ "addvl x25, x25, #6\n"
+ "addvl x24, x24, #6\n"
+ ".inst 0x658aaf3b // bfcvt z27.h, p3/M, z25.s\n"
+ "zip1 z26.s, z20.s, z18.s\n"
+ "addvl x23, x23, #6\n"
+ "addvl x21, x21, #6\n"
+ ".inst 0x658aaf19 // bfcvt z25.h, p3/M, z24.s\n"
+ "zip2 z24.s, z20.s, z18.s\n"
+ ".inst 0x658aad97 // bfcvt z23.h, p3/M, z12.s\n"
+ "zip1 z22.s, z19.s, z17.s\n"
+ ".inst 0x658aad75 // bfcvt z21.h, p3/M, z11.s\n"
+ "zip2 z20.s, z19.s, z17.s\n"
+ ".inst 0x658aad53 // bfcvt z19.h, p3/M, z10.s\n"
+ "zip1 z18.s, z2.s, z16.s\n"
+ ".inst 0x658aad31 // bfcvt z17.h, p3/M, z9.s\n"
+ "zip2 z16.s, z2.s, z16.s\n"
+ ".inst 0x648aace8 // bfcvtnt z8.h, p3/M, z7.s\n"
+ ".inst 0x648aaca6 // bfcvtnt z6.h, p3/M, z5.s\n"
+ "st1h { z8.h }, p3, [x20]\n"
+ ".inst 0x648aac64 // bfcvtnt z4.h, p3/M, z3.s\n"
+ ".inst 0x648aac01 // bfcvtnt z1.h, p3/M, z0.s\n"
+ "st1h { z6.h }, p3, [x20, #1, MUL VL]\n"
+ ".inst 0x648aafdf // bfcvtnt z31.h, p3/M, z30.s\n"
+ ".inst 0x648aaf9d // bfcvtnt z29.h, p3/M, z28.s\n"
+ "st1h { z4.h }, p3, [x20, #2, MUL VL]\n"
+ "st1h { z1.h }, p3, [x20, #3, MUL VL]\n"
+ ".inst 0x648aaf5b // bfcvtnt z27.h, p3/M, z26.s\n"
+ ".inst 0x648aaf19 // bfcvtnt z25.h, p3/M, z24.s\n"
+ "st1h { z31.h }, p3, [x20, #4, MUL VL]\n"
+ ".inst 0x648aaed7 // bfcvtnt z23.h, p3/M, z22.s\n"
+ ".inst 0x648aae95 // bfcvtnt z21.h, p3/M, z20.s\n"
+ "st1h { z29.h }, p3, [x20, #5, MUL VL]\n"
+ "add x20, x20, %x[out_stride]\n"
+ ".inst 0x648aae53 // bfcvtnt z19.h, p3/M, z18.s\n"
+ ".inst 0x648aae11 // bfcvtnt z17.h, p3/M, z16.s\n"
+ "st1h { z27.h }, p3, [x20]\n"
+ "st1h { z25.h }, p3, [x20, #1, MUL VL]\n"
+ "st1h { z23.h }, p3, [x20, #2, MUL VL]\n"
+ "st1h { z21.h }, p3, [x20, #3, MUL VL]\n"
+ "st1h { z19.h }, p3, [x20, #4, MUL VL]\n"
+ "st1h { z17.h }, p3, [x20, #5, MUL VL]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x19, x22\n"
+ "whilelt p2.s, XZR, x19\n"
+ "ld1w { z20.s }, p2/Z, [x25]\n"
+ "ld1w { z19.s }, p2/Z, [x23]\n"
+ "decw x19\n"
+ "whilelt p1.s, XZR, x19\n"
+ "ld1w { z18.s }, p1/Z, [x25, #1, MUL VL]\n"
+ "ld1w { z17.s }, p1/Z, [x23, #1, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z25.s }, p0/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z16.s }, p0/Z, [x23, #2, MUL VL]\n"
+ "ld1w { z24.s }, p2/Z, [x24]\n"
+ "ld1w { z30.s }, p1/Z, [x24, #1, MUL VL]\n"
+ "zip1 z23.s, z20.s, z19.s\n"
+ "zip2 z22.s, z20.s, z19.s\n"
+ "ld1w { z29.s }, p0/Z, [x24, #2, MUL VL]\n"
+ "ld1w { z21.s }, p2/Z, [x21]\n"
+ "zip1 z20.s, z18.s, z17.s\n"
+ "zip2 z19.s, z18.s, z17.s\n"
+ "ld1w { z18.s }, p1/Z, [x21, #1, MUL VL]\n"
+ "ld1w { z28.s }, p0/Z, [x21, #2, MUL VL]\n"
+ "zip1 z17.s, z25.s, z16.s\n"
+ "zip2 z16.s, z25.s, z16.s\n"
+ "decd x22, ALL, MUL #6\n"
+ ".inst 0x658aaefb // bfcvt z27.h, p3/M, z23.s\n"
+ "zip1 z26.s, z24.s, z21.s\n"
+ "cmp x22, #0x0\n"
+ ".inst 0x658aaed9 // bfcvt z25.h, p3/M, z22.s\n"
+ "zip2 z24.s, z24.s, z21.s\n"
+ "addvl x25, x25, #3\n"
+ "addvl x24, x24, #3\n"
+ ".inst 0x658aae97 // bfcvt z23.h, p3/M, z20.s\n"
+ "zip1 z22.s, z30.s, z18.s\n"
+ "addvl x23, x23, #3\n"
+ "addvl x21, x21, #3\n"
+ ".inst 0x658aae75 // bfcvt z21.h, p3/M, z19.s\n"
+ "zip2 z20.s, z30.s, z18.s\n"
+ ".inst 0x658aae33 // bfcvt z19.h, p3/M, z17.s\n"
+ "zip1 z18.s, z29.s, z28.s\n"
+ ".inst 0x658aae11 // bfcvt z17.h, p3/M, z16.s\n"
+ "zip2 z16.s, z29.s, z28.s\n"
+ ".inst 0x648aaf5b // bfcvtnt z27.h, p3/M, z26.s\n"
+ ".inst 0x648aaf19 // bfcvtnt z25.h, p3/M, z24.s\n"
+ "st1h { z27.h }, p3, [x20]\n"
+ ".inst 0x648aaed7 // bfcvtnt z23.h, p3/M, z22.s\n"
+ ".inst 0x648aae95 // bfcvtnt z21.h, p3/M, z20.s\n"
+ "st1h { z25.h }, p3, [x20, #1, MUL VL]\n"
+ ".inst 0x648aae53 // bfcvtnt z19.h, p3/M, z18.s\n"
+ ".inst 0x648aae11 // bfcvtnt z17.h, p3/M, z16.s\n"
+ "st1h { z23.h }, p3, [x20, #2, MUL VL]\n"
+ "st1h { z21.h }, p3, [x20, #3, MUL VL]\n"
+ "st1h { z19.h }, p3, [x20, #4, MUL VL]\n"
+ "st1h { z17.h }, p3, [x20, #5, MUL VL]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp %x[height], #0x1\n"
+ "addvl %x[out], %x[out], #6\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "p3", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<6, 4, true, VLType::SVE>(
+ bfloat16 *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_6VL_2x4_fp32bf16(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_4x2.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_4x2.hpp
new file mode 100644
index 0000000000..46b160b071
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_6VL_4x2.hpp
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_6VL_4x2(uint32_t *out, const uint32_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint32_t *pad_row = reinterpret_cast<uint32_t *>(alloca(width * sizeof(uint32_t)));
+
+ if (height % 2) {
+ memset(pad_row, 0, width * sizeof(uint32_t));
+ }
+
+ size_t out_stride = 6 * roundup<size_t>(height, 2) * get_vector_length<uint16_t>();
+
+ __asm__ __volatile__(
+ "ptrue p2.b\n"
+ "cmp %x[height], #0x4\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x27, %x[in]\n"
+ "mov x26, %x[out]\n"
+ "add x25, x27, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add %x[in], x23, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x22, %x[width]\n"
+ "cntw x21, ALL, MUL #6\n"
+ "cmp x22, x21\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1w { z19.s }, p2/Z, [x27]\n"
+ "mov x20, x26\n"
+ "ld1w { z18.s }, p2/Z, [x27, #1, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "ld1w { z21.s }, p2/Z, [x27, #2, MUL VL]\n"
+ "mov x19, x26\n"
+ "ld1w { z26.s }, p2/Z, [x27, #3, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "ld1w { z25.s }, p2/Z, [x27, #4, MUL VL]\n"
+ "sub x22, x22, x21\n"
+ "ld1w { z24.s }, p2/Z, [x27, #5, MUL VL]\n"
+ "addvl x27, x27, #6\n"
+ "ld1w { z16.s }, p2/Z, [x25]\n"
+ "zip1 z23.s, z19.s, z16.s\n"
+ "ld1w { z17.s }, p2/Z, [x25, #1, MUL VL]\n"
+ "cmp x22, x21\n"
+ "zip2 z9.s, z19.s, z16.s\n"
+ "ld1w { z20.s }, p2/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z19.s }, p2/Z, [x25, #3, MUL VL]\n"
+ "zip1 z8.s, z18.s, z17.s\n"
+ "ld1w { z16.s }, p2/Z, [x25, #4, MUL VL]\n"
+ "zip2 z7.s, z18.s, z17.s\n"
+ "ld1w { z18.s }, p2/Z, [x25, #5, MUL VL]\n"
+ "addvl x25, x25, #6\n"
+ "zip1 z6.s, z21.s, z20.s\n"
+ "ld1w { z17.s }, p2/Z, [x24]\n"
+ "zip2 z5.s, z21.s, z20.s\n"
+ "ld1w { z22.s }, p2/Z, [x24, #1, MUL VL]\n"
+ "zip1 z4.s, z26.s, z19.s\n"
+ "ld1w { z21.s }, p2/Z, [x24, #2, MUL VL]\n"
+ "zip2 z3.s, z26.s, z19.s\n"
+ "ld1w { z2.s }, p2/Z, [x24, #3, MUL VL]\n"
+ "zip1 z1.s, z25.s, z16.s\n"
+ "ld1w { z0.s }, p2/Z, [x24, #4, MUL VL]\n"
+ "zip2 z31.s, z25.s, z16.s\n"
+ "ld1w { z30.s }, p2/Z, [x24, #5, MUL VL]\n"
+ "addvl x24, x24, #6\n"
+ "zip1 z29.s, z24.s, z18.s\n"
+ "ld1w { z16.s }, p2/Z, [x23]\n"
+ "zip2 z28.s, z24.s, z18.s\n"
+ "ld1w { z20.s }, p2/Z, [x23, #1, MUL VL]\n"
+ "ld1w { z19.s }, p2/Z, [x23, #2, MUL VL]\n"
+ "zip1 z27.s, z17.s, z16.s\n"
+ "ld1w { z18.s }, p2/Z, [x23, #3, MUL VL]\n"
+ "zip2 z26.s, z17.s, z16.s\n"
+ "ld1w { z17.s }, p2/Z, [x23, #4, MUL VL]\n"
+ "zip1 z25.s, z22.s, z20.s\n"
+ "ld1w { z16.s }, p2/Z, [x23, #5, MUL VL]\n"
+ "addvl x23, x23, #6\n"
+ "zip2 z24.s, z22.s, z20.s\n"
+ "st1w { z23.s }, p2, [x20]\n"
+ "zip1 z23.s, z21.s, z19.s\n"
+ "st1w { z9.s }, p2, [x20, #1, MUL VL]\n"
+ "zip2 z22.s, z21.s, z19.s\n"
+ "st1w { z8.s }, p2, [x20, #2, MUL VL]\n"
+ "zip1 z21.s, z2.s, z18.s\n"
+ "st1w { z7.s }, p2, [x20, #3, MUL VL]\n"
+ "zip2 z20.s, z2.s, z18.s\n"
+ "st1w { z6.s }, p2, [x20, #4, MUL VL]\n"
+ "zip1 z19.s, z0.s, z17.s\n"
+ "st1w { z5.s }, p2, [x20, #5, MUL VL]\n"
+ "zip2 z18.s, z0.s, z17.s\n"
+ "st1w { z27.s }, p2, [x20, #6, MUL VL]\n"
+ "zip1 z17.s, z30.s, z16.s\n"
+ "st1w { z26.s }, p2, [x20, #7, MUL VL]\n"
+ "addvl x20, x20, #12\n"
+ "zip2 z16.s, z30.s, z16.s\n"
+ "st1w { z25.s }, p2, [x20, #-4, MUL VL]\n"
+ "st1w { z24.s }, p2, [x20, #-3, MUL VL]\n"
+ "st1w { z23.s }, p2, [x20, #-2, MUL VL]\n"
+ "st1w { z22.s }, p2, [x20, #-1, MUL VL]\n"
+ "st1w { z4.s }, p2, [x19]\n"
+ "st1w { z3.s }, p2, [x19, #1, MUL VL]\n"
+ "st1w { z1.s }, p2, [x19, #2, MUL VL]\n"
+ "st1w { z31.s }, p2, [x19, #3, MUL VL]\n"
+ "st1w { z29.s }, p2, [x19, #4, MUL VL]\n"
+ "st1w { z28.s }, p2, [x19, #5, MUL VL]\n"
+ "st1w { z21.s }, p2, [x19, #6, MUL VL]\n"
+ "st1w { z20.s }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ "st1w { z19.s }, p2, [x19, #-4, MUL VL]\n"
+ "st1w { z18.s }, p2, [x19, #-3, MUL VL]\n"
+ "st1w { z17.s }, p2, [x19, #-2, MUL VL]\n"
+ "st1w { z16.s }, p2, [x19, #-1, MUL VL]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x20, x22\n"
+ "mov x19, x26\n"
+ "whilelt p0.s, XZR, x20\n"
+ "ld1w { z18.s }, p0/Z, [x27]\n"
+ "ld1w { z16.s }, p0/Z, [x25]\n"
+ "zip1 z28.s, z18.s, z16.s\n"
+ "ld1w { z17.s }, p0/Z, [x24]\n"
+ "decw x20\n"
+ "zip2 z27.s, z18.s, z16.s\n"
+ "ld1w { z16.s }, p0/Z, [x23]\n"
+ "whilelt p1.s, XZR, x20\n"
+ "zip1 z26.s, z17.s, z16.s\n"
+ "ld1w { z18.s }, p1/Z, [x27, #1, MUL VL]\n"
+ "decw x20\n"
+ "zip2 z25.s, z17.s, z16.s\n"
+ "ld1w { z16.s }, p1/Z, [x25, #1, MUL VL]\n"
+ "whilelt p0.s, XZR, x20\n"
+ "zip1 z24.s, z18.s, z16.s\n"
+ "ld1w { z17.s }, p0/Z, [x27, #2, MUL VL]\n"
+ "addvl x27, x27, #3\n"
+ "zip2 z23.s, z18.s, z16.s\n"
+ "ld1w { z16.s }, p0/Z, [x25, #2, MUL VL]\n"
+ "addvl x25, x25, #3\n"
+ "zip1 z22.s, z17.s, z16.s\n"
+ "ld1w { z18.s }, p1/Z, [x24, #1, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "zip2 z21.s, z17.s, z16.s\n"
+ "ld1w { z20.s }, p0/Z, [x24, #2, MUL VL]\n"
+ "addvl x24, x24, #3\n"
+ "ld1w { z17.s }, p1/Z, [x23, #1, MUL VL]\n"
+ "zip1 z19.s, z18.s, z17.s\n"
+ "ld1w { z16.s }, p0/Z, [x23, #2, MUL VL]\n"
+ "addvl x23, x23, #3\n"
+ "zip2 z18.s, z18.s, z17.s\n"
+ "st1w { z28.s }, p2, [x19]\n"
+ "decd x22, ALL, MUL #6\n"
+ "zip1 z17.s, z20.s, z16.s\n"
+ "st1w { z27.s }, p2, [x19, #1, MUL VL]\n"
+ "cmp x22, #0x0\n"
+ "zip2 z16.s, z20.s, z16.s\n"
+ "st1w { z24.s }, p2, [x19, #2, MUL VL]\n"
+ "st1w { z23.s }, p2, [x19, #3, MUL VL]\n"
+ "st1w { z22.s }, p2, [x19, #4, MUL VL]\n"
+ "st1w { z21.s }, p2, [x19, #5, MUL VL]\n"
+ "st1w { z26.s }, p2, [x19, #6, MUL VL]\n"
+ "st1w { z25.s }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #12\n"
+ "st1w { z19.s }, p2, [x19, #-4, MUL VL]\n"
+ "st1w { z18.s }, p2, [x19, #-3, MUL VL]\n"
+ "st1w { z17.s }, p2, [x19, #-2, MUL VL]\n"
+ "st1w { z16.s }, p2, [x19, #-1, MUL VL]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #12\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x27, %x[in]\n"
+ "mov x26, %x[out]\n"
+ "add x25, x27, %x[in_stride]\n"
+ "add %x[in], x25, %x[in_stride]\n"
+ "cmp %x[height], #0x1\n"
+ "csel x25, x25, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x2\n"
+ "mov x20, %x[width]\n"
+ "cntw x19, ALL, MUL #6\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1w { z19.s }, p2/Z, [x27]\n"
+ "sub x20, x20, x19\n"
+ "ld1w { z18.s }, p2/Z, [x27, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1w { z29.s }, p2/Z, [x27, #2, MUL VL]\n"
+ "ld1w { z28.s }, p2/Z, [x27, #3, MUL VL]\n"
+ "ld1w { z27.s }, p2/Z, [x27, #4, MUL VL]\n"
+ "ld1w { z26.s }, p2/Z, [x27, #5, MUL VL]\n"
+ "addvl x27, x27, #6\n"
+ "ld1w { z16.s }, p2/Z, [x25]\n"
+ "zip1 z25.s, z19.s, z16.s\n"
+ "ld1w { z17.s }, p2/Z, [x25, #1, MUL VL]\n"
+ "zip2 z24.s, z19.s, z16.s\n"
+ "ld1w { z16.s }, p2/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z23.s }, p2/Z, [x25, #3, MUL VL]\n"
+ "zip1 z20.s, z18.s, z17.s\n"
+ "ld1w { z22.s }, p2/Z, [x25, #4, MUL VL]\n"
+ "zip2 z19.s, z18.s, z17.s\n"
+ "ld1w { z21.s }, p2/Z, [x25, #5, MUL VL]\n"
+ "addvl x25, x25, #6\n"
+ "zip1 z18.s, z29.s, z16.s\n"
+ "st1w { z25.s }, p2, [x26]\n"
+ "zip2 z17.s, z29.s, z16.s\n"
+ "st1w { z24.s }, p2, [x26, #1, MUL VL]\n"
+ "zip1 z16.s, z28.s, z23.s\n"
+ "st1w { z20.s }, p2, [x26, #2, MUL VL]\n"
+ "zip2 z20.s, z28.s, z23.s\n"
+ "st1w { z19.s }, p2, [x26, #3, MUL VL]\n"
+ "zip1 z19.s, z27.s, z22.s\n"
+ "st1w { z18.s }, p2, [x26, #4, MUL VL]\n"
+ "zip2 z18.s, z27.s, z22.s\n"
+ "st1w { z17.s }, p2, [x26, #5, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "zip1 z17.s, z26.s, z21.s\n"
+ "st1w { z16.s }, p2, [x26]\n"
+ "zip2 z16.s, z26.s, z21.s\n"
+ "st1w { z20.s }, p2, [x26, #1, MUL VL]\n"
+ "st1w { z19.s }, p2, [x26, #2, MUL VL]\n"
+ "st1w { z18.s }, p2, [x26, #3, MUL VL]\n"
+ "st1w { z17.s }, p2, [x26, #4, MUL VL]\n"
+ "st1w { z16.s }, p2, [x26, #5, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "decd x20, ALL, MUL #6\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z17.s }, p0/Z, [x27]\n"
+ "ld1w { z16.s }, p0/Z, [x25]\n"
+ "zip1 z22.s, z17.s, z16.s\n"
+ "decw x19\n"
+ "zip2 z21.s, z17.s, z16.s\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z17.s }, p0/Z, [x27, #1, MUL VL]\n"
+ "decw x19\n"
+ "ld1w { z16.s }, p0/Z, [x25, #1, MUL VL]\n"
+ "zip1 z20.s, z17.s, z16.s\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z19.s }, p0/Z, [x27, #2, MUL VL]\n"
+ "zip2 z18.s, z17.s, z16.s\n"
+ "addvl x27, x27, #3\n"
+ "ld1w { z16.s }, p0/Z, [x25, #2, MUL VL]\n"
+ "zip1 z17.s, z19.s, z16.s\n"
+ "st1w { z22.s }, p2, [x26]\n"
+ "addvl x25, x25, #3\n"
+ "zip2 z16.s, z19.s, z16.s\n"
+ "st1w { z21.s }, p2, [x26, #1, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "st1w { z20.s }, p2, [x26, #2, MUL VL]\n"
+ "st1w { z18.s }, p2, [x26, #3, MUL VL]\n"
+ "st1w { z17.s }, p2, [x26, #4, MUL VL]\n"
+ "st1w { z16.s }, p2, [x26, #5, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #6\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<6, 2, true, VLType::SVE>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_6VL_4x2(
+ reinterpret_cast<uint32_t *>(out),
+ reinterpret_cast<const uint32_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 4,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL.hpp
new file mode 100644
index 0000000000..56b7ed6eda
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL.hpp
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_8VL(uint32_t *out, const uint32_t *in, size_t width, size_t in_stride, size_t height)
+{
+ size_t out_stride = 8 * height * get_vector_length<uint8_t>();
+
+ __asm__ __volatile__(
+ "ptrue p1.b\n"
+ "cmp %x[height], #0x2\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x25, %x[in]\n"
+ "mov x24, %x[out]\n"
+ "add x23, x25, %x[in_stride]\n"
+ "add %x[in], x23, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x2\n"
+ "mov x22, %x[width]\n"
+ "cntw x21, ALL, MUL #16\n"
+ "cmp x22, x21\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1w { z15.s }, p1/Z, [x25]\n"
+ "mov x20, x24\n"
+ "ld1w { z14.s }, p1/Z, [x25, #1, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "ld1w { z13.s }, p1/Z, [x25, #2, MUL VL]\n"
+ "mov x19, x24\n"
+ "ld1w { z12.s }, p1/Z, [x25, #3, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "ld1w { z11.s }, p1/Z, [x25, #4, MUL VL]\n"
+ "sub x22, x22, x21\n"
+ "ld1w { z10.s }, p1/Z, [x25, #5, MUL VL]\n"
+ "cmp x22, x21\n"
+ "ld1w { z9.s }, p1/Z, [x25, #6, MUL VL]\n"
+ "ld1w { z8.s }, p1/Z, [x25, #7, MUL VL]\n"
+ "addvl x25, x25, #16\n"
+ "ld1w { z7.s }, p1/Z, [x23]\n"
+ "ld1w { z6.s }, p1/Z, [x25, #-8, MUL VL]\n"
+ "ld1w { z5.s }, p1/Z, [x25, #-7, MUL VL]\n"
+ "ld1w { z4.s }, p1/Z, [x25, #-6, MUL VL]\n"
+ "ld1w { z3.s }, p1/Z, [x25, #-5, MUL VL]\n"
+ "ld1w { z2.s }, p1/Z, [x25, #-4, MUL VL]\n"
+ "ld1w { z1.s }, p1/Z, [x25, #-3, MUL VL]\n"
+ "ld1w { z0.s }, p1/Z, [x25, #-2, MUL VL]\n"
+ "ld1w { z31.s }, p1/Z, [x25, #-1, MUL VL]\n"
+ "ld1w { z30.s }, p1/Z, [x23, #1, MUL VL]\n"
+ "ld1w { z29.s }, p1/Z, [x23, #2, MUL VL]\n"
+ "ld1w { z28.s }, p1/Z, [x23, #3, MUL VL]\n"
+ "ld1w { z27.s }, p1/Z, [x23, #4, MUL VL]\n"
+ "ld1w { z26.s }, p1/Z, [x23, #5, MUL VL]\n"
+ "ld1w { z25.s }, p1/Z, [x23, #6, MUL VL]\n"
+ "ld1w { z24.s }, p1/Z, [x23, #7, MUL VL]\n"
+ "addvl x23, x23, #16\n"
+ "ld1w { z23.s }, p1/Z, [x23, #-8, MUL VL]\n"
+ "ld1w { z22.s }, p1/Z, [x23, #-7, MUL VL]\n"
+ "ld1w { z21.s }, p1/Z, [x23, #-6, MUL VL]\n"
+ "ld1w { z20.s }, p1/Z, [x23, #-5, MUL VL]\n"
+ "ld1w { z19.s }, p1/Z, [x23, #-4, MUL VL]\n"
+ "ld1w { z18.s }, p1/Z, [x23, #-3, MUL VL]\n"
+ "ld1w { z17.s }, p1/Z, [x23, #-2, MUL VL]\n"
+ "ld1w { z16.s }, p1/Z, [x23, #-1, MUL VL]\n"
+ "st1w { z15.s }, p1, [x20]\n"
+ "st1w { z14.s }, p1, [x20, #1, MUL VL]\n"
+ "st1w { z13.s }, p1, [x20, #2, MUL VL]\n"
+ "st1w { z12.s }, p1, [x20, #3, MUL VL]\n"
+ "st1w { z11.s }, p1, [x20, #4, MUL VL]\n"
+ "st1w { z10.s }, p1, [x20, #5, MUL VL]\n"
+ "st1w { z9.s }, p1, [x20, #6, MUL VL]\n"
+ "st1w { z8.s }, p1, [x20, #7, MUL VL]\n"
+ "addvl x20, x20, #16\n"
+ "st1w { z7.s }, p1, [x20, #-8, MUL VL]\n"
+ "st1w { z30.s }, p1, [x20, #-7, MUL VL]\n"
+ "st1w { z29.s }, p1, [x20, #-6, MUL VL]\n"
+ "st1w { z28.s }, p1, [x20, #-5, MUL VL]\n"
+ "st1w { z27.s }, p1, [x20, #-4, MUL VL]\n"
+ "st1w { z26.s }, p1, [x20, #-3, MUL VL]\n"
+ "st1w { z25.s }, p1, [x20, #-2, MUL VL]\n"
+ "st1w { z24.s }, p1, [x20, #-1, MUL VL]\n"
+ "st1w { z6.s }, p1, [x19]\n"
+ "st1w { z5.s }, p1, [x19, #1, MUL VL]\n"
+ "st1w { z4.s }, p1, [x19, #2, MUL VL]\n"
+ "st1w { z3.s }, p1, [x19, #3, MUL VL]\n"
+ "st1w { z2.s }, p1, [x19, #4, MUL VL]\n"
+ "st1w { z1.s }, p1, [x19, #5, MUL VL]\n"
+ "st1w { z0.s }, p1, [x19, #6, MUL VL]\n"
+ "st1w { z31.s }, p1, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "st1w { z23.s }, p1, [x19, #-8, MUL VL]\n"
+ "st1w { z22.s }, p1, [x19, #-7, MUL VL]\n"
+ "st1w { z21.s }, p1, [x19, #-6, MUL VL]\n"
+ "st1w { z20.s }, p1, [x19, #-5, MUL VL]\n"
+ "st1w { z19.s }, p1, [x19, #-4, MUL VL]\n"
+ "st1w { z18.s }, p1, [x19, #-3, MUL VL]\n"
+ "st1w { z17.s }, p1, [x19, #-2, MUL VL]\n"
+ "st1w { z16.s }, p1, [x19, #-1, MUL VL]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x20, x22\n"
+ "mov x19, x24\n"
+ "whilelt p0.s, XZR, x20\n"
+ "ld1w { z31.s }, p0/Z, [x25]\n"
+ "ld1w { z30.s }, p0/Z, [x23]\n"
+ "decw x20\n"
+ "add x24, x24, %x[out_stride]\n"
+ "whilelt p0.s, XZR, x20\n"
+ "ld1w { z29.s }, p0/Z, [x25, #1, MUL VL]\n"
+ "ld1w { z28.s }, p0/Z, [x23, #1, MUL VL]\n"
+ "decw x20\n"
+ "decw x22, ALL, MUL #8\n"
+ "whilelt p0.s, XZR, x20\n"
+ "ld1w { z27.s }, p0/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z26.s }, p0/Z, [x23, #2, MUL VL]\n"
+ "decw x20\n"
+ "whilelt p0.s, XZR, x20\n"
+ "ld1w { z25.s }, p0/Z, [x25, #3, MUL VL]\n"
+ "decw x20\n"
+ "ld1w { z24.s }, p0/Z, [x23, #3, MUL VL]\n"
+ "whilelt p0.s, XZR, x20\n"
+ "decw x20\n"
+ "ld1w { z23.s }, p0/Z, [x25, #4, MUL VL]\n"
+ "ld1w { z22.s }, p0/Z, [x23, #4, MUL VL]\n"
+ "whilelt p0.s, XZR, x20\n"
+ "decw x20\n"
+ "ld1w { z21.s }, p0/Z, [x25, #5, MUL VL]\n"
+ "ld1w { z20.s }, p0/Z, [x23, #5, MUL VL]\n"
+ "whilelt p0.s, XZR, x20\n"
+ "decw x20\n"
+ "ld1w { z19.s }, p0/Z, [x25, #6, MUL VL]\n"
+ "ld1w { z18.s }, p0/Z, [x23, #6, MUL VL]\n"
+ "whilelt p0.s, XZR, x20\n"
+ "cmp x22, #0x0\n"
+ "ld1w { z17.s }, p0/Z, [x25, #7, MUL VL]\n"
+ "ld1w { z16.s }, p0/Z, [x23, #7, MUL VL]\n"
+ "addvl x25, x25, #8\n"
+ "st1w { z31.s }, p1, [x19]\n"
+ "addvl x23, x23, #8\n"
+ "st1w { z29.s }, p1, [x19, #1, MUL VL]\n"
+ "st1w { z27.s }, p1, [x19, #2, MUL VL]\n"
+ "st1w { z25.s }, p1, [x19, #3, MUL VL]\n"
+ "st1w { z23.s }, p1, [x19, #4, MUL VL]\n"
+ "st1w { z21.s }, p1, [x19, #5, MUL VL]\n"
+ "st1w { z19.s }, p1, [x19, #6, MUL VL]\n"
+ "st1w { z17.s }, p1, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "st1w { z30.s }, p1, [x19, #-8, MUL VL]\n"
+ "st1w { z28.s }, p1, [x19, #-7, MUL VL]\n"
+ "st1w { z26.s }, p1, [x19, #-6, MUL VL]\n"
+ "st1w { z24.s }, p1, [x19, #-5, MUL VL]\n"
+ "st1w { z22.s }, p1, [x19, #-4, MUL VL]\n"
+ "st1w { z20.s }, p1, [x19, #-3, MUL VL]\n"
+ "st1w { z18.s }, p1, [x19, #-2, MUL VL]\n"
+ "st1w { z16.s }, p1, [x19, #-1, MUL VL]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #16\n"
+ "cmp %x[height], #0x2\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x25, %x[in]\n"
+ "mov x24, %x[out]\n"
+ "add %x[in], x25, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x1\n"
+ "mov x20, %x[width]\n"
+ "cntw x19, ALL, MUL #16\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1w { z31.s }, p1/Z, [x25]\n"
+ "sub x20, x20, x19\n"
+ "ld1w { z30.s }, p1/Z, [x25, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1w { z29.s }, p1/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z28.s }, p1/Z, [x25, #3, MUL VL]\n"
+ "ld1w { z27.s }, p1/Z, [x25, #4, MUL VL]\n"
+ "ld1w { z26.s }, p1/Z, [x25, #5, MUL VL]\n"
+ "ld1w { z25.s }, p1/Z, [x25, #6, MUL VL]\n"
+ "ld1w { z24.s }, p1/Z, [x25, #7, MUL VL]\n"
+ "addvl x25, x25, #16\n"
+ "ld1w { z23.s }, p1/Z, [x25, #-8, MUL VL]\n"
+ "ld1w { z22.s }, p1/Z, [x25, #-7, MUL VL]\n"
+ "ld1w { z21.s }, p1/Z, [x25, #-6, MUL VL]\n"
+ "ld1w { z20.s }, p1/Z, [x25, #-5, MUL VL]\n"
+ "ld1w { z19.s }, p1/Z, [x25, #-4, MUL VL]\n"
+ "ld1w { z18.s }, p1/Z, [x25, #-3, MUL VL]\n"
+ "ld1w { z17.s }, p1/Z, [x25, #-2, MUL VL]\n"
+ "ld1w { z16.s }, p1/Z, [x25, #-1, MUL VL]\n"
+ "st1w { z31.s }, p1, [x24]\n"
+ "st1w { z30.s }, p1, [x24, #1, MUL VL]\n"
+ "st1w { z29.s }, p1, [x24, #2, MUL VL]\n"
+ "st1w { z28.s }, p1, [x24, #3, MUL VL]\n"
+ "st1w { z27.s }, p1, [x24, #4, MUL VL]\n"
+ "st1w { z26.s }, p1, [x24, #5, MUL VL]\n"
+ "st1w { z25.s }, p1, [x24, #6, MUL VL]\n"
+ "st1w { z24.s }, p1, [x24, #7, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "st1w { z23.s }, p1, [x24]\n"
+ "st1w { z22.s }, p1, [x24, #1, MUL VL]\n"
+ "st1w { z21.s }, p1, [x24, #2, MUL VL]\n"
+ "st1w { z20.s }, p1, [x24, #3, MUL VL]\n"
+ "st1w { z19.s }, p1, [x24, #4, MUL VL]\n"
+ "st1w { z18.s }, p1, [x24, #5, MUL VL]\n"
+ "st1w { z17.s }, p1, [x24, #6, MUL VL]\n"
+ "st1w { z16.s }, p1, [x24, #7, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "decw x20, ALL, MUL #8\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z23.s }, p0/Z, [x25]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z22.s }, p0/Z, [x25, #1, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z21.s }, p0/Z, [x25, #2, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z20.s }, p0/Z, [x25, #3, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z19.s }, p0/Z, [x25, #4, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z18.s }, p0/Z, [x25, #5, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z17.s }, p0/Z, [x25, #6, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z16.s }, p0/Z, [x25, #7, MUL VL]\n"
+ "st1w { z23.s }, p1, [x24]\n"
+ "addvl x25, x25, #8\n"
+ "st1w { z22.s }, p1, [x24, #1, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "st1w { z21.s }, p1, [x24, #2, MUL VL]\n"
+ "st1w { z20.s }, p1, [x24, #3, MUL VL]\n"
+ "st1w { z19.s }, p1, [x24, #4, MUL VL]\n"
+ "st1w { z18.s }, p1, [x24, #5, MUL VL]\n"
+ "st1w { z17.s }, p1, [x24, #6, MUL VL]\n"
+ "st1w { z16.s }, p1, [x24, #7, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #8\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<8, 1, true, VLType::SVE>(
+ float *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_8VL(
+ reinterpret_cast<uint32_t *>(out),
+ reinterpret_cast<const uint32_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(float) / 4,
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_1x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_1x4.hpp
new file mode 100644
index 0000000000..f81098b26e
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_1x4.hpp
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_8VL_1x4(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 8 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p1.b\n"
+ "1:" // Main row loop: Head
+ "mov x25, %x[in]\n"
+ "mov x24, %x[out]\n"
+ "add x23, x25, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x21, x21, %x[pad_row], GT\n"
+ "csel x22, x22, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x23, x23, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #8\n"
+ "cmp x20, x19\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1b { z8.b }, p1/Z, [x25]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z24.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1b { z27.b }, p1/Z, [x25, #2, MUL VL]\n"
+ "ld1b { z25.b }, p1/Z, [x25, #3, MUL VL]\n"
+ "ld1b { z7.b }, p1/Z, [x25, #4, MUL VL]\n"
+ "ld1b { z3.b }, p1/Z, [x25, #5, MUL VL]\n"
+ "ld1b { z14.b }, p1/Z, [x25, #6, MUL VL]\n"
+ "ld1b { z13.b }, p1/Z, [x25, #7, MUL VL]\n"
+ "addvl x25, x25, #8\n"
+ "ld1b { z16.b }, p1/Z, [x23]\n"
+ "ld1b { z12.b }, p1/Z, [x23, #1, MUL VL]\n"
+ "ld1b { z15.b }, p1/Z, [x23, #2, MUL VL]\n"
+ "ld1b { z11.b }, p1/Z, [x23, #3, MUL VL]\n"
+ "ld1b { z4.b }, p1/Z, [x23, #4, MUL VL]\n"
+ "ld1b { z5.b }, p1/Z, [x23, #5, MUL VL]\n"
+ "ld1b { z26.b }, p1/Z, [x23, #6, MUL VL]\n"
+ "ld1b { z30.b }, p1/Z, [x23, #7, MUL VL]\n"
+ "addvl x23, x23, #8\n"
+ "ld1b { z22.b }, p1/Z, [x22]\n"
+ "zip1 z21.b, z8.b, z22.b\n"
+ "ld1b { z2.b }, p1/Z, [x22, #1, MUL VL]\n"
+ "zip2 z20.b, z8.b, z22.b\n"
+ "ld1b { z18.b }, p1/Z, [x22, #2, MUL VL]\n"
+ "ld1b { z17.b }, p1/Z, [x22, #3, MUL VL]\n"
+ "zip1 z10.b, z24.b, z2.b\n"
+ "ld1b { z22.b }, p1/Z, [x22, #4, MUL VL]\n"
+ "zip2 z9.b, z24.b, z2.b\n"
+ "ld1b { z6.b }, p1/Z, [x22, #5, MUL VL]\n"
+ "zip1 z0.b, z27.b, z18.b\n"
+ "ld1b { z1.b }, p1/Z, [x22, #6, MUL VL]\n"
+ "zip2 z28.b, z27.b, z18.b\n"
+ "ld1b { z23.b }, p1/Z, [x22, #7, MUL VL]\n"
+ "addvl x22, x22, #8\n"
+ "zip1 z31.b, z25.b, z17.b\n"
+ "ld1b { z19.b }, p1/Z, [x21]\n"
+ "zip2 z8.b, z25.b, z17.b\n"
+ "ld1b { z2.b }, p1/Z, [x21, #1, MUL VL]\n"
+ "zip1 z27.b, z7.b, z22.b\n"
+ "ld1b { z29.b }, p1/Z, [x21, #2, MUL VL]\n"
+ "zip2 z7.b, z7.b, z22.b\n"
+ "ld1b { z24.b }, p1/Z, [x21, #3, MUL VL]\n"
+ "zip1 z18.b, z16.b, z19.b\n"
+ "ld1b { z25.b }, p1/Z, [x21, #4, MUL VL]\n"
+ "zip1 z17.b, z21.b, z18.b\n"
+ "ld1b { z22.b }, p1/Z, [x21, #5, MUL VL]\n"
+ "zip2 z18.b, z21.b, z18.b\n"
+ "ld1b { z21.b }, p1/Z, [x21, #6, MUL VL]\n"
+ "zip2 z16.b, z16.b, z19.b\n"
+ "ld1b { z19.b }, p1/Z, [x21, #7, MUL VL]\n"
+ "addvl x21, x21, #8\n"
+ "st1b { z17.b }, p1, [x24]\n"
+ "zip1 z17.b, z20.b, z16.b\n"
+ "zip2 z20.b, z20.b, z16.b\n"
+ "st1b { z18.b }, p1, [x24, #1, MUL VL]\n"
+ "zip1 z16.b, z12.b, z2.b\n"
+ "st1b { z17.b }, p1, [x24, #2, MUL VL]\n"
+ "zip1 z17.b, z10.b, z16.b\n"
+ "st1b { z20.b }, p1, [x24, #3, MUL VL]\n"
+ "zip2 z16.b, z10.b, z16.b\n"
+ "st1b { z17.b }, p1, [x24, #4, MUL VL]\n"
+ "zip2 z17.b, z12.b, z2.b\n"
+ "st1b { z16.b }, p1, [x24, #5, MUL VL]\n"
+ "zip1 z16.b, z9.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #6, MUL VL]\n"
+ "zip2 z16.b, z9.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #7, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "zip1 z18.b, z15.b, z29.b\n"
+ "zip2 z17.b, z15.b, z29.b\n"
+ "zip1 z16.b, z0.b, z18.b\n"
+ "st1b { z16.b }, p1, [x24]\n"
+ "zip2 z16.b, z0.b, z18.b\n"
+ "st1b { z16.b }, p1, [x24, #1, MUL VL]\n"
+ "zip1 z16.b, z28.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #2, MUL VL]\n"
+ "zip2 z16.b, z28.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #3, MUL VL]\n"
+ "zip1 z17.b, z11.b, z24.b\n"
+ "zip1 z16.b, z31.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #4, MUL VL]\n"
+ "zip2 z16.b, z31.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #5, MUL VL]\n"
+ "zip2 z17.b, z11.b, z24.b\n"
+ "zip1 z16.b, z8.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #6, MUL VL]\n"
+ "zip2 z16.b, z8.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #7, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "zip1 z18.b, z4.b, z25.b\n"
+ "zip2 z17.b, z4.b, z25.b\n"
+ "zip1 z16.b, z27.b, z18.b\n"
+ "st1b { z16.b }, p1, [x24]\n"
+ "zip2 z16.b, z27.b, z18.b\n"
+ "st1b { z16.b }, p1, [x24, #1, MUL VL]\n"
+ "zip1 z16.b, z7.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #2, MUL VL]\n"
+ "zip2 z16.b, z7.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #3, MUL VL]\n"
+ "zip1 z18.b, z3.b, z6.b\n"
+ "zip1 z17.b, z5.b, z22.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #5, MUL VL]\n"
+ "zip2 z18.b, z3.b, z6.b\n"
+ "zip2 z17.b, z5.b, z22.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #7, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "zip1 z18.b, z14.b, z1.b\n"
+ "zip1 z17.b, z26.b, z21.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #1, MUL VL]\n"
+ "zip2 z18.b, z14.b, z1.b\n"
+ "zip2 z17.b, z26.b, z21.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #3, MUL VL]\n"
+ "zip1 z18.b, z13.b, z23.b\n"
+ "zip1 z17.b, z30.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #5, MUL VL]\n"
+ "zip2 z18.b, z13.b, z23.b\n"
+ "zip2 z17.b, z30.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #7, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x20, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x19, x20\n"
+ "decw x20, ALL, MUL #8\n"
+ "whilelt p0.b, XZR, x19\n"
+ "ld1b { z17.b }, p0/Z, [x25]\n"
+ "ld1b { z25.b }, p0/Z, [x23]\n"
+ "decb x19\n"
+ "ld1b { z16.b }, p0/Z, [x22]\n"
+ "zip1 z18.b, z17.b, z16.b\n"
+ "ld1b { z24.b }, p0/Z, [x21]\n"
+ "whilelt p0.b, XZR, x19\n"
+ "zip2 z23.b, z17.b, z16.b\n"
+ "ld1b { z22.b }, p0/Z, [x25, #1, MUL VL]\n"
+ "addvl x25, x25, #2\n"
+ "zip1 z16.b, z25.b, z24.b\n"
+ "ld1b { z21.b }, p0/Z, [x23, #1, MUL VL]\n"
+ "addvl x23, x23, #2\n"
+ "zip1 z17.b, z18.b, z16.b\n"
+ "ld1b { z20.b }, p0/Z, [x22, #1, MUL VL]\n"
+ "addvl x22, x22, #2\n"
+ "zip2 z18.b, z18.b, z16.b\n"
+ "ld1b { z19.b }, p0/Z, [x21, #1, MUL VL]\n"
+ "addvl x21, x21, #2\n"
+ "zip2 z16.b, z25.b, z24.b\n"
+ "st1b { z17.b }, p1, [x24]\n"
+ "cmp x20, #0x0\n"
+ "zip1 z17.b, z23.b, z16.b\n"
+ "st1b { z18.b }, p1, [x24, #1, MUL VL]\n"
+ "zip2 z16.b, z23.b, z16.b\n"
+ "st1b { z17.b }, p1, [x24, #2, MUL VL]\n"
+ "zip1 z18.b, z22.b, z20.b\n"
+ "st1b { z16.b }, p1, [x24, #3, MUL VL]\n"
+ "zip1 z17.b, z21.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #5, MUL VL]\n"
+ "zip2 z18.b, z22.b, z20.b\n"
+ "zip2 z17.b, z21.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x24, #7, MUL VL]\n"
+ "add x24, x24, %x[out_stride]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #8\n"
+ "cmp %x[height], #0x1\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<8, 4, true, VLType::SVE>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_8VL_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<8, 4, true, VLType::SVE>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_8VL_1x4(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_1x8.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_1x8.hpp
new file mode 100644
index 0000000000..34d43f5052
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_1x8.hpp
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_8VL_1x8(uint8_t *out, const uint8_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint8_t *pad_row = reinterpret_cast<uint8_t *>(alloca(width * sizeof(uint8_t)));
+
+ if (height % 8) {
+ memset(pad_row, 0, width * sizeof(uint8_t));
+ }
+
+ size_t out_stride = 8 * roundup<size_t>(height, 8) * get_vector_length<uint64_t>();
+
+ __asm__ __volatile__(
+ "ptrue p1.b\n"
+ "1:" // Main row loop: Head
+ "mov x9, %x[in]\n"
+ "mov x28, %x[out]\n"
+ "add x27, x9, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add x22, x23, %x[in_stride]\n"
+ "add x21, x22, %x[in_stride]\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "cmp %x[height], #0x7\n"
+ "csel x21, x21, %x[pad_row], GT\n"
+ "csel x22, x22, %x[pad_row], GE\n"
+ "cmp %x[height], #0x5\n"
+ "csel x23, x23, %x[pad_row], GT\n"
+ "csel x24, x24, %x[pad_row], GE\n"
+ "cmp %x[height], #0x3\n"
+ "csel x25, x25, %x[pad_row], GT\n"
+ "csel x26, x26, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x27, x27, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x20, %x[width]\n"
+ "cntb x19, ALL, MUL #2\n"
+ "cmp x20, x19\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1b { z17.b }, p1/Z, [x9]\n"
+ "sub x20, x20, x19\n"
+ "ld1b { z5.b }, p1/Z, [x9, #1, MUL VL]\n"
+ "addvl x9, x9, #2\n"
+ "ld1b { z19.b }, p1/Z, [x27]\n"
+ "cmp x20, x19\n"
+ "ld1b { z4.b }, p1/Z, [x27, #1, MUL VL]\n"
+ "addvl x27, x27, #2\n"
+ "ld1b { z18.b }, p1/Z, [x26]\n"
+ "ld1b { z3.b }, p1/Z, [x26, #1, MUL VL]\n"
+ "addvl x26, x26, #2\n"
+ "ld1b { z2.b }, p1/Z, [x25]\n"
+ "ld1b { z1.b }, p1/Z, [x25, #1, MUL VL]\n"
+ "addvl x25, x25, #2\n"
+ "ld1b { z16.b }, p1/Z, [x24]\n"
+ "zip1 z0.b, z17.b, z16.b\n"
+ "ld1b { z31.b }, p1/Z, [x24, #1, MUL VL]\n"
+ "addvl x24, x24, #2\n"
+ "zip2 z30.b, z17.b, z16.b\n"
+ "ld1b { z17.b }, p1/Z, [x23]\n"
+ "ld1b { z29.b }, p1/Z, [x23, #1, MUL VL]\n"
+ "zip1 z28.b, z5.b, z31.b\n"
+ "ld1b { z16.b }, p1/Z, [x22]\n"
+ "addvl x23, x23, #2\n"
+ "zip1 z27.b, z19.b, z17.b\n"
+ "ld1b { z26.b }, p1/Z, [x22, #1, MUL VL]\n"
+ "addvl x22, x22, #2\n"
+ "zip2 z25.b, z19.b, z17.b\n"
+ "ld1b { z24.b }, p1/Z, [x21]\n"
+ "zip1 z22.b, z4.b, z29.b\n"
+ "ld1b { z23.b }, p1/Z, [x21, #1, MUL VL]\n"
+ "addvl x21, x21, #2\n"
+ "zip1 z21.b, z18.b, z16.b\n"
+ "zip2 z20.b, z18.b, z16.b\n"
+ "zip1 z18.b, z0.b, z21.b\n"
+ "zip1 z19.b, z2.b, z24.b\n"
+ "zip1 z17.b, z27.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z18.b, z0.b, z21.b\n"
+ "zip2 z17.b, z27.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z18.b, z30.b, z20.b\n"
+ "zip2 z19.b, z2.b, z24.b\n"
+ "zip1 z17.b, z25.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "zip2 z18.b, z30.b, z20.b\n"
+ "zip2 z17.b, z25.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #7, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "zip1 z20.b, z3.b, z26.b\n"
+ "zip1 z19.b, z1.b, z23.b\n"
+ "zip1 z18.b, z28.b, z20.b\n"
+ "zip1 z17.b, z22.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z18.b, z28.b, z20.b\n"
+ "zip2 z17.b, z22.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip2 z22.b, z5.b, z31.b\n"
+ "zip2 z21.b, z3.b, z26.b\n"
+ "zip1 z18.b, z22.b, z21.b\n"
+ "zip2 z20.b, z4.b, z29.b\n"
+ "zip2 z19.b, z1.b, z23.b\n"
+ "zip1 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "zip2 z18.b, z22.b, z21.b\n"
+ "zip2 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #7, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x20, 5f\n"
+ "4:" // Main row loop: Column loop
+ "whilelt p0.b, XZR, x20\n"
+ "ld1b { z18.b }, p0/Z, [x9]\n"
+ "addvl x9, x9, #1\n"
+ "ld1b { z28.b }, p0/Z, [x27]\n"
+ "addvl x27, x27, #1\n"
+ "ld1b { z17.b }, p0/Z, [x26]\n"
+ "addvl x26, x26, #1\n"
+ "ld1b { z27.b }, p0/Z, [x25]\n"
+ "addvl x25, x25, #1\n"
+ "ld1b { z16.b }, p0/Z, [x24]\n"
+ "zip1 z26.b, z18.b, z16.b\n"
+ "ld1b { z25.b }, p0/Z, [x23]\n"
+ "addvl x24, x24, #1\n"
+ "zip2 z24.b, z18.b, z16.b\n"
+ "ld1b { z16.b }, p0/Z, [x22]\n"
+ "addvl x23, x23, #1\n"
+ "zip1 z23.b, z28.b, z25.b\n"
+ "ld1b { z22.b }, p0/Z, [x21]\n"
+ "addvl x22, x22, #1\n"
+ "zip1 z20.b, z17.b, z16.b\n"
+ "addvl x21, x21, #1\n"
+ "zip2 z21.b, z17.b, z16.b\n"
+ "decd x20, ALL, MUL #8\n"
+ "zip1 z18.b, z26.b, z20.b\n"
+ "cmp x20, #0x0\n"
+ "zip1 z19.b, z27.b, z22.b\n"
+ "zip1 z17.b, z23.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #1, MUL VL]\n"
+ "zip2 z18.b, z26.b, z20.b\n"
+ "zip2 z17.b, z23.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #2, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #3, MUL VL]\n"
+ "zip1 z18.b, z24.b, z21.b\n"
+ "zip2 z20.b, z28.b, z25.b\n"
+ "zip2 z19.b, z27.b, z22.b\n"
+ "zip1 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #4, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #5, MUL VL]\n"
+ "zip2 z18.b, z24.b, z21.b\n"
+ "zip2 z17.b, z20.b, z19.b\n"
+ "zip1 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #6, MUL VL]\n"
+ "zip2 z16.b, z18.b, z17.b\n"
+ "st1b { z16.b }, p1, [x28, #7, MUL VL]\n"
+ "add x28, x28, %x[out_stride]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #8\n"
+ "cmp %x[height], #0x1\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "x9", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z4", "z5", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<8, 8, true, VLType::SVE>(
+ uint8_t *out, const uint8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_8VL_1x8(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(uint8_t) / 1,
+ stride * sizeof(uint8_t),
+ (kmax-k0)
+ );
+}
+
+template<>
+void Transform<8, 8, true, VLType::SVE>(
+ int8_t *out, const int8_t *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_8VL_1x8(
+ reinterpret_cast<uint8_t *>(out),
+ reinterpret_cast<const uint8_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(int8_t) / 1,
+ stride * sizeof(int8_t),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x2.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x2.hpp
new file mode 100644
index 0000000000..7124f7e909
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x2.hpp
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_8VL_2x2(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 2) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 8 * roundup<size_t>(height, 2) * get_vector_length<uint16_t>();
+
+ __asm__ __volatile__(
+ "ptrue p3.b\n"
+ "cmp %x[height], #0x4\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x27, %x[in]\n"
+ "mov x26, %x[out]\n"
+ "add x25, x27, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add %x[in], x23, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x22, %x[width]\n"
+ "cnth x21, ALL, MUL #8\n"
+ "cmp x22, x21\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1h { z8.h }, p3/Z, [x27]\n"
+ "mov x20, x26\n"
+ "ld1h { z3.h }, p3/Z, [x27, #1, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "ld1h { z22.h }, p3/Z, [x27, #2, MUL VL]\n"
+ "mov x19, x26\n"
+ "ld1h { z12.h }, p3/Z, [x27, #3, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "ld1h { z4.h }, p3/Z, [x27, #4, MUL VL]\n"
+ "sub x22, x22, x21\n"
+ "ld1h { z25.h }, p3/Z, [x27, #5, MUL VL]\n"
+ "cmp x22, x21\n"
+ "ld1h { z15.h }, p3/Z, [x27, #6, MUL VL]\n"
+ "ld1h { z2.h }, p3/Z, [x27, #7, MUL VL]\n"
+ "addvl x27, x27, #8\n"
+ "ld1h { z16.h }, p3/Z, [x25]\n"
+ "zip1 z21.h, z8.h, z16.h\n"
+ "ld1h { z27.h }, p3/Z, [x25, #1, MUL VL]\n"
+ "zip2 z7.h, z8.h, z16.h\n"
+ "ld1h { z18.h }, p3/Z, [x25, #2, MUL VL]\n"
+ "ld1h { z30.h }, p3/Z, [x25, #3, MUL VL]\n"
+ "zip1 z19.h, z3.h, z27.h\n"
+ "ld1h { z0.h }, p3/Z, [x25, #4, MUL VL]\n"
+ "zip2 z16.h, z3.h, z27.h\n"
+ "ld1h { z27.h }, p3/Z, [x25, #5, MUL VL]\n"
+ "zip1 z13.h, z22.h, z18.h\n"
+ "ld1h { z26.h }, p3/Z, [x25, #6, MUL VL]\n"
+ "zip2 z29.h, z22.h, z18.h\n"
+ "ld1h { z24.h }, p3/Z, [x25, #7, MUL VL]\n"
+ "addvl x25, x25, #8\n"
+ "zip1 z20.h, z12.h, z30.h\n"
+ "ld1h { z9.h }, p3/Z, [x24]\n"
+ "zip2 z14.h, z12.h, z30.h\n"
+ "ld1h { z12.h }, p3/Z, [x24, #1, MUL VL]\n"
+ "zip1 z5.h, z4.h, z0.h\n"
+ "ld1h { z31.h }, p3/Z, [x24, #2, MUL VL]\n"
+ "zip2 z1.h, z4.h, z0.h\n"
+ "ld1h { z22.h }, p3/Z, [x24, #3, MUL VL]\n"
+ "zip1 z10.h, z25.h, z27.h\n"
+ "ld1h { z3.h }, p3/Z, [x24, #4, MUL VL]\n"
+ "zip2 z6.h, z25.h, z27.h\n"
+ "ld1h { z4.h }, p3/Z, [x24, #5, MUL VL]\n"
+ "zip1 z8.h, z15.h, z26.h\n"
+ "ld1h { z25.h }, p3/Z, [x24, #6, MUL VL]\n"
+ "zip2 z11.h, z15.h, z26.h\n"
+ "ld1h { z30.h }, p3/Z, [x24, #7, MUL VL]\n"
+ "addvl x24, x24, #8\n"
+ "zip1 z17.h, z2.h, z24.h\n"
+ "ld1h { z23.h }, p3/Z, [x23]\n"
+ "zip2 z0.h, z2.h, z24.h\n"
+ "ld1h { z28.h }, p3/Z, [x23, #1, MUL VL]\n"
+ "ld1h { z15.h }, p3/Z, [x23, #2, MUL VL]\n"
+ "zip1 z18.h, z9.h, z23.h\n"
+ "ld1h { z26.h }, p3/Z, [x23, #3, MUL VL]\n"
+ "zip2 z27.h, z9.h, z23.h\n"
+ "ld1h { z2.h }, p3/Z, [x23, #4, MUL VL]\n"
+ "zip1 z9.h, z12.h, z28.h\n"
+ "ld1h { z24.h }, p3/Z, [x23, #5, MUL VL]\n"
+ "zip2 z12.h, z12.h, z28.h\n"
+ "ld1h { z23.h }, p3/Z, [x23, #6, MUL VL]\n"
+ "zip1 z28.h, z31.h, z15.h\n"
+ "zip2 z31.h, z31.h, z15.h\n"
+ "ld1h { z15.h }, p3/Z, [x23, #7, MUL VL]\n"
+ "addvl x23, x23, #8\n"
+ "st1h { z21.h }, p3, [x20]\n"
+ "zip1 z21.h, z22.h, z26.h\n"
+ "zip2 z26.h, z22.h, z26.h\n"
+ "st1h { z7.h }, p3, [x20, #1, MUL VL]\n"
+ "zip1 z7.h, z3.h, z2.h\n"
+ "st1h { z19.h }, p3, [x20, #2, MUL VL]\n"
+ "zip2 z22.h, z3.h, z2.h\n"
+ "st1h { z16.h }, p3, [x20, #3, MUL VL]\n"
+ "zip1 z2.h, z4.h, z24.h\n"
+ "st1h { z13.h }, p3, [x20, #4, MUL VL]\n"
+ "zip2 z3.h, z4.h, z24.h\n"
+ "st1h { z29.h }, p3, [x20, #5, MUL VL]\n"
+ "zip1 z4.h, z25.h, z23.h\n"
+ "st1h { z20.h }, p3, [x20, #6, MUL VL]\n"
+ "zip2 z20.h, z25.h, z23.h\n"
+ "st1h { z14.h }, p3, [x20, #7, MUL VL]\n"
+ "addvl x20, x20, #16\n"
+ "zip1 z25.h, z30.h, z15.h\n"
+ "st1h { z18.h }, p3, [x20, #-8, MUL VL]\n"
+ "zip2 z18.h, z30.h, z15.h\n"
+ "st1h { z27.h }, p3, [x20, #-7, MUL VL]\n"
+ "st1h { z9.h }, p3, [x20, #-6, MUL VL]\n"
+ "st1h { z12.h }, p3, [x20, #-5, MUL VL]\n"
+ "st1h { z28.h }, p3, [x20, #-4, MUL VL]\n"
+ "st1h { z31.h }, p3, [x20, #-3, MUL VL]\n"
+ "st1h { z21.h }, p3, [x20, #-2, MUL VL]\n"
+ "st1h { z26.h }, p3, [x20, #-1, MUL VL]\n"
+ "st1h { z5.h }, p3, [x19]\n"
+ "st1h { z1.h }, p3, [x19, #1, MUL VL]\n"
+ "st1h { z10.h }, p3, [x19, #2, MUL VL]\n"
+ "st1h { z6.h }, p3, [x19, #3, MUL VL]\n"
+ "st1h { z8.h }, p3, [x19, #4, MUL VL]\n"
+ "st1h { z11.h }, p3, [x19, #5, MUL VL]\n"
+ "st1h { z17.h }, p3, [x19, #6, MUL VL]\n"
+ "st1h { z0.h }, p3, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "st1h { z7.h }, p3, [x19, #-8, MUL VL]\n"
+ "st1h { z22.h }, p3, [x19, #-7, MUL VL]\n"
+ "st1h { z2.h }, p3, [x19, #-6, MUL VL]\n"
+ "st1h { z3.h }, p3, [x19, #-5, MUL VL]\n"
+ "st1h { z4.h }, p3, [x19, #-4, MUL VL]\n"
+ "st1h { z20.h }, p3, [x19, #-3, MUL VL]\n"
+ "st1h { z25.h }, p3, [x19, #-2, MUL VL]\n"
+ "st1h { z18.h }, p3, [x19, #-1, MUL VL]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x20, x22\n"
+ "mov x19, x26\n"
+ "whilelt p0.h, XZR, x20\n"
+ "ld1h { z17.h }, p0/Z, [x27]\n"
+ "ld1h { z16.h }, p0/Z, [x25]\n"
+ "zip1 z0.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p0/Z, [x24]\n"
+ "dech x20\n"
+ "zip2 z31.h, z17.h, z16.h\n"
+ "ld1h { z16.h }, p0/Z, [x23]\n"
+ "whilelt p2.h, XZR, x20\n"
+ "zip1 z30.h, z18.h, z16.h\n"
+ "ld1h { z17.h }, p2/Z, [x27, #1, MUL VL]\n"
+ "dech x20\n"
+ "zip2 z29.h, z18.h, z16.h\n"
+ "ld1h { z16.h }, p2/Z, [x25, #1, MUL VL]\n"
+ "whilelt p1.h, XZR, x20\n"
+ "zip1 z28.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p1/Z, [x27, #2, MUL VL]\n"
+ "dech x20\n"
+ "zip2 z27.h, z17.h, z16.h\n"
+ "ld1h { z16.h }, p1/Z, [x25, #2, MUL VL]\n"
+ "whilelt p0.h, XZR, x20\n"
+ "zip1 z26.h, z18.h, z16.h\n"
+ "ld1h { z17.h }, p0/Z, [x27, #3, MUL VL]\n"
+ "addvl x27, x27, #4\n"
+ "zip2 z25.h, z18.h, z16.h\n"
+ "ld1h { z16.h }, p0/Z, [x25, #3, MUL VL]\n"
+ "addvl x25, x25, #4\n"
+ "zip1 z24.h, z17.h, z16.h\n"
+ "ld1h { z19.h }, p2/Z, [x24, #1, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "zip2 z23.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p1/Z, [x24, #2, MUL VL]\n"
+ "decw x22, ALL, MUL #8\n"
+ "ld1h { z22.h }, p0/Z, [x24, #3, MUL VL]\n"
+ "addvl x24, x24, #4\n"
+ "ld1h { z16.h }, p2/Z, [x23, #1, MUL VL]\n"
+ "zip1 z21.h, z19.h, z16.h\n"
+ "ld1h { z17.h }, p1/Z, [x23, #2, MUL VL]\n"
+ "cmp x22, #0x0\n"
+ "zip2 z20.h, z19.h, z16.h\n"
+ "ld1h { z16.h }, p0/Z, [x23, #3, MUL VL]\n"
+ "addvl x23, x23, #4\n"
+ "zip1 z19.h, z18.h, z17.h\n"
+ "st1h { z0.h }, p3, [x19]\n"
+ "zip2 z18.h, z18.h, z17.h\n"
+ "st1h { z31.h }, p3, [x19, #1, MUL VL]\n"
+ "zip1 z17.h, z22.h, z16.h\n"
+ "st1h { z28.h }, p3, [x19, #2, MUL VL]\n"
+ "zip2 z16.h, z22.h, z16.h\n"
+ "st1h { z27.h }, p3, [x19, #3, MUL VL]\n"
+ "st1h { z26.h }, p3, [x19, #4, MUL VL]\n"
+ "st1h { z25.h }, p3, [x19, #5, MUL VL]\n"
+ "st1h { z24.h }, p3, [x19, #6, MUL VL]\n"
+ "st1h { z23.h }, p3, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "st1h { z30.h }, p3, [x19, #-8, MUL VL]\n"
+ "st1h { z29.h }, p3, [x19, #-7, MUL VL]\n"
+ "st1h { z21.h }, p3, [x19, #-6, MUL VL]\n"
+ "st1h { z20.h }, p3, [x19, #-5, MUL VL]\n"
+ "st1h { z19.h }, p3, [x19, #-4, MUL VL]\n"
+ "st1h { z18.h }, p3, [x19, #-3, MUL VL]\n"
+ "st1h { z17.h }, p3, [x19, #-2, MUL VL]\n"
+ "st1h { z16.h }, p3, [x19, #-1, MUL VL]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #16\n"
+ "cmp %x[height], #0x4\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x27, %x[in]\n"
+ "mov x26, %x[out]\n"
+ "add x25, x27, %x[in_stride]\n"
+ "add %x[in], x25, %x[in_stride]\n"
+ "cmp %x[height], #0x1\n"
+ "csel x25, x25, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x2\n"
+ "mov x20, %x[width]\n"
+ "cnth x19, ALL, MUL #8\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1h { z17.h }, p3/Z, [x27]\n"
+ "sub x20, x20, x19\n"
+ "ld1h { z20.h }, p3/Z, [x27, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1h { z19.h }, p3/Z, [x27, #2, MUL VL]\n"
+ "ld1h { z1.h }, p3/Z, [x27, #3, MUL VL]\n"
+ "ld1h { z0.h }, p3/Z, [x27, #4, MUL VL]\n"
+ "ld1h { z31.h }, p3/Z, [x27, #5, MUL VL]\n"
+ "ld1h { z30.h }, p3/Z, [x27, #6, MUL VL]\n"
+ "ld1h { z29.h }, p3/Z, [x27, #7, MUL VL]\n"
+ "addvl x27, x27, #8\n"
+ "ld1h { z16.h }, p3/Z, [x25]\n"
+ "zip1 z28.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p3/Z, [x25, #1, MUL VL]\n"
+ "zip2 z27.h, z17.h, z16.h\n"
+ "ld1h { z17.h }, p3/Z, [x25, #2, MUL VL]\n"
+ "ld1h { z16.h }, p3/Z, [x25, #3, MUL VL]\n"
+ "zip1 z26.h, z20.h, z18.h\n"
+ "ld1h { z22.h }, p3/Z, [x25, #4, MUL VL]\n"
+ "zip2 z21.h, z20.h, z18.h\n"
+ "ld1h { z25.h }, p3/Z, [x25, #5, MUL VL]\n"
+ "zip1 z20.h, z19.h, z17.h\n"
+ "ld1h { z24.h }, p3/Z, [x25, #6, MUL VL]\n"
+ "zip2 z19.h, z19.h, z17.h\n"
+ "ld1h { z23.h }, p3/Z, [x25, #7, MUL VL]\n"
+ "addvl x25, x25, #8\n"
+ "zip1 z18.h, z1.h, z16.h\n"
+ "st1h { z28.h }, p3, [x26]\n"
+ "zip2 z17.h, z1.h, z16.h\n"
+ "st1h { z27.h }, p3, [x26, #1, MUL VL]\n"
+ "zip1 z16.h, z0.h, z22.h\n"
+ "st1h { z26.h }, p3, [x26, #2, MUL VL]\n"
+ "zip2 z22.h, z0.h, z22.h\n"
+ "st1h { z21.h }, p3, [x26, #3, MUL VL]\n"
+ "zip1 z21.h, z31.h, z25.h\n"
+ "st1h { z20.h }, p3, [x26, #4, MUL VL]\n"
+ "zip2 z20.h, z31.h, z25.h\n"
+ "st1h { z19.h }, p3, [x26, #5, MUL VL]\n"
+ "zip1 z19.h, z30.h, z24.h\n"
+ "st1h { z18.h }, p3, [x26, #6, MUL VL]\n"
+ "zip2 z18.h, z30.h, z24.h\n"
+ "st1h { z17.h }, p3, [x26, #7, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "zip1 z17.h, z29.h, z23.h\n"
+ "st1h { z16.h }, p3, [x26]\n"
+ "zip2 z16.h, z29.h, z23.h\n"
+ "st1h { z22.h }, p3, [x26, #1, MUL VL]\n"
+ "st1h { z21.h }, p3, [x26, #2, MUL VL]\n"
+ "st1h { z20.h }, p3, [x26, #3, MUL VL]\n"
+ "st1h { z19.h }, p3, [x26, #4, MUL VL]\n"
+ "st1h { z18.h }, p3, [x26, #5, MUL VL]\n"
+ "st1h { z17.h }, p3, [x26, #6, MUL VL]\n"
+ "st1h { z16.h }, p3, [x26, #7, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "decw x20, ALL, MUL #8\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x27]\n"
+ "ld1h { z16.h }, p0/Z, [x25]\n"
+ "zip1 z24.h, z17.h, z16.h\n"
+ "dech x19\n"
+ "zip2 z23.h, z17.h, z16.h\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z18.h }, p0/Z, [x27, #1, MUL VL]\n"
+ "dech x19\n"
+ "ld1h { z16.h }, p0/Z, [x25, #1, MUL VL]\n"
+ "zip1 z22.h, z18.h, z16.h\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x27, #2, MUL VL]\n"
+ "zip2 z21.h, z18.h, z16.h\n"
+ "dech x19\n"
+ "ld1h { z16.h }, p0/Z, [x25, #2, MUL VL]\n"
+ "zip1 z20.h, z17.h, z16.h\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z19.h }, p0/Z, [x27, #3, MUL VL]\n"
+ "zip2 z18.h, z17.h, z16.h\n"
+ "addvl x27, x27, #4\n"
+ "ld1h { z16.h }, p0/Z, [x25, #3, MUL VL]\n"
+ "zip1 z17.h, z19.h, z16.h\n"
+ "st1h { z24.h }, p3, [x26]\n"
+ "addvl x25, x25, #4\n"
+ "zip2 z16.h, z19.h, z16.h\n"
+ "st1h { z23.h }, p3, [x26, #1, MUL VL]\n"
+ "cmp x20, #0x0\n"
+ "st1h { z22.h }, p3, [x26, #2, MUL VL]\n"
+ "st1h { z21.h }, p3, [x26, #3, MUL VL]\n"
+ "st1h { z20.h }, p3, [x26, #4, MUL VL]\n"
+ "st1h { z18.h }, p3, [x26, #5, MUL VL]\n"
+ "st1h { z17.h }, p3, [x26, #6, MUL VL]\n"
+ "st1h { z16.h }, p3, [x26, #7, MUL VL]\n"
+ "add x26, x26, %x[out_stride]\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #8\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "p3", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<8, 2, true, VLType::SVE>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_8VL_2x2(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x4.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x4.hpp
new file mode 100644
index 0000000000..891e3abeb0
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x4.hpp
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_8VL_2x4(uint16_t *out, const uint16_t *in, size_t width, size_t in_stride, size_t height)
+{
+ uint16_t *pad_row = reinterpret_cast<uint16_t *>(alloca(width * sizeof(uint16_t)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(uint16_t));
+ }
+
+ size_t out_stride = 8 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p2.b\n"
+ "cmp %x[height], #0x8\n"
+ "blt 6f\n"
+ "1:" // Main row loop: Head
+ "mov x11, %x[in]\n"
+ "mov x10, %x[out]\n"
+ "add x9, x11, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add x26, x27, %x[in_stride]\n"
+ "add x25, x26, %x[in_stride]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "add %x[in], x23, %x[in_stride]\n"
+ "sub %x[height], %x[height], #0x8\n"
+ "mov x22, %x[width]\n"
+ "cnth x21, ALL, MUL #4\n"
+ "cmp x22, x21\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1h { z21.h }, p2/Z, [x11]\n"
+ "mov x20, x10\n"
+ "ld1h { z24.h }, p2/Z, [x11, #1, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "ld1h { z8.h }, p2/Z, [x11, #2, MUL VL]\n"
+ "mov x19, x10\n"
+ "ld1h { z11.h }, p2/Z, [x11, #3, MUL VL]\n"
+ "addvl x11, x11, #4\n"
+ "ld1h { z3.h }, p2/Z, [x9]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "ld1h { z0.h }, p2/Z, [x9, #1, MUL VL]\n"
+ "sub x22, x22, x21\n"
+ "ld1h { z18.h }, p2/Z, [x9, #2, MUL VL]\n"
+ "cmp x22, x21\n"
+ "ld1h { z12.h }, p2/Z, [x9, #3, MUL VL]\n"
+ "addvl x9, x9, #4\n"
+ "ld1h { z16.h }, p2/Z, [x28]\n"
+ "zip1 z22.h, z21.h, z16.h\n"
+ "ld1h { z19.h }, p2/Z, [x28, #1, MUL VL]\n"
+ "zip2 z21.h, z21.h, z16.h\n"
+ "ld1h { z26.h }, p2/Z, [x28, #2, MUL VL]\n"
+ "ld1h { z13.h }, p2/Z, [x28, #3, MUL VL]\n"
+ "zip1 z14.h, z24.h, z19.h\n"
+ "ld1h { z16.h }, p2/Z, [x27]\n"
+ "addvl x28, x28, #4\n"
+ "zip2 z24.h, z24.h, z19.h\n"
+ "ld1h { z27.h }, p2/Z, [x27, #1, MUL VL]\n"
+ "zip1 z17.h, z8.h, z26.h\n"
+ "ld1h { z15.h }, p2/Z, [x27, #2, MUL VL]\n"
+ "zip2 z9.h, z8.h, z26.h\n"
+ "ld1h { z5.h }, p2/Z, [x27, #3, MUL VL]\n"
+ "addvl x27, x27, #4\n"
+ "zip1 z2.h, z3.h, z16.h\n"
+ "ld1h { z4.h }, p2/Z, [x26]\n"
+ "zip2 z16.h, z3.h, z16.h\n"
+ "ld1h { z23.h }, p2/Z, [x26, #1, MUL VL]\n"
+ "zip1 z20.h, z22.h, z2.h\n"
+ "ld1h { z10.h }, p2/Z, [x26, #2, MUL VL]\n"
+ "zip2 z28.h, z22.h, z2.h\n"
+ "ld1h { z8.h }, p2/Z, [x26, #3, MUL VL]\n"
+ "addvl x26, x26, #4\n"
+ "zip1 z26.h, z21.h, z16.h\n"
+ "ld1h { z25.h }, p2/Z, [x25]\n"
+ "zip2 z7.h, z21.h, z16.h\n"
+ "ld1h { z31.h }, p2/Z, [x25, #1, MUL VL]\n"
+ "zip1 z3.h, z0.h, z27.h\n"
+ "ld1h { z16.h }, p2/Z, [x25, #2, MUL VL]\n"
+ "zip1 z22.h, z14.h, z3.h\n"
+ "ld1h { z6.h }, p2/Z, [x25, #3, MUL VL]\n"
+ "addvl x25, x25, #4\n"
+ "zip2 z19.h, z14.h, z3.h\n"
+ "ld1h { z2.h }, p2/Z, [x24]\n"
+ "zip2 z14.h, z0.h, z27.h\n"
+ "ld1h { z21.h }, p2/Z, [x24, #1, MUL VL]\n"
+ "zip1 z29.h, z24.h, z14.h\n"
+ "ld1h { z0.h }, p2/Z, [x24, #2, MUL VL]\n"
+ "zip2 z27.h, z24.h, z14.h\n"
+ "ld1h { z1.h }, p2/Z, [x24, #3, MUL VL]\n"
+ "addvl x24, x24, #4\n"
+ "zip1 z30.h, z4.h, z2.h\n"
+ "ld1h { z3.h }, p2/Z, [x23]\n"
+ "zip2 z14.h, z4.h, z2.h\n"
+ "ld1h { z4.h }, p2/Z, [x23, #1, MUL VL]\n"
+ "zip1 z2.h, z23.h, z21.h\n"
+ "ld1h { z24.h }, p2/Z, [x23, #2, MUL VL]\n"
+ "zip2 z21.h, z23.h, z21.h\n"
+ "ld1h { z23.h }, p2/Z, [x23, #3, MUL VL]\n"
+ "addvl x23, x23, #4\n"
+ "st1h { z20.h }, p2, [x20]\n"
+ "zip1 z20.h, z25.h, z3.h\n"
+ "zip2 z3.h, z25.h, z3.h\n"
+ "st1h { z28.h }, p2, [x20, #1, MUL VL]\n"
+ "zip1 z28.h, z30.h, z20.h\n"
+ "st1h { z26.h }, p2, [x20, #2, MUL VL]\n"
+ "zip2 z20.h, z30.h, z20.h\n"
+ "st1h { z7.h }, p2, [x20, #3, MUL VL]\n"
+ "zip1 z25.h, z14.h, z3.h\n"
+ "st1h { z22.h }, p2, [x20, #4, MUL VL]\n"
+ "zip2 z7.h, z14.h, z3.h\n"
+ "st1h { z19.h }, p2, [x20, #5, MUL VL]\n"
+ "zip1 z14.h, z31.h, z4.h\n"
+ "st1h { z29.h }, p2, [x20, #6, MUL VL]\n"
+ "zip1 z19.h, z2.h, z14.h\n"
+ "st1h { z27.h }, p2, [x20, #7, MUL VL]\n"
+ "addvl x20, x20, #16\n"
+ "zip2 z29.h, z2.h, z14.h\n"
+ "st1h { z28.h }, p2, [x20, #-8, MUL VL]\n"
+ "zip2 z27.h, z31.h, z4.h\n"
+ "st1h { z20.h }, p2, [x20, #-7, MUL VL]\n"
+ "zip1 z30.h, z21.h, z27.h\n"
+ "st1h { z25.h }, p2, [x20, #-6, MUL VL]\n"
+ "zip2 z20.h, z21.h, z27.h\n"
+ "st1h { z7.h }, p2, [x20, #-5, MUL VL]\n"
+ "zip1 z14.h, z18.h, z15.h\n"
+ "st1h { z19.h }, p2, [x20, #-4, MUL VL]\n"
+ "zip1 z19.h, z17.h, z14.h\n"
+ "st1h { z29.h }, p2, [x20, #-3, MUL VL]\n"
+ "zip2 z7.h, z17.h, z14.h\n"
+ "st1h { z30.h }, p2, [x20, #-2, MUL VL]\n"
+ "zip2 z14.h, z18.h, z15.h\n"
+ "st1h { z20.h }, p2, [x20, #-1, MUL VL]\n"
+ "zip1 z17.h, z9.h, z14.h\n"
+ "st1h { z19.h }, p2, [x19]\n"
+ "zip2 z27.h, z9.h, z14.h\n"
+ "st1h { z7.h }, p2, [x19, #1, MUL VL]\n"
+ "zip1 z18.h, z11.h, z13.h\n"
+ "st1h { z17.h }, p2, [x19, #2, MUL VL]\n"
+ "zip1 z17.h, z12.h, z5.h\n"
+ "st1h { z27.h }, p2, [x19, #3, MUL VL]\n"
+ "zip1 z20.h, z18.h, z17.h\n"
+ "st1h { z20.h }, p2, [x19, #4, MUL VL]\n"
+ "zip2 z18.h, z18.h, z17.h\n"
+ "st1h { z18.h }, p2, [x19, #5, MUL VL]\n"
+ "zip2 z18.h, z11.h, z13.h\n"
+ "zip2 z17.h, z12.h, z5.h\n"
+ "zip1 z29.h, z18.h, z17.h\n"
+ "st1h { z29.h }, p2, [x19, #6, MUL VL]\n"
+ "zip2 z17.h, z18.h, z17.h\n"
+ "st1h { z17.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "zip1 z18.h, z10.h, z0.h\n"
+ "zip1 z17.h, z16.h, z24.h\n"
+ "zip1 z30.h, z18.h, z17.h\n"
+ "st1h { z30.h }, p2, [x19, #-8, MUL VL]\n"
+ "zip2 z30.h, z18.h, z17.h\n"
+ "st1h { z30.h }, p2, [x19, #-7, MUL VL]\n"
+ "zip2 z18.h, z10.h, z0.h\n"
+ "zip2 z17.h, z16.h, z24.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-6, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-5, MUL VL]\n"
+ "zip1 z18.h, z8.h, z1.h\n"
+ "zip1 z17.h, z6.h, z23.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-4, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-3, MUL VL]\n"
+ "zip2 z18.h, z8.h, z1.h\n"
+ "zip2 z17.h, z6.h, z23.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-2, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-1, MUL VL]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x20, x22\n"
+ "mov x19, x10\n"
+ "whilelt p1.h, XZR, x20\n"
+ "ld1h { z17.h }, p1/Z, [x11]\n"
+ "ld1h { z22.h }, p1/Z, [x9]\n"
+ "dech x20\n"
+ "ld1h { z16.h }, p1/Z, [x28]\n"
+ "zip1 z19.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p1/Z, [x27]\n"
+ "whilelt p0.h, XZR, x20\n"
+ "zip2 z17.h, z17.h, z16.h\n"
+ "ld1h { z21.h }, p0/Z, [x11, #1, MUL VL]\n"
+ "addvl x11, x11, #2\n"
+ "zip1 z16.h, z22.h, z18.h\n"
+ "ld1h { z2.h }, p0/Z, [x9, #1, MUL VL]\n"
+ "addvl x9, x9, #2\n"
+ "zip1 z1.h, z19.h, z16.h\n"
+ "ld1h { z20.h }, p0/Z, [x28, #1, MUL VL]\n"
+ "addvl x28, x28, #2\n"
+ "zip2 z0.h, z19.h, z16.h\n"
+ "ld1h { z19.h }, p0/Z, [x27, #1, MUL VL]\n"
+ "addvl x27, x27, #2\n"
+ "zip2 z16.h, z22.h, z18.h\n"
+ "ld1h { z31.h }, p1/Z, [x26]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip1 z30.h, z17.h, z16.h\n"
+ "ld1h { z29.h }, p0/Z, [x26, #1, MUL VL]\n"
+ "addvl x26, x26, #2\n"
+ "zip2 z28.h, z17.h, z16.h\n"
+ "ld1h { z27.h }, p1/Z, [x25]\n"
+ "decd x22, ALL, MUL #8\n"
+ "zip1 z17.h, z21.h, z20.h\n"
+ "ld1h { z26.h }, p0/Z, [x25, #1, MUL VL]\n"
+ "addvl x25, x25, #2\n"
+ "zip1 z16.h, z2.h, z19.h\n"
+ "ld1h { z25.h }, p1/Z, [x24]\n"
+ "cmp x22, #0x0\n"
+ "zip1 z18.h, z17.h, z16.h\n"
+ "ld1h { z24.h }, p0/Z, [x24, #1, MUL VL]\n"
+ "addvl x24, x24, #2\n"
+ "zip2 z23.h, z17.h, z16.h\n"
+ "ld1h { z22.h }, p1/Z, [x23]\n"
+ "zip2 z17.h, z21.h, z20.h\n"
+ "ld1h { z21.h }, p0/Z, [x23, #1, MUL VL]\n"
+ "addvl x23, x23, #2\n"
+ "zip2 z16.h, z2.h, z19.h\n"
+ "st1h { z1.h }, p2, [x19]\n"
+ "zip1 z20.h, z31.h, z25.h\n"
+ "st1h { z0.h }, p2, [x19, #1, MUL VL]\n"
+ "zip1 z19.h, z17.h, z16.h\n"
+ "st1h { z30.h }, p2, [x19, #2, MUL VL]\n"
+ "zip2 z17.h, z17.h, z16.h\n"
+ "st1h { z28.h }, p2, [x19, #3, MUL VL]\n"
+ "zip1 z16.h, z27.h, z22.h\n"
+ "st1h { z18.h }, p2, [x19, #4, MUL VL]\n"
+ "zip1 z18.h, z20.h, z16.h\n"
+ "st1h { z23.h }, p2, [x19, #5, MUL VL]\n"
+ "zip2 z16.h, z20.h, z16.h\n"
+ "st1h { z19.h }, p2, [x19, #6, MUL VL]\n"
+ "zip2 z19.h, z31.h, z25.h\n"
+ "st1h { z17.h }, p2, [x19, #7, MUL VL]\n"
+ "addvl x19, x19, #16\n"
+ "zip2 z17.h, z27.h, z22.h\n"
+ "st1h { z18.h }, p2, [x19, #-8, MUL VL]\n"
+ "zip1 z18.h, z29.h, z24.h\n"
+ "st1h { z16.h }, p2, [x19, #-7, MUL VL]\n"
+ "zip1 z16.h, z19.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-6, MUL VL]\n"
+ "zip2 z16.h, z19.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-5, MUL VL]\n"
+ "zip1 z17.h, z26.h, z21.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-4, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-3, MUL VL]\n"
+ "zip2 z18.h, z29.h, z24.h\n"
+ "zip2 z17.h, z26.h, z21.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-2, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x19, #-1, MUL VL]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "addvl %x[out], %x[out], #16\n"
+ "cmp %x[height], #0x8\n"
+ "bge 1b\n"
+ "cbz %x[height], 12f\n"
+ "6:" // Main loop skip
+
+ "7:" // Tail row loop: Head
+ "mov x11, %x[in]\n"
+ "mov x10, %x[out]\n"
+ "add x9, x11, %x[in_stride]\n"
+ "add x28, x9, %x[in_stride]\n"
+ "add x27, x28, %x[in_stride]\n"
+ "add %x[in], x27, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "csel x27, x27, %x[pad_row], GT\n"
+ "csel x28, x28, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x9, x9, %x[pad_row], GT\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "mov x20, %x[width]\n"
+ "cnth x19, ALL, MUL #4\n"
+ "cmp x20, x19\n"
+ "blt 9f\n"
+ "8:" // Tail row loop: Unroll column loop
+ "ld1h { z17.h }, p2/Z, [x11]\n"
+ "sub x20, x20, x19\n"
+ "ld1h { z20.h }, p2/Z, [x11, #1, MUL VL]\n"
+ "cmp x20, x19\n"
+ "ld1h { z19.h }, p2/Z, [x11, #2, MUL VL]\n"
+ "ld1h { z1.h }, p2/Z, [x11, #3, MUL VL]\n"
+ "addvl x11, x11, #4\n"
+ "ld1h { z0.h }, p2/Z, [x9]\n"
+ "ld1h { z31.h }, p2/Z, [x9, #1, MUL VL]\n"
+ "ld1h { z30.h }, p2/Z, [x9, #2, MUL VL]\n"
+ "ld1h { z29.h }, p2/Z, [x9, #3, MUL VL]\n"
+ "addvl x9, x9, #4\n"
+ "ld1h { z16.h }, p2/Z, [x28]\n"
+ "zip1 z28.h, z17.h, z16.h\n"
+ "ld1h { z18.h }, p2/Z, [x28, #1, MUL VL]\n"
+ "zip2 z27.h, z17.h, z16.h\n"
+ "ld1h { z17.h }, p2/Z, [x28, #2, MUL VL]\n"
+ "ld1h { z26.h }, p2/Z, [x28, #3, MUL VL]\n"
+ "zip1 z25.h, z20.h, z18.h\n"
+ "ld1h { z16.h }, p2/Z, [x27]\n"
+ "addvl x28, x28, #4\n"
+ "zip2 z24.h, z20.h, z18.h\n"
+ "ld1h { z23.h }, p2/Z, [x27, #1, MUL VL]\n"
+ "zip1 z22.h, z19.h, z17.h\n"
+ "ld1h { z21.h }, p2/Z, [x27, #2, MUL VL]\n"
+ "zip2 z20.h, z19.h, z17.h\n"
+ "ld1h { z19.h }, p2/Z, [x27, #3, MUL VL]\n"
+ "addvl x27, x27, #4\n"
+ "zip1 z18.h, z0.h, z16.h\n"
+ "zip2 z17.h, z0.h, z16.h\n"
+ "zip1 z16.h, z28.h, z18.h\n"
+ "st1h { z16.h }, p2, [x10]\n"
+ "zip2 z16.h, z28.h, z18.h\n"
+ "st1h { z16.h }, p2, [x10, #1, MUL VL]\n"
+ "zip1 z16.h, z27.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #2, MUL VL]\n"
+ "zip2 z16.h, z27.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #3, MUL VL]\n"
+ "zip1 z17.h, z31.h, z23.h\n"
+ "zip1 z16.h, z25.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #4, MUL VL]\n"
+ "zip2 z16.h, z25.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #5, MUL VL]\n"
+ "zip2 z17.h, z31.h, z23.h\n"
+ "zip1 z16.h, z24.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #6, MUL VL]\n"
+ "zip2 z16.h, z24.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #7, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "zip1 z18.h, z30.h, z21.h\n"
+ "zip2 z17.h, z30.h, z21.h\n"
+ "zip1 z16.h, z22.h, z18.h\n"
+ "st1h { z16.h }, p2, [x10]\n"
+ "zip2 z16.h, z22.h, z18.h\n"
+ "st1h { z16.h }, p2, [x10, #1, MUL VL]\n"
+ "zip1 z16.h, z20.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #2, MUL VL]\n"
+ "zip2 z16.h, z20.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #3, MUL VL]\n"
+ "zip1 z18.h, z1.h, z26.h\n"
+ "zip1 z17.h, z29.h, z19.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #4, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #5, MUL VL]\n"
+ "zip2 z18.h, z1.h, z26.h\n"
+ "zip2 z17.h, z29.h, z19.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #6, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #7, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "bge 8b\n"
+ "9:" // Tail row loop: Unroll column loop skip
+ "cbz x20, 11f\n"
+ "10:" // Tail row loop: Column loop
+ "mov x19, x20\n"
+ "decd x20, ALL, MUL #8\n"
+ "whilelt p0.h, XZR, x19\n"
+ "ld1h { z17.h }, p0/Z, [x11]\n"
+ "ld1h { z25.h }, p0/Z, [x9]\n"
+ "dech x19\n"
+ "ld1h { z16.h }, p0/Z, [x28]\n"
+ "zip1 z18.h, z17.h, z16.h\n"
+ "ld1h { z24.h }, p0/Z, [x27]\n"
+ "whilelt p0.h, XZR, x19\n"
+ "zip2 z23.h, z17.h, z16.h\n"
+ "ld1h { z22.h }, p0/Z, [x11, #1, MUL VL]\n"
+ "addvl x11, x11, #2\n"
+ "zip1 z16.h, z25.h, z24.h\n"
+ "ld1h { z21.h }, p0/Z, [x9, #1, MUL VL]\n"
+ "addvl x9, x9, #2\n"
+ "zip1 z17.h, z18.h, z16.h\n"
+ "ld1h { z20.h }, p0/Z, [x28, #1, MUL VL]\n"
+ "addvl x28, x28, #2\n"
+ "zip2 z18.h, z18.h, z16.h\n"
+ "ld1h { z19.h }, p0/Z, [x27, #1, MUL VL]\n"
+ "addvl x27, x27, #2\n"
+ "zip2 z16.h, z25.h, z24.h\n"
+ "st1h { z17.h }, p2, [x10]\n"
+ "cmp x20, #0x0\n"
+ "zip1 z17.h, z23.h, z16.h\n"
+ "st1h { z18.h }, p2, [x10, #1, MUL VL]\n"
+ "zip2 z16.h, z23.h, z16.h\n"
+ "st1h { z17.h }, p2, [x10, #2, MUL VL]\n"
+ "zip1 z18.h, z22.h, z20.h\n"
+ "st1h { z16.h }, p2, [x10, #3, MUL VL]\n"
+ "zip1 z17.h, z21.h, z19.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #4, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #5, MUL VL]\n"
+ "zip2 z18.h, z22.h, z20.h\n"
+ "zip2 z17.h, z21.h, z19.h\n"
+ "zip1 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #6, MUL VL]\n"
+ "zip2 z16.h, z18.h, z17.h\n"
+ "st1h { z16.h }, p2, [x10, #7, MUL VL]\n"
+ "add x10, x10, %x[out_stride]\n"
+ "bgt 10b\n"
+ "11:" // Tail row loop: Column loop skip
+ "addvl %x[out], %x[out], #8\n"
+ "cmp %x[height], #0x1\n"
+ "bge 7b\n"
+ "12:" // Done
+
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "x9", "x10", "x11", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+
+template<>
+void Transform<8, 4, true, VLType::SVE>(
+ bfloat16 *out, const bfloat16 *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_8VL_2x4(
+ reinterpret_cast<uint16_t *>(out),
+ reinterpret_cast<const uint16_t *>(in + k0 * stride + x0),
+ (xmax-x0) * sizeof(bfloat16) / 2,
+ stride * sizeof(bfloat16),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x4_fp32bf16.hpp b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x4_fp32bf16.hpp
new file mode 100644
index 0000000000..1313479dbc
--- /dev/null
+++ b/src/core/NEON/kernels/arm_gemm/transforms/sve_transpose_interleave_8VL_2x4_fp32bf16.hpp
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2021 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
+
+
+namespace {
+
+void sve_transpose_interleave_8VL_2x4_fp32bf16(bfloat16 *out, const float *in, size_t width, size_t in_stride, size_t height)
+{
+ float *pad_row = reinterpret_cast<float *>(alloca(width * sizeof(float)));
+
+ if (height % 4) {
+ memset(pad_row, 0, width * sizeof(float));
+ }
+
+ size_t out_stride = 8 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>();
+
+ __asm__ __volatile__(
+ "ptrue p4.b\n"
+ "1:" // Main row loop: Head
+ "mov x25, %x[in]\n"
+ "add x24, x25, %x[in_stride]\n"
+ "add x23, x24, %x[in_stride]\n"
+ "mov x22, %x[width]\n"
+ "cnth x19, ALL, MUL #4\n"
+ "add x21, x23, %x[in_stride]\n"
+ "cmp %x[height], #0x3\n"
+ "add %x[in], x21, %x[in_stride]\n"
+ "csel x21, x21, %x[pad_row], GT\n"
+ "csel x23, x23, %x[pad_row], GE\n"
+ "cmp %x[height], #0x1\n"
+ "csel x24, x24, %x[pad_row], GT\n"
+ "cmp x22, x19\n"
+ "mov x20, %x[out]\n"
+ "sub %x[height], %x[height], #0x4\n"
+ "blt 3f\n"
+ "2:" // Main row loop: Unroll column loop
+ "ld1w { z19.s }, p4/Z, [x25]\n"
+ "ld1w { z18.s }, p4/Z, [x25, #1, MUL VL]\n"
+ "sub x22, x22, x19\n"
+ "cmp x22, x19\n"
+ "ld1w { z20.s }, p4/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z24.s }, p4/Z, [x25, #3, MUL VL]\n"
+ "ld1w { z23.s }, p4/Z, [x23]\n"
+ "ld1w { z17.s }, p4/Z, [x23, #1, MUL VL]\n"
+ "zip1 z22.s, z19.s, z23.s\n"
+ "zip2 z21.s, z19.s, z23.s\n"
+ "ld1w { z31.s }, p4/Z, [x23, #2, MUL VL]\n"
+ "ld1w { z16.s }, p4/Z, [x23, #3, MUL VL]\n"
+ "zip1 z9.s, z18.s, z17.s\n"
+ "zip2 z7.s, z18.s, z17.s\n"
+ "ld1w { z19.s }, p4/Z, [x25, #4, MUL VL]\n"
+ "ld1w { z18.s }, p4/Z, [x25, #5, MUL VL]\n"
+ "zip1 z6.s, z20.s, z31.s\n"
+ "zip2 z5.s, z20.s, z31.s\n"
+ "ld1w { z15.s }, p4/Z, [x25, #6, MUL VL]\n"
+ "ld1w { z20.s }, p4/Z, [x25, #7, MUL VL]\n"
+ "zip1 z3.s, z24.s, z16.s\n"
+ "zip2 z2.s, z24.s, z16.s\n"
+ "ld1w { z16.s }, p4/Z, [x23, #4, MUL VL]\n"
+ "ld1w { z17.s }, p4/Z, [x23, #5, MUL VL]\n"
+ "zip1 z1.s, z19.s, z16.s\n"
+ "zip2 z0.s, z19.s, z16.s\n"
+ "ld1w { z16.s }, p4/Z, [x23, #6, MUL VL]\n"
+ "ld1w { z19.s }, p4/Z, [x23, #7, MUL VL]\n"
+ "zip1 z31.s, z18.s, z17.s\n"
+ "zip2 z30.s, z18.s, z17.s\n"
+ "ld1w { z18.s }, p4/Z, [x24]\n"
+ "ld1w { z17.s }, p4/Z, [x24, #1, MUL VL]\n"
+ "zip1 z29.s, z15.s, z16.s\n"
+ "zip2 z28.s, z15.s, z16.s\n"
+ "ld1w { z16.s }, p4/Z, [x24, #2, MUL VL]\n"
+ "ld1w { z23.s }, p4/Z, [x24, #3, MUL VL]\n"
+ "zip1 z27.s, z20.s, z19.s\n"
+ "zip2 z26.s, z20.s, z19.s\n"
+ "ld1w { z11.s }, p4/Z, [x21]\n"
+ "ld1w { z8.s }, p4/Z, [x21, #1, MUL VL]\n"
+ ".inst 0x658ab2d8 // bfcvt z24.h, p4/M, z22.s\n"
+ "zip1 z25.s, z18.s, z11.s\n"
+ "ld1w { z4.s }, p4/Z, [x21, #2, MUL VL]\n"
+ "ld1w { z22.s }, p4/Z, [x21, #3, MUL VL]\n"
+ ".inst 0x658ab2af // bfcvt z15.h, p4/M, z21.s\n"
+ "zip2 z14.s, z18.s, z11.s\n"
+ "ld1w { z21.s }, p4/Z, [x24, #4, MUL VL]\n"
+ "ld1w { z20.s }, p4/Z, [x24, #5, MUL VL]\n"
+ ".inst 0x658ab12d // bfcvt z13.h, p4/M, z9.s\n"
+ "zip1 z12.s, z17.s, z8.s\n"
+ "ld1w { z11.s }, p4/Z, [x24, #6, MUL VL]\n"
+ "ld1w { z10.s }, p4/Z, [x24, #7, MUL VL]\n"
+ ".inst 0x658ab0e9 // bfcvt z9.h, p4/M, z7.s\n"
+ "zip2 z8.s, z17.s, z8.s\n"
+ "ld1w { z19.s }, p4/Z, [x21, #4, MUL VL]\n"
+ "ld1w { z18.s }, p4/Z, [x21, #5, MUL VL]\n"
+ ".inst 0x658ab0c7 // bfcvt z7.h, p4/M, z6.s\n"
+ "zip1 z6.s, z16.s, z4.s\n"
+ "ld1w { z17.s }, p4/Z, [x21, #6, MUL VL]\n"
+ ".inst 0x658ab0a5 // bfcvt z5.h, p4/M, z5.s\n"
+ "zip2 z4.s, z16.s, z4.s\n"
+ "ld1w { z16.s }, p4/Z, [x21, #7, MUL VL]\n"
+ ".inst 0x658ab063 // bfcvt z3.h, p4/M, z3.s\n"
+ ".inst 0x658ab042 // bfcvt z2.h, p4/M, z2.s\n"
+ "addvl x25, x25, #8\n"
+ "addvl x24, x24, #8\n"
+ ".inst 0x658ab021 // bfcvt z1.h, p4/M, z1.s\n"
+ ".inst 0x658ab000 // bfcvt z0.h, p4/M, z0.s\n"
+ "addvl x23, x23, #8\n"
+ "addvl x21, x21, #8\n"
+ ".inst 0x658ab3ff // bfcvt z31.h, p4/M, z31.s\n"
+ ".inst 0x658ab3de // bfcvt z30.h, p4/M, z30.s\n"
+ ".inst 0x658ab3bd // bfcvt z29.h, p4/M, z29.s\n"
+ ".inst 0x658ab39c // bfcvt z28.h, p4/M, z28.s\n"
+ ".inst 0x658ab37b // bfcvt z27.h, p4/M, z27.s\n"
+ ".inst 0x658ab35a // bfcvt z26.h, p4/M, z26.s\n"
+ ".inst 0x648ab338 // bfcvtnt z24.h, p4/M, z25.s\n"
+ "zip1 z25.s, z23.s, z22.s\n"
+ "st1h { z24.h }, p4, [x20]\n"
+ "zip2 z24.s, z23.s, z22.s\n"
+ "zip1 z23.s, z21.s, z19.s\n"
+ "zip2 z22.s, z21.s, z19.s\n"
+ "zip1 z21.s, z20.s, z18.s\n"
+ "zip2 z20.s, z20.s, z18.s\n"
+ "zip1 z19.s, z11.s, z17.s\n"
+ "zip2 z18.s, z11.s, z17.s\n"
+ "zip1 z17.s, z10.s, z16.s\n"
+ "zip2 z16.s, z10.s, z16.s\n"
+ ".inst 0x648ab1cf // bfcvtnt z15.h, p4/M, z14.s\n"
+ "st1h { z15.h }, p4, [x20, #1, MUL VL]\n"
+ ".inst 0x648ab18d // bfcvtnt z13.h, p4/M, z12.s\n"
+ ".inst 0x648ab109 // bfcvtnt z9.h, p4/M, z8.s\n"
+ "st1h { z13.h }, p4, [x20, #2, MUL VL]\n"
+ ".inst 0x648ab0c7 // bfcvtnt z7.h, p4/M, z6.s\n"
+ ".inst 0x648ab085 // bfcvtnt z5.h, p4/M, z4.s\n"
+ "st1h { z9.h }, p4, [x20, #3, MUL VL]\n"
+ ".inst 0x648ab323 // bfcvtnt z3.h, p4/M, z25.s\n"
+ ".inst 0x648ab302 // bfcvtnt z2.h, p4/M, z24.s\n"
+ "st1h { z7.h }, p4, [x20, #4, MUL VL]\n"
+ "st1h { z5.h }, p4, [x20, #5, MUL VL]\n"
+ ".inst 0x648ab2e1 // bfcvtnt z1.h, p4/M, z23.s\n"
+ ".inst 0x648ab2c0 // bfcvtnt z0.h, p4/M, z22.s\n"
+ "st1h { z3.h }, p4, [x20, #6, MUL VL]\n"
+ ".inst 0x648ab2bf // bfcvtnt z31.h, p4/M, z21.s\n"
+ ".inst 0x648ab29e // bfcvtnt z30.h, p4/M, z20.s\n"
+ "st1h { z2.h }, p4, [x20, #7, MUL VL]\n"
+ "add x20, x20, %x[out_stride]\n"
+ ".inst 0x648ab27d // bfcvtnt z29.h, p4/M, z19.s\n"
+ ".inst 0x648ab25c // bfcvtnt z28.h, p4/M, z18.s\n"
+ ".inst 0x648ab23b // bfcvtnt z27.h, p4/M, z17.s\n"
+ ".inst 0x648ab21a // bfcvtnt z26.h, p4/M, z16.s\n"
+ "st1h { z1.h }, p4, [x20]\n"
+ "st1h { z0.h }, p4, [x20, #1, MUL VL]\n"
+ "st1h { z31.h }, p4, [x20, #2, MUL VL]\n"
+ "st1h { z30.h }, p4, [x20, #3, MUL VL]\n"
+ "st1h { z29.h }, p4, [x20, #4, MUL VL]\n"
+ "st1h { z28.h }, p4, [x20, #5, MUL VL]\n"
+ "st1h { z27.h }, p4, [x20, #6, MUL VL]\n"
+ "st1h { z26.h }, p4, [x20, #7, MUL VL]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "bge 2b\n"
+ "3:" // Main row loop: Unroll column loop skip
+ "cbz x22, 5f\n"
+ "4:" // Main row loop: Column loop
+ "mov x19, x22\n"
+ "whilelt p3.s, XZR, x19\n"
+ "ld1w { z22.s }, p3/Z, [x25]\n"
+ "ld1w { z21.s }, p3/Z, [x23]\n"
+ "decw x19\n"
+ "whilelt p2.s, XZR, x19\n"
+ "ld1w { z20.s }, p2/Z, [x25, #1, MUL VL]\n"
+ "ld1w { z19.s }, p2/Z, [x23, #1, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p1.s, XZR, x19\n"
+ "ld1w { z18.s }, p1/Z, [x25, #2, MUL VL]\n"
+ "ld1w { z17.s }, p1/Z, [x23, #2, MUL VL]\n"
+ "decw x19\n"
+ "whilelt p0.s, XZR, x19\n"
+ "ld1w { z28.s }, p0/Z, [x25, #3, MUL VL]\n"
+ "ld1w { z16.s }, p0/Z, [x23, #3, MUL VL]\n"
+ "ld1w { z27.s }, p3/Z, [x24]\n"
+ "ld1w { z3.s }, p2/Z, [x24, #1, MUL VL]\n"
+ "zip1 z26.s, z22.s, z21.s\n"
+ "zip2 z25.s, z22.s, z21.s\n"
+ "ld1w { z2.s }, p1/Z, [x24, #2, MUL VL]\n"
+ "ld1w { z1.s }, p0/Z, [x24, #3, MUL VL]\n"
+ "zip1 z24.s, z20.s, z19.s\n"
+ "zip2 z23.s, z20.s, z19.s\n"
+ "ld1w { z22.s }, p3/Z, [x21]\n"
+ "ld1w { z21.s }, p2/Z, [x21, #1, MUL VL]\n"
+ "zip1 z20.s, z18.s, z17.s\n"
+ "zip2 z19.s, z18.s, z17.s\n"
+ "ld1w { z18.s }, p1/Z, [x21, #2, MUL VL]\n"
+ "ld1w { z0.s }, p0/Z, [x21, #3, MUL VL]\n"
+ "zip1 z17.s, z28.s, z16.s\n"
+ "zip2 z16.s, z28.s, z16.s\n"
+ "decd x22, ALL, MUL #8\n"
+ ".inst 0x658ab35f // bfcvt z31.h, p4/M, z26.s\n"
+ "zip1 z30.s, z27.s, z22.s\n"
+ "cmp x22, #0x0\n"
+ ".inst 0x658ab33d // bfcvt z29.h, p4/M, z25.s\n"
+ "zip2 z28.s, z27.s, z22.s\n"
+ "addvl x25, x25, #4\n"
+ "addvl x24, x24, #4\n"
+ ".inst 0x658ab31b // bfcvt z27.h, p4/M, z24.s\n"
+ "zip1 z26.s, z3.s, z21.s\n"
+ "addvl x23, x23, #4\n"
+ "addvl x21, x21, #4\n"
+ ".inst 0x658ab2f9 // bfcvt z25.h, p4/M, z23.s\n"
+ "zip2 z24.s, z3.s, z21.s\n"
+ ".inst 0x658ab297 // bfcvt z23.h, p4/M, z20.s\n"
+ "zip1 z22.s, z2.s, z18.s\n"
+ ".inst 0x658ab275 // bfcvt z21.h, p4/M, z19.s\n"
+ "zip2 z20.s, z2.s, z18.s\n"
+ ".inst 0x658ab233 // bfcvt z19.h, p4/M, z17.s\n"
+ "zip1 z18.s, z1.s, z0.s\n"
+ ".inst 0x658ab211 // bfcvt z17.h, p4/M, z16.s\n"
+ "zip2 z16.s, z1.s, z0.s\n"
+ ".inst 0x648ab3df // bfcvtnt z31.h, p4/M, z30.s\n"
+ ".inst 0x648ab39d // bfcvtnt z29.h, p4/M, z28.s\n"
+ "st1h { z31.h }, p4, [x20]\n"
+ ".inst 0x648ab35b // bfcvtnt z27.h, p4/M, z26.s\n"
+ ".inst 0x648ab319 // bfcvtnt z25.h, p4/M, z24.s\n"
+ "st1h { z29.h }, p4, [x20, #1, MUL VL]\n"
+ ".inst 0x648ab2d7 // bfcvtnt z23.h, p4/M, z22.s\n"
+ ".inst 0x648ab295 // bfcvtnt z21.h, p4/M, z20.s\n"
+ "st1h { z27.h }, p4, [x20, #2, MUL VL]\n"
+ ".inst 0x648ab253 // bfcvtnt z19.h, p4/M, z18.s\n"
+ ".inst 0x648ab211 // bfcvtnt z17.h, p4/M, z16.s\n"
+ "st1h { z25.h }, p4, [x20, #3, MUL VL]\n"
+ "st1h { z23.h }, p4, [x20, #4, MUL VL]\n"
+ "st1h { z21.h }, p4, [x20, #5, MUL VL]\n"
+ "st1h { z19.h }, p4, [x20, #6, MUL VL]\n"
+ "st1h { z17.h }, p4, [x20, #7, MUL VL]\n"
+ "add x20, x20, %x[out_stride]\n"
+ "bgt 4b\n"
+ "5:" // Main row loop: Column loop skip
+ "cmp %x[height], #0x1\n"
+ "addvl %x[out], %x[out], #8\n"
+ "bge 1b\n"
+ : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out)
+ : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width)
+ : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8", "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
+ );
+}
+
+} // anonymous namespace
+template<>
+void Transform<8, 4, true, VLType::SVE>(
+ bfloat16 *out, const float *in, int stride, int x0, int xmax, int k0, int kmax)
+{
+ sve_transpose_interleave_8VL_2x4_fp32bf16(
+ out,
+ in + k0 * stride + x0,
+ (xmax-x0),
+ stride * sizeof(float),
+ (kmax-k0)
+ );
+}
+
+#endif
diff --git a/src/core/NEON/kernels/arm_gemm/transforms/transpose_interleave_common.hpp b/src/core/NEON/kernels/arm_gemm/transforms/transpose_interleave_common.hpp
index a3216c494f..02367bd7e7 100644
--- a/src/core/NEON/kernels/arm_gemm/transforms/transpose_interleave_common.hpp
+++ b/src/core/NEON/kernels/arm_gemm/transforms/transpose_interleave_common.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 Arm Limited.
+ * Copyright (c) 2017-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -58,7 +58,7 @@ struct TransposeInterleaveCommon {
}
}
- static inline void Transform(TOut *out, const TIn *in, const int stride, const int x0, const int xmax, const int k0, const int kmax) {
+ static void Transform(TOut *out, const TIn *in, const int stride, const int x0, const int xmax, const int k0, const int kmax) {
const auto ldin = stride;
TOut *outarray = out;