Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 1 | /* |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 2 | * Copyright (c) 2021, 2023 Arm Limited. |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 23 | */ |
| 24 | |
| 25 | #pragma once |
| 26 | |
Michael Tyler | 74921ee | 2023-04-12 17:43:17 +0100 | [diff] [blame^] | 27 | #if defined(ARM_COMPUTE_ENABLE_SVE) |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 28 | |
| 29 | namespace { |
| 30 | |
| 31 | void sve_transpose_interleave_12VL_2x4_fp32bf16(bfloat16 *out, const float *in, size_t width, size_t in_stride, size_t height) |
| 32 | { |
| 33 | float *pad_row = reinterpret_cast<float *>(alloca(width * sizeof(float))); |
| 34 | |
| 35 | if (height % 4) { |
| 36 | memset(pad_row, 0, width * sizeof(float)); |
| 37 | } |
| 38 | |
| 39 | size_t out_stride = 12 * roundup<size_t>(height, 4) * get_vector_length<uint32_t>(); |
| 40 | |
| 41 | __asm__ __volatile__( |
| 42 | "ptrue p6.b\n" |
| 43 | "1:" // Main row loop: Head |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 44 | "mov x28, %x[in]\n" |
| 45 | "add x27, x28, %x[in_stride]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 46 | "add x26, x27, %x[in_stride]\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 47 | "mov x25, %x[width]\n" |
| 48 | "cnth x24, ALL, MUL #6\n" |
| 49 | "add x23, x26, %x[in_stride]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 50 | "cmp %x[height], #0x3\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 51 | "add %x[in], x23, %x[in_stride]\n" |
| 52 | "csel x23, x23, %x[pad_row], GT\n" |
| 53 | "csel x26, x26, %x[pad_row], GE\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 54 | "cmp %x[height], #0x1\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 55 | "csel x27, x27, %x[pad_row], GT\n" |
| 56 | "cmp x25, x24\n" |
| 57 | "mov x22, %x[out]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 58 | "sub %x[height], %x[height], #0x4\n" |
| 59 | "blt 3f\n" |
| 60 | "2:" // Main row loop: Unroll column loop |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 61 | "ld1w { z22.s }, p6/Z, [x28]\n" |
| 62 | "ld1w { z7.s }, p6/Z, [x28, #1, MUL VL]\n" |
| 63 | "mov x21, x22\n" |
| 64 | "add x22, x22, %x[out_stride]\n" |
| 65 | "ld1w { z19.s }, p6/Z, [x28, #2, MUL VL]\n" |
| 66 | "ld1w { z18.s }, p6/Z, [x28, #3, MUL VL]\n" |
| 67 | "mov x20, x22\n" |
| 68 | "sub x25, x25, x24\n" |
| 69 | "ld1w { z5.s }, p6/Z, [x28, #4, MUL VL]\n" |
| 70 | "ld1w { z25.s }, p6/Z, [x28, #5, MUL VL]\n" |
| 71 | "cmp x25, x24\n" |
| 72 | "add x22, x22, %x[out_stride]\n" |
| 73 | "ld1w { z20.s }, p6/Z, [x28, #6, MUL VL]\n" |
| 74 | "ld1w { z23.s }, p6/Z, [x28, #7, MUL VL]\n" |
| 75 | "addvl x28, x28, #12\n" |
| 76 | "ld1w { z4.s }, p6/Z, [x26]\n" |
| 77 | "ld1w { z10.s }, p6/Z, [x26, #1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 78 | "zip1 z14.s, z22.s, z4.s\n" |
| 79 | "zip2 z22.s, z22.s, z4.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 80 | "ld1w { z28.s }, p6/Z, [x26, #2, MUL VL]\n" |
| 81 | "ld1w { z27.s }, p6/Z, [x26, #3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 82 | "zip1 z24.s, z7.s, z10.s\n" |
| 83 | "zip2 z15.s, z7.s, z10.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 84 | "ld1w { z7.s }, p6/Z, [x26, #4, MUL VL]\n" |
| 85 | "ld1w { z2.s }, p6/Z, [x26, #5, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 86 | "zip1 z9.s, z19.s, z28.s\n" |
| 87 | "zip2 z0.s, z19.s, z28.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 88 | "ld1w { z19.s }, p6/Z, [x26, #6, MUL VL]\n" |
| 89 | "ld1w { z16.s }, p6/Z, [x26, #7, MUL VL]\n" |
| 90 | "addvl x26, x26, #12\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 91 | "zip1 z1.s, z18.s, z27.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 92 | "ld1w { z30.s }, p6/Z, [x28, #-4, MUL VL]\n" |
| 93 | "ld1w { z29.s }, p6/Z, [x28, #-3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 94 | "zip2 z17.s, z18.s, z27.s\n" |
| 95 | ".inst 0x658ab9d5 // bfcvt z21.h, p6/M, z14.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 96 | "ld1w { z31.s }, p6/Z, [x27]\n" |
| 97 | "ld1w { z8.s }, p6/Z, [x27, #1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 98 | ".inst 0x658abacc // bfcvt z12.h, p6/M, z22.s\n" |
| 99 | ".inst 0x658abb0e // bfcvt z14.h, p6/M, z24.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 100 | "ld1w { z22.s }, p6/Z, [x27, #2, MUL VL]\n" |
| 101 | "ld1w { z28.s }, p6/Z, [x27, #3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 102 | ".inst 0x658ab9ea // bfcvt z10.h, p6/M, z15.s\n" |
| 103 | ".inst 0x658ab92f // bfcvt z15.h, p6/M, z9.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 104 | "ld1w { z27.s }, p6/Z, [x27, #4, MUL VL]\n" |
| 105 | "ld1w { z13.s }, p6/Z, [x27, #5, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 106 | ".inst 0x658ab803 // bfcvt z3.h, p6/M, z0.s\n" |
| 107 | ".inst 0x658ab832 // bfcvt z18.h, p6/M, z1.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 108 | "ld1w { z26.s }, p6/Z, [x27, #6, MUL VL]\n" |
| 109 | "ld1w { z9.s }, p6/Z, [x27, #7, MUL VL]\n" |
| 110 | "addvl x27, x27, #12\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 111 | ".inst 0x658aba26 // bfcvt z6.h, p6/M, z17.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 112 | "ld1w { z1.s }, p6/Z, [x26, #-4, MUL VL]\n" |
| 113 | "ld1w { z0.s }, p6/Z, [x26, #-3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 114 | "zip1 z17.s, z5.s, z7.s\n" |
| 115 | "zip2 z5.s, z5.s, z7.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 116 | "ld1w { z24.s }, p6/Z, [x23]\n" |
| 117 | "ld1w { z11.s }, p6/Z, [x23, #1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 118 | "zip1 z7.s, z31.s, z24.s\n" |
| 119 | "zip2 z31.s, z31.s, z24.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 120 | "ld1w { z4.s }, p6/Z, [x23, #2, MUL VL]\n" |
| 121 | "ld1w { z24.s }, p6/Z, [x23, #3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 122 | ".inst 0x648ab8f5 // bfcvtnt z21.h, p6/M, z7.s\n" |
| 123 | "zip1 z7.s, z8.s, z11.s\n" |
| 124 | "zip2 z11.s, z8.s, z11.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 125 | "ld1w { z8.s }, p6/Z, [x23, #4, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 126 | ".inst 0x648abbec // bfcvtnt z12.h, p6/M, z31.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 127 | "ld1w { z31.s }, p6/Z, [x23, #5, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 128 | ".inst 0x648ab8ee // bfcvtnt z14.h, p6/M, z7.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 129 | "ld1w { z7.s }, p6/Z, [x23, #6, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 130 | ".inst 0x648ab96a // bfcvtnt z10.h, p6/M, z11.s\n" |
| 131 | "zip1 z11.s, z22.s, z4.s\n" |
| 132 | "zip2 z4.s, z22.s, z4.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 133 | "ld1w { z22.s }, p6/Z, [x23, #7, MUL VL]\n" |
| 134 | "addvl x23, x23, #12\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 135 | ".inst 0x648ab96f // bfcvtnt z15.h, p6/M, z11.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 136 | "ld1w { z11.s }, p6/Z, [x28, #-2, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 137 | ".inst 0x648ab883 // bfcvtnt z3.h, p6/M, z4.s\n" |
| 138 | "zip1 z4.s, z28.s, z24.s\n" |
| 139 | "zip2 z24.s, z28.s, z24.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 140 | "ld1w { z28.s }, p6/Z, [x28, #-1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 141 | ".inst 0x648ab892 // bfcvtnt z18.h, p6/M, z4.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 142 | "ld1w { z4.s }, p6/Z, [x27, #-4, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 143 | ".inst 0x648abb06 // bfcvtnt z6.h, p6/M, z24.s\n" |
| 144 | "zip1 z24.s, z25.s, z2.s\n" |
| 145 | "zip2 z25.s, z25.s, z2.s\n" |
| 146 | "zip1 z2.s, z20.s, z19.s\n" |
| 147 | "zip2 z20.s, z20.s, z19.s\n" |
| 148 | "zip1 z19.s, z23.s, z16.s\n" |
| 149 | "zip2 z16.s, z23.s, z16.s\n" |
| 150 | "zip1 z23.s, z30.s, z1.s\n" |
| 151 | "zip2 z30.s, z30.s, z1.s\n" |
| 152 | "zip1 z1.s, z29.s, z0.s\n" |
| 153 | "zip2 z0.s, z29.s, z0.s\n" |
| 154 | ".inst 0x658aba31 // bfcvt z17.h, p6/M, z17.s\n" |
| 155 | "zip1 z29.s, z27.s, z8.s\n" |
| 156 | ".inst 0x658ab8a5 // bfcvt z5.h, p6/M, z5.s\n" |
| 157 | "zip2 z27.s, z27.s, z8.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 158 | "ld1w { z8.s }, p6/Z, [x27, #-3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 159 | ".inst 0x658abb18 // bfcvt z24.h, p6/M, z24.s\n" |
| 160 | ".inst 0x658abb39 // bfcvt z25.h, p6/M, z25.s\n" |
| 161 | ".inst 0x658ab842 // bfcvt z2.h, p6/M, z2.s\n" |
| 162 | ".inst 0x658aba94 // bfcvt z20.h, p6/M, z20.s\n" |
| 163 | ".inst 0x658aba73 // bfcvt z19.h, p6/M, z19.s\n" |
| 164 | ".inst 0x658aba10 // bfcvt z16.h, p6/M, z16.s\n" |
| 165 | ".inst 0x658abaf7 // bfcvt z23.h, p6/M, z23.s\n" |
| 166 | ".inst 0x658abbde // bfcvt z30.h, p6/M, z30.s\n" |
| 167 | ".inst 0x658ab821 // bfcvt z1.h, p6/M, z1.s\n" |
| 168 | ".inst 0x658ab800 // bfcvt z0.h, p6/M, z0.s\n" |
| 169 | ".inst 0x648abbb1 // bfcvtnt z17.h, p6/M, z29.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 170 | "ld1w { z29.s }, p6/Z, [x26, #-2, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 171 | ".inst 0x648abb65 // bfcvtnt z5.h, p6/M, z27.s\n" |
| 172 | "zip1 z27.s, z13.s, z31.s\n" |
| 173 | "zip2 z31.s, z13.s, z31.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 174 | "ld1w { z13.s }, p6/Z, [x26, #-1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 175 | ".inst 0x648abb78 // bfcvtnt z24.h, p6/M, z27.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 176 | "ld1w { z27.s }, p6/Z, [x23, #-4, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 177 | ".inst 0x648abbf9 // bfcvtnt z25.h, p6/M, z31.s\n" |
| 178 | "zip1 z31.s, z26.s, z7.s\n" |
| 179 | "zip2 z26.s, z26.s, z7.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 180 | "ld1w { z7.s }, p6/Z, [x23, #-3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 181 | ".inst 0x648abbe2 // bfcvtnt z2.h, p6/M, z31.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 182 | "ld1w { z31.s }, p6/Z, [x27, #-2, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 183 | ".inst 0x648abb54 // bfcvtnt z20.h, p6/M, z26.s\n" |
| 184 | "zip1 z26.s, z9.s, z22.s\n" |
| 185 | "zip2 z9.s, z9.s, z22.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 186 | "ld1w { z22.s }, p6/Z, [x27, #-1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 187 | ".inst 0x648abb53 // bfcvtnt z19.h, p6/M, z26.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 188 | "ld1w { z26.s }, p6/Z, [x23, #-2, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 189 | ".inst 0x648ab930 // bfcvtnt z16.h, p6/M, z9.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 190 | "ld1w { z9.s }, p6/Z, [x23, #-1, MUL VL]\n" |
| 191 | "st1h { z21.h }, p6, [x21]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 192 | "zip1 z21.s, z4.s, z27.s\n" |
| 193 | "zip2 z27.s, z4.s, z27.s\n" |
| 194 | "zip1 z4.s, z8.s, z7.s\n" |
| 195 | "zip2 z8.s, z8.s, z7.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 196 | "st1h { z12.h }, p6, [x21, #1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 197 | "zip1 z7.s, z11.s, z29.s\n" |
| 198 | "zip2 z11.s, z11.s, z29.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 199 | "st1h { z14.h }, p6, [x21, #2, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 200 | "zip1 z29.s, z28.s, z13.s\n" |
| 201 | "zip2 z12.s, z28.s, z13.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 202 | "st1h { z10.h }, p6, [x21, #3, MUL VL]\n" |
| 203 | "st1h { z15.h }, p6, [x21, #4, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 204 | ".inst 0x648abab7 // bfcvtnt z23.h, p6/M, z21.s\n" |
| 205 | ".inst 0x648abb7e // bfcvtnt z30.h, p6/M, z27.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 206 | "st1h { z3.h }, p6, [x21, #5, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 207 | ".inst 0x648ab881 // bfcvtnt z1.h, p6/M, z4.s\n" |
| 208 | ".inst 0x648ab900 // bfcvtnt z0.h, p6/M, z8.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 209 | "st1h { z18.h }, p6, [x21, #6, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 210 | ".inst 0x658ab8e8 // bfcvt z8.h, p6/M, z7.s\n" |
| 211 | "zip1 z27.s, z31.s, z26.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 212 | "st1h { z6.h }, p6, [x21, #7, MUL VL]\n" |
| 213 | "addvl x21, x21, #12\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 214 | ".inst 0x658ab96e // bfcvt z14.h, p6/M, z11.s\n" |
| 215 | "zip2 z28.s, z31.s, z26.s\n" |
| 216 | ".inst 0x658abbbd // bfcvt z29.h, p6/M, z29.s\n" |
| 217 | "zip1 z21.s, z22.s, z9.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 218 | "st1h { z17.h }, p6, [x21, #-4, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 219 | ".inst 0x658ab992 // bfcvt z18.h, p6/M, z12.s\n" |
| 220 | "zip2 z17.s, z22.s, z9.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 221 | "st1h { z5.h }, p6, [x21, #-3, MUL VL]\n" |
| 222 | "st1h { z24.h }, p6, [x21, #-2, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 223 | ".inst 0x648abb68 // bfcvtnt z8.h, p6/M, z27.s\n" |
| 224 | ".inst 0x648abb8e // bfcvtnt z14.h, p6/M, z28.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 225 | "st1h { z25.h }, p6, [x21, #-1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 226 | ".inst 0x648ababd // bfcvtnt z29.h, p6/M, z21.s\n" |
| 227 | ".inst 0x648aba32 // bfcvtnt z18.h, p6/M, z17.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 228 | "st1h { z2.h }, p6, [x20]\n" |
| 229 | "st1h { z20.h }, p6, [x20, #1, MUL VL]\n" |
| 230 | "st1h { z19.h }, p6, [x20, #2, MUL VL]\n" |
| 231 | "st1h { z16.h }, p6, [x20, #3, MUL VL]\n" |
| 232 | "st1h { z23.h }, p6, [x20, #4, MUL VL]\n" |
| 233 | "st1h { z30.h }, p6, [x20, #5, MUL VL]\n" |
| 234 | "st1h { z1.h }, p6, [x20, #6, MUL VL]\n" |
| 235 | "st1h { z0.h }, p6, [x20, #7, MUL VL]\n" |
| 236 | "addvl x20, x20, #12\n" |
| 237 | "st1h { z8.h }, p6, [x20, #-4, MUL VL]\n" |
| 238 | "st1h { z14.h }, p6, [x20, #-3, MUL VL]\n" |
| 239 | "st1h { z29.h }, p6, [x20, #-2, MUL VL]\n" |
| 240 | "st1h { z18.h }, p6, [x20, #-1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 241 | "bge 2b\n" |
| 242 | "3:" // Main row loop: Unroll column loop skip |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 243 | "cbz x25, 5f\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 244 | "4:" // Main row loop: Column loop |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 245 | "mov x20, x25\n" |
| 246 | "whilelt p5.s, XZR, x20\n" |
| 247 | "ld1w { z22.s }, p5/Z, [x28]\n" |
| 248 | "ld1w { z21.s }, p5/Z, [x26]\n" |
| 249 | "decw x20\n" |
| 250 | "whilelt p4.s, XZR, x20\n" |
| 251 | "ld1w { z20.s }, p4/Z, [x28, #1, MUL VL]\n" |
| 252 | "ld1w { z19.s }, p4/Z, [x26, #1, MUL VL]\n" |
| 253 | "decw x20\n" |
| 254 | "whilelt p3.s, XZR, x20\n" |
| 255 | "ld1w { z18.s }, p3/Z, [x28, #2, MUL VL]\n" |
| 256 | "ld1w { z17.s }, p3/Z, [x26, #2, MUL VL]\n" |
| 257 | "decw x20\n" |
| 258 | "whilelt p2.s, XZR, x20\n" |
| 259 | "ld1w { z30.s }, p2/Z, [x28, #3, MUL VL]\n" |
| 260 | "ld1w { z16.s }, p2/Z, [x26, #3, MUL VL]\n" |
| 261 | "decw x20\n" |
| 262 | "whilelt p1.s, XZR, x20\n" |
| 263 | "ld1w { z13.s }, p1/Z, [x28, #4, MUL VL]\n" |
| 264 | "ld1w { z29.s }, p5/Z, [x27]\n" |
| 265 | "decw x20\n" |
| 266 | "whilelt p0.s, XZR, x20\n" |
| 267 | "ld1w { z12.s }, p0/Z, [x28, #5, MUL VL]\n" |
| 268 | "ld1w { z28.s }, p4/Z, [x27, #1, MUL VL]\n" |
| 269 | "ld1w { z11.s }, p3/Z, [x27, #2, MUL VL]\n" |
| 270 | "ld1w { z10.s }, p2/Z, [x27, #3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 271 | "zip1 z27.s, z22.s, z21.s\n" |
| 272 | "zip2 z26.s, z22.s, z21.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 273 | "ld1w { z9.s }, p1/Z, [x26, #4, MUL VL]\n" |
| 274 | "ld1w { z8.s }, p0/Z, [x26, #5, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 275 | "zip1 z25.s, z20.s, z19.s\n" |
| 276 | "zip2 z24.s, z20.s, z19.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 277 | "ld1w { z23.s }, p5/Z, [x23]\n" |
| 278 | "ld1w { z22.s }, p4/Z, [x23, #1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 279 | "zip1 z21.s, z18.s, z17.s\n" |
| 280 | "zip2 z20.s, z18.s, z17.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 281 | "ld1w { z19.s }, p3/Z, [x23, #2, MUL VL]\n" |
| 282 | "ld1w { z18.s }, p2/Z, [x23, #3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 283 | "zip1 z17.s, z30.s, z16.s\n" |
| 284 | "zip2 z16.s, z30.s, z16.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 285 | "ld1w { z7.s }, p1/Z, [x27, #4, MUL VL]\n" |
| 286 | "ld1w { z6.s }, p0/Z, [x27, #5, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 287 | ".inst 0x658abb65 // bfcvt z5.h, p6/M, z27.s\n" |
| 288 | "zip1 z4.s, z29.s, z23.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 289 | "ld1w { z3.s }, p1/Z, [x23, #4, MUL VL]\n" |
| 290 | "ld1w { z2.s }, p0/Z, [x23, #5, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 291 | ".inst 0x658abb41 // bfcvt z1.h, p6/M, z26.s\n" |
| 292 | "zip2 z0.s, z29.s, z23.s\n" |
| 293 | ".inst 0x658abb3f // bfcvt z31.h, p6/M, z25.s\n" |
| 294 | "zip1 z30.s, z28.s, z22.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 295 | "mov x20, x22\n" |
| 296 | "decd x25, ALL, MUL #12\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 297 | ".inst 0x658abb1d // bfcvt z29.h, p6/M, z24.s\n" |
| 298 | "zip2 z28.s, z28.s, z22.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 299 | "cmp x25, #0x0\n" |
| 300 | "addvl x28, x28, #6\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 301 | ".inst 0x658ababb // bfcvt z27.h, p6/M, z21.s\n" |
| 302 | "zip1 z23.s, z11.s, z19.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 303 | "addvl x27, x27, #6\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 304 | "addvl x26, x26, #6\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 305 | ".inst 0x658aba9a // bfcvt z26.h, p6/M, z20.s\n" |
| 306 | "zip2 z22.s, z11.s, z19.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 307 | "addvl x23, x23, #6\n" |
| 308 | "add x22, x22, %x[out_stride]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 309 | ".inst 0x658aba39 // bfcvt z25.h, p6/M, z17.s\n" |
| 310 | "zip1 z21.s, z10.s, z18.s\n" |
| 311 | ".inst 0x658aba18 // bfcvt z24.h, p6/M, z16.s\n" |
| 312 | "zip2 z20.s, z10.s, z18.s\n" |
| 313 | "zip1 z19.s, z13.s, z9.s\n" |
| 314 | "zip2 z18.s, z13.s, z9.s\n" |
| 315 | "zip1 z17.s, z12.s, z8.s\n" |
| 316 | "zip2 z16.s, z12.s, z8.s\n" |
| 317 | ".inst 0x648ab885 // bfcvtnt z5.h, p6/M, z4.s\n" |
| 318 | ".inst 0x648ab801 // bfcvtnt z1.h, p6/M, z0.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 319 | "st1h { z5.h }, p6, [x20]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 320 | ".inst 0x648abbdf // bfcvtnt z31.h, p6/M, z30.s\n" |
| 321 | ".inst 0x648abb9d // bfcvtnt z29.h, p6/M, z28.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 322 | "st1h { z1.h }, p6, [x20, #1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 323 | ".inst 0x648abafb // bfcvtnt z27.h, p6/M, z23.s\n" |
| 324 | ".inst 0x648abada // bfcvtnt z26.h, p6/M, z22.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 325 | "st1h { z31.h }, p6, [x20, #2, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 326 | ".inst 0x648abab9 // bfcvtnt z25.h, p6/M, z21.s\n" |
| 327 | ".inst 0x648aba98 // bfcvtnt z24.h, p6/M, z20.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 328 | "st1h { z29.h }, p6, [x20, #3, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 329 | ".inst 0x658aba77 // bfcvt z23.h, p6/M, z19.s\n" |
| 330 | "zip1 z22.s, z7.s, z3.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 331 | "st1h { z27.h }, p6, [x20, #4, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 332 | ".inst 0x658aba55 // bfcvt z21.h, p6/M, z18.s\n" |
| 333 | "zip2 z20.s, z7.s, z3.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 334 | "st1h { z26.h }, p6, [x20, #5, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 335 | ".inst 0x658aba33 // bfcvt z19.h, p6/M, z17.s\n" |
| 336 | "zip1 z18.s, z6.s, z2.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 337 | "st1h { z25.h }, p6, [x20, #6, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 338 | ".inst 0x658aba11 // bfcvt z17.h, p6/M, z16.s\n" |
| 339 | "zip2 z16.s, z6.s, z2.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 340 | "st1h { z24.h }, p6, [x20, #7, MUL VL]\n" |
| 341 | "addvl x20, x20, #12\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 342 | ".inst 0x648abad7 // bfcvtnt z23.h, p6/M, z22.s\n" |
| 343 | ".inst 0x648aba95 // bfcvtnt z21.h, p6/M, z20.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 344 | "st1h { z23.h }, p6, [x20, #-4, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 345 | ".inst 0x648aba53 // bfcvtnt z19.h, p6/M, z18.s\n" |
| 346 | ".inst 0x648aba11 // bfcvtnt z17.h, p6/M, z16.s\n" |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 347 | "st1h { z21.h }, p6, [x20, #-3, MUL VL]\n" |
| 348 | "st1h { z19.h }, p6, [x20, #-2, MUL VL]\n" |
| 349 | "st1h { z17.h }, p6, [x20, #-1, MUL VL]\n" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 350 | "bgt 4b\n" |
| 351 | "5:" // Main row loop: Column loop skip |
| 352 | "cmp %x[height], #0x1\n" |
| 353 | "addvl %x[out], %x[out], #12\n" |
| 354 | "bge 1b\n" |
| 355 | : [height] "+&r" (height), [in] "+&r" (in), [out] "+&r" (out) |
| 356 | : [in_stride] "r" (in_stride), [out_stride] "r" (out_stride), [pad_row] "r" (pad_row), [width] "r" (width) |
Michael Tyler | 7d9a626 | 2023-02-01 16:37:07 +0000 | [diff] [blame] | 357 | : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "p5", "p6", "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" |
Georgios Pinitas | 4ee8b15 | 2021-07-16 16:16:43 +0100 | [diff] [blame] | 358 | ); |
| 359 | } |
| 360 | |
| 361 | } // anonymous namespace |
| 362 | template<> |
| 363 | void Transform<12, 4, true, VLType::SVE>( |
| 364 | bfloat16 *out, const float *in, int stride, int x0, int xmax, int k0, int kmax) |
| 365 | { |
| 366 | sve_transpose_interleave_12VL_2x4_fp32bf16( |
| 367 | out, |
| 368 | in + k0 * stride + x0, |
| 369 | (xmax-x0), |
| 370 | stride * sizeof(float), |
| 371 | (kmax-k0) |
| 372 | ); |
| 373 | } |
| 374 | |
Michael Tyler | 74921ee | 2023-04-12 17:43:17 +0100 | [diff] [blame^] | 375 | |
| 376 | #endif // defined(ARM_COMPUTE_ENABLE_SVE) |