2 * Copyright (c) 2021 Arm Limited.
4 * SPDX-License-Identifier: MIT
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:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
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
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
29 #if defined(__ARM_FEATURE_SVE)
34 void sve_fp32_nhwc_max_2x2_s1_output2x2_depthfirst_impl(
35 const unsigned int n_channels,
36 const float *const *const inptrs,
37 float *const *const outptrs,
38 const bool exclude_padding,
39 const unsigned int pad_left,
40 const unsigned int pad_top,
41 const unsigned int pad_right,
42 const unsigned int pad_bottom
47 const uint64_t n_channels;
48 const float *const *const inptrs;
49 float *const *const outptrs;
51 unsigned int channels,
52 const float *const *input_ptrs,
53 float *const * output_ptrs,
54 bool, unsigned int, unsigned int, unsigned int, unsigned int
55 ) : n_channels(channels),
62 const KernelArgs args(n_channels, inptrs, outptrs, exclude_padding,
63 pad_left, pad_top, pad_right, pad_bottom);
66 "ldr x14, [%x[args], %[offsetof_n_channels]]\n"
68 "ldr x19, [%x[args], %[offsetof_outptrs]]\n"
71 "ldp x11, x10, [x19, #0x0]\n"
72 "whilelt p1.s, x13, x14\n"
73 "ldp x9, x28, [x19, #0x10]\n"
74 "ldr x19, [%x[args], %[offsetof_inptrs]]\n"
75 "ldp x27, x26, [x19, #0x0]\n"
76 "ldp x25, x24, [x19, #0x10]\n"
77 "ldp x23, x22, [x19, #0x20]\n"
78 "ldp x21, x20, [x19, #0x30]\n"
79 "ldr x19, [x19, #0x40]\n"
80 "ld1w { z31.s }, p1/Z, [x26, x13, LSL #2]\n"
81 "ld1w { z30.s }, p1/Z, [x23, x13, LSL #2]\n"
82 "ld1w { z29.s }, p1/Z, [x20, x13, LSL #2]\n"
83 "ld1w { z28.s }, p1/Z, [x24, x13, LSL #2]\n"
84 "ld1w { z27.s }, p1/Z, [x27, x13, LSL #2]\n"
85 "ld1w { z26.s }, p1/Z, [x22, x13, LSL #2]\n"
86 "ld1w { z25.s }, p1/Z, [x25, x13, LSL #2]\n"
87 "ld1w { z24.s }, p1/Z, [x21, x13, LSL #2]\n"
88 "ld1w { z23.s }, p1/Z, [x19, x13, LSL #2]\n"
90 "whilelt p1.s, x13, x14\n"
93 "movprfx z22, z31\n fmax z22.s, p2/M, z22.s, z30.s\n"
94 "ld1w { z31.s }, p1/Z, [x26, x13, LSL #2]\n"
95 "whilelt p0.s, x12, x14\n"
96 "movprfx z21, z30\n fmax z21.s, p2/M, z21.s, z29.s\n"
97 "ld1w { z30.s }, p1/Z, [x23, x13, LSL #2]\n"
98 "movprfx z18, z28\n fmax z18.s, p2/M, z18.s, z27.s\n"
99 "ld1w { z29.s }, p1/Z, [x20, x13, LSL #2]\n"
100 "movprfx z17, z26\n fmax z17.s, p2/M, z17.s, z25.s\n"
101 "ld1w { z27.s }, p1/Z, [x27, x13, LSL #2]\n"
102 "movprfx z16, z24\n fmax z16.s, p2/M, z16.s, z28.s\n"
103 "ld1w { z28.s }, p1/Z, [x24, x13, LSL #2]\n"
104 "movprfx z20, z26\n fmax z20.s, p2/M, z20.s, z23.s\n"
105 "ld1w { z26.s }, p1/Z, [x22, x13, LSL #2]\n"
106 "movprfx z19, z22\n fmax z19.s, p2/M, z19.s, z18.s\n"
107 "ld1w { z25.s }, p1/Z, [x25, x13, LSL #2]\n"
108 "movprfx z18, z22\n fmax z18.s, p2/M, z18.s, z17.s\n"
109 "ld1w { z24.s }, p1/Z, [x21, x13, LSL #2]\n"
110 "movprfx z17, z21\n fmax z17.s, p2/M, z17.s, z16.s\n"
111 "ld1w { z23.s }, p1/Z, [x19, x13, LSL #2]\n"
113 "movprfx z16, z21\n fmax z16.s, p2/M, z16.s, z20.s\n"
114 "st1w { z19.s }, p0, [x11, x12, LSL #2]\n"
115 "whilelt p1.s, x13, x14\n"
116 "st1w { z18.s }, p0, [x10, x12, LSL #2]\n"
117 "st1w { z17.s }, p0, [x9, x12, LSL #2]\n"
118 "st1w { z16.s }, p0, [x28, x12, LSL #2]\n"
122 "movprfx z22, z31\n fmax z22.s, p2/M, z22.s, z30.s\n"
123 "whilelt p0.s, x12, x14\n"
124 "movprfx z21, z30\n fmax z21.s, p2/M, z21.s, z29.s\n"
125 "movprfx z18, z28\n fmax z18.s, p2/M, z18.s, z27.s\n"
126 "movprfx z17, z26\n fmax z17.s, p2/M, z17.s, z25.s\n"
127 "movprfx z16, z24\n fmax z16.s, p2/M, z16.s, z28.s\n"
128 "movprfx z20, z26\n fmax z20.s, p2/M, z20.s, z23.s\n"
129 "movprfx z19, z22\n fmax z19.s, p2/M, z19.s, z18.s\n"
130 "st1w { z19.s }, p0, [x11, x12, LSL #2]\n"
131 "movprfx z18, z22\n fmax z18.s, p2/M, z18.s, z17.s\n"
132 "movprfx z17, z21\n fmax z17.s, p2/M, z17.s, z16.s\n"
133 "st1w { z18.s }, p0, [x10, x12, LSL #2]\n"
134 "movprfx z16, z21\n fmax z16.s, p2/M, z16.s, z20.s\n"
135 "st1w { z17.s }, p0, [x9, x12, LSL #2]\n"
136 "st1w { z16.s }, p0, [x28, x12, LSL #2]\n"
138 : [args] "r" (&args), [offsetof_inptrs] "I" (offsetof(KernelArgs, inptrs)), [offsetof_n_channels] "I" (offsetof(KernelArgs, n_channels)), [offsetof_outptrs] "I" (offsetof(KernelArgs, outptrs))
139 : "cc", "memory", "p0", "p1", "p2", "x9", "x10", "x11", "x12", "x13", "x14", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28", "z16", "z17", "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26", "z27", "z28", "z29", "z30", "z31"
143 } // namespace pooling
144 } // namespace arm_conv
146 #endif // defined(__ARM_FEATURE_SVE)