aboutsummaryrefslogtreecommitdiff
path: root/src/core/NEON/kernels/arm_conv/pooling/kernels/sme_u8q_nhwc_avg_generic_depthfirst/generic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/NEON/kernels/arm_conv/pooling/kernels/sme_u8q_nhwc_avg_generic_depthfirst/generic.cpp')
-rw-r--r--src/core/NEON/kernels/arm_conv/pooling/kernels/sme_u8q_nhwc_avg_generic_depthfirst/generic.cpp155
1 files changed, 77 insertions, 78 deletions
diff --git a/src/core/NEON/kernels/arm_conv/pooling/kernels/sme_u8q_nhwc_avg_generic_depthfirst/generic.cpp b/src/core/NEON/kernels/arm_conv/pooling/kernels/sme_u8q_nhwc_avg_generic_depthfirst/generic.cpp
index a2fe7a301d..8a3cafa2c1 100644
--- a/src/core/NEON/kernels/arm_conv/pooling/kernels/sme_u8q_nhwc_avg_generic_depthfirst/generic.cpp
+++ b/src/core/NEON/kernels/arm_conv/pooling/kernels/sme_u8q_nhwc_avg_generic_depthfirst/generic.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022-2023 Arm Limited.
+ * Copyright (c) 2022 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -86,13 +86,12 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
f_rescale_value *= 2.0f;
}
- int64_t long_rescale_value = round(f_rescale_value * static_cast<float>(1ll << 31));
- if (long_rescale_value == (1ll << 31))
+ rescale_value = static_cast<int32_t>(round(f_rescale_value * static_cast<float>(1ll << 31)));
+ if (static_cast<int64_t>(rescale_value) == (1ll << 31))
{
shift_value++;
- long_rescale_value >>= 1;
+ rescale_value >>= 1;
}
- rescale_value = static_cast<int32_t>(long_rescale_value);
}
@@ -119,24 +118,24 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
__asm__ __volatile__(
".inst 0xd503477f // SMSTART ZA\n"
- "mov x27, #0x0\n"
- "cntb x26\n"
- "cntb x25, ALL, MUL #2\n"
- "cntb x24, ALL, MUL #3\n"
- "whilelt p4.b, x27, %x[n_channels]\n"
- "whilelt p3.b, x26, %x[n_channels]\n"
- "whilelt p2.b, x25, %x[n_channels]\n"
- "whilelt p1.b, x24, %x[n_channels]\n"
+ "mov x26, #0x0\n"
+ "cntb x25\n"
+ "cntb x24, ALL, MUL #2\n"
+ "cntb x23, ALL, MUL #3\n"
+ "whilelt p4.b, x26, %x[n_channels]\n"
+ "whilelt p3.b, x25, %x[n_channels]\n"
+ "whilelt p2.b, x24, %x[n_channels]\n"
+ "whilelt p1.b, x23, %x[n_channels]\n"
"ptrue p0.b\n"
"b.none 7f\n"
"1:" // 4-vectors of channels
"ld1rw { z15.s }, p0/Z, [%x[accumulator_init]]\n"
- "lsr x23, %x[n_valid_cells], #0x1\n"
+ "lsr x22, %x[n_valid_cells], #0x1\n"
"mov z14.d, z15.d\n"
"mov z13.d, z15.d\n"
"mov z12.d, z15.d\n"
"mov z11.d, z15.d\n"
- "mov x20, %x[inptrs]\n"
+ "mov x19, %x[inptrs]\n"
"mov z10.d, z15.d\n"
"mov z9.d, z15.d\n"
"mov z8.d, z15.d\n"
@@ -148,49 +147,49 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
"mov z2.d, z15.d\n"
"mov z1.d, z15.d\n"
"mov z0.d, z15.d\n"
- "cbz x23, 4f\n"
- "ldp x22, x21, [x20, #0x0]\n"
- "subs x23, x23, #0x1\n"
- "add x20, x20, #0x10\n"
- "ld1b { z31.b }, p4/Z, [x22, x27]\n"
- "ld1b { z30.b }, p4/Z, [x21, x27]\n"
- "ld1b { z29.b }, p3/Z, [x22, x26]\n"
- "ld1b { z28.b }, p3/Z, [x21, x26]\n"
- "ld1b { z27.b }, p2/Z, [x22, x25]\n"
- "ld1b { z26.b }, p2/Z, [x21, x25]\n"
- "ld1b { z25.b }, p1/Z, [x22, x24]\n"
- "ld1b { z24.b }, p1/Z, [x21, x24]\n"
+ "cbz x22, 4f\n"
+ "ldp x21, x20, [x19, #0x0]\n"
+ "subs x22, x22, #0x1\n"
+ "add x19, x19, #0x10\n"
+ "ld1b { z31.b }, p4/Z, [x21, x26]\n"
+ "ld1b { z30.b }, p4/Z, [x20, x26]\n"
+ "ld1b { z29.b }, p3/Z, [x21, x25]\n"
+ "ld1b { z28.b }, p3/Z, [x20, x25]\n"
+ "ld1b { z27.b }, p2/Z, [x21, x24]\n"
+ "ld1b { z26.b }, p2/Z, [x20, x24]\n"
+ "ld1b { z25.b }, p1/Z, [x21, x23]\n"
+ "ld1b { z24.b }, p1/Z, [x20, x23]\n"
"beq 3f\n"
"2:" // 4-vectors of channels: 2 inputs loop
".inst 0x455e0bf7 // uaddlb z23.h, z31.b, z30.b\n"
".inst 0x455e0ff6 // uaddlt z22.h, z31.b, z30.b\n"
- "ldp x22, x21, [x20, #0x0]\n"
- "subs x23, x23, #0x1\n"
+ "ldp x21, x20, [x19, #0x0]\n"
+ "subs x22, x22, #0x1\n"
".inst 0x455c0bb5 // uaddlb z21.h, z29.b, z28.b\n"
".inst 0x455c0fb4 // uaddlt z20.h, z29.b, z28.b\n"
- "add x20, x20, #0x10\n"
- "ld1b { z31.b }, p4/Z, [x22, x27]\n"
+ "add x19, x19, #0x10\n"
+ "ld1b { z31.b }, p4/Z, [x21, x26]\n"
".inst 0x455a0b73 // uaddlb z19.h, z27.b, z26.b\n"
".inst 0x455a0f72 // uaddlt z18.h, z27.b, z26.b\n"
- "ld1b { z30.b }, p4/Z, [x21, x27]\n"
+ "ld1b { z30.b }, p4/Z, [x20, x26]\n"
".inst 0x45580b31 // uaddlb z17.h, z25.b, z24.b\n"
".inst 0x45580f30 // uaddlt z16.h, z25.b, z24.b\n"
- "ld1b { z29.b }, p3/Z, [x22, x26]\n"
+ "ld1b { z29.b }, p3/Z, [x21, x25]\n"
".inst 0x459749ef // uaddwb z15.s, z15.s, z23.h\n"
".inst 0x45974dce // uaddwt z14.s, z14.s, z23.h\n"
- "ld1b { z28.b }, p3/Z, [x21, x26]\n"
+ "ld1b { z28.b }, p3/Z, [x20, x25]\n"
".inst 0x459649ad // uaddwb z13.s, z13.s, z22.h\n"
".inst 0x45964d8c // uaddwt z12.s, z12.s, z22.h\n"
- "ld1b { z27.b }, p2/Z, [x22, x25]\n"
+ "ld1b { z27.b }, p2/Z, [x21, x24]\n"
".inst 0x4595496b // uaddwb z11.s, z11.s, z21.h\n"
".inst 0x45954d4a // uaddwt z10.s, z10.s, z21.h\n"
- "ld1b { z26.b }, p2/Z, [x21, x25]\n"
+ "ld1b { z26.b }, p2/Z, [x20, x24]\n"
".inst 0x45944929 // uaddwb z9.s, z9.s, z20.h\n"
".inst 0x45944d08 // uaddwt z8.s, z8.s, z20.h\n"
- "ld1b { z25.b }, p1/Z, [x22, x24]\n"
+ "ld1b { z25.b }, p1/Z, [x21, x23]\n"
".inst 0x459348e7 // uaddwb z7.s, z7.s, z19.h\n"
".inst 0x45934cc6 // uaddwt z6.s, z6.s, z19.h\n"
- "ld1b { z24.b }, p1/Z, [x21, x24]\n"
+ "ld1b { z24.b }, p1/Z, [x20, x23]\n"
".inst 0x459248a5 // uaddwb z5.s, z5.s, z18.h\n"
".inst 0x45924c84 // uaddwt z4.s, z4.s, z18.h\n"
".inst 0x45914863 // uaddwb z3.s, z3.s, z17.h\n"
@@ -224,21 +223,21 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
".inst 0x45904821 // uaddwb z1.s, z1.s, z16.h\n"
".inst 0x45904c00 // uaddwt z0.s, z0.s, z16.h\n"
"4:" // 4-vectors of channels: After loop
- "ands x21, %x[n_valid_cells], #0x1\n"
+ "ands x20, %x[n_valid_cells], #0x1\n"
"beq 6f\n"
"5:" // 4-vectors of channels: Single input loop
- "ldr x22, [x20], #0x8\n"
- "ld1b { z31.b }, p4/Z, [x22, x27]\n"
+ "ldr x21, [x19], #0x8\n"
+ "ld1b { z31.b }, p4/Z, [x21, x26]\n"
".inst 0x4508abf7 // ushllb z23.h, z31.b, #0x0\n"
".inst 0x4508aff6 // ushllt z22.h, z31.b, #0x0\n"
- "ld1b { z29.b }, p3/Z, [x22, x26]\n"
+ "ld1b { z29.b }, p3/Z, [x21, x25]\n"
".inst 0x4508abb5 // ushllb z21.h, z29.b, #0x0\n"
".inst 0x4508afb4 // ushllt z20.h, z29.b, #0x0\n"
- "subs x21, x21, #0x1\n"
- "ld1b { z27.b }, p2/Z, [x22, x25]\n"
+ "subs x20, x20, #0x1\n"
+ "ld1b { z27.b }, p2/Z, [x21, x24]\n"
".inst 0x4508ab73 // ushllb z19.h, z27.b, #0x0\n"
".inst 0x4508af72 // ushllt z18.h, z27.b, #0x0\n"
- "ld1b { z25.b }, p1/Z, [x22, x24]\n"
+ "ld1b { z25.b }, p1/Z, [x21, x23]\n"
".inst 0x4508ab31 // ushllb z17.h, z25.b, #0x0\n"
".inst 0x4508af30 // ushllt z16.h, z25.b, #0x0\n"
".inst 0x459749ef // uaddwb z15.s, z15.s, z23.h\n"
@@ -262,7 +261,7 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
"ld1rw { z19.s }, p0/Z, [%x[left_shift]]\n"
".inst 0x4482826f // srshl z15.s, p0/M, z15.s, z19.s\n"
".inst 0x4482826e // srshl z14.s, p0/M, z14.s, z19.s\n"
- "add x20, %x[quant_params], %[offsetof_qp_output_offset]\n"
+ "add x19, %x[quant_params], %[offsetof_qp_output_offset]\n"
".inst 0x4482826d // srshl z13.s, p0/M, z13.s, z19.s\n"
".inst 0x4482826c // srshl z12.s, p0/M, z12.s, z19.s\n"
"ld1rw { z18.s }, p0/Z, [%x[combined_rescale_value]]\n"
@@ -271,7 +270,7 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
"ld1rw { z17.s }, p0/Z, [%x[right_shift]]\n"
".inst 0x44828269 // srshl z9.s, p0/M, z9.s, z19.s\n"
".inst 0x44828268 // srshl z8.s, p0/M, z8.s, z19.s\n"
- "ld1rw { z16.s }, p0/Z, [x20]\n"
+ "ld1rw { z16.s }, p0/Z, [x19]\n"
".inst 0x44828267 // srshl z7.s, p0/M, z7.s, z19.s\n"
".inst 0x44828266 // srshl z6.s, p0/M, z6.s, z19.s\n"
".inst 0x44828265 // srshl z5.s, p0/M, z5.s, z19.s\n"
@@ -372,47 +371,47 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
"trn1 z19.h, z1.h, z0.h\n"
"trn1 z16.b, z23.b, z16.b\n"
"trn1 z18.b, z22.b, z18.b\n"
- "st1b { z16.b }, p4, [%x[outptr], x27]\n"
- "incb x27, ALL, MUL #4\n"
+ "st1b { z16.b }, p4, [%x[outptr], x26]\n"
+ "incb x26, ALL, MUL #4\n"
"trn1 z17.b, z21.b, z17.b\n"
"trn1 z16.b, z20.b, z19.b\n"
- "st1b { z18.b }, p3, [%x[outptr], x26]\n"
- "incb x26, ALL, MUL #4\n"
- "st1b { z17.b }, p2, [%x[outptr], x25]\n"
+ "st1b { z18.b }, p3, [%x[outptr], x25]\n"
"incb x25, ALL, MUL #4\n"
- "st1b { z16.b }, p1, [%x[outptr], x24]\n"
+ "st1b { z17.b }, p2, [%x[outptr], x24]\n"
"incb x24, ALL, MUL #4\n"
- "whilelt p1.b, x24, %x[n_channels]\n"
+ "st1b { z16.b }, p1, [%x[outptr], x23]\n"
+ "incb x23, ALL, MUL #4\n"
+ "whilelt p1.b, x23, %x[n_channels]\n"
"b.any 1b\n"
"7:" // Single vector of channels
- "whilelt p4.b, x27, %x[n_channels]\n"
+ "whilelt p4.b, x26, %x[n_channels]\n"
"b.none 14f\n"
"8:" // Single vector of channels: Loop
"ld1rw { z15.s }, p0/Z, [%x[accumulator_init]]\n"
- "lsr x23, %x[n_valid_cells], #0x1\n"
+ "lsr x22, %x[n_valid_cells], #0x1\n"
"mov z14.d, z15.d\n"
"mov z13.d, z15.d\n"
"mov z12.d, z15.d\n"
- "mov x20, %x[inptrs]\n"
- "cbz x23, 11f\n"
- "ldp x22, x21, [x20, #0x0]\n"
- "subs x23, x23, #0x1\n"
- "add x20, x20, #0x10\n"
- "ld1b { z31.b }, p4/Z, [x22, x27]\n"
- "ld1b { z30.b }, p4/Z, [x21, x27]\n"
+ "mov x19, %x[inptrs]\n"
+ "cbz x22, 11f\n"
+ "ldp x21, x20, [x19, #0x0]\n"
+ "subs x22, x22, #0x1\n"
+ "add x19, x19, #0x10\n"
+ "ld1b { z31.b }, p4/Z, [x21, x26]\n"
+ "ld1b { z30.b }, p4/Z, [x20, x26]\n"
"beq 10f\n"
"9:" // Single vector of channels: Loop: 2 inputs loop
".inst 0x455e0bf7 // uaddlb z23.h, z31.b, z30.b\n"
".inst 0x455e0ff6 // uaddlt z22.h, z31.b, z30.b\n"
- "ldp x22, x21, [x20, #0x0]\n"
- "subs x23, x23, #0x1\n"
+ "ldp x21, x20, [x19, #0x0]\n"
+ "subs x22, x22, #0x1\n"
".inst 0x459749ef // uaddwb z15.s, z15.s, z23.h\n"
".inst 0x45974dce // uaddwt z14.s, z14.s, z23.h\n"
- "add x20, x20, #0x10\n"
- "ld1b { z31.b }, p4/Z, [x22, x27]\n"
+ "add x19, x19, #0x10\n"
+ "ld1b { z31.b }, p4/Z, [x21, x26]\n"
".inst 0x459649ad // uaddwb z13.s, z13.s, z22.h\n"
".inst 0x45964d8c // uaddwt z12.s, z12.s, z22.h\n"
- "ld1b { z30.b }, p4/Z, [x21, x27]\n"
+ "ld1b { z30.b }, p4/Z, [x20, x26]\n"
"bgt 9b\n"
"10:" // Single vector of channels: Loop: 2 inputs tail
".inst 0x455e0bf7 // uaddlb z23.h, z31.b, z30.b\n"
@@ -422,14 +421,14 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
".inst 0x459649ad // uaddwb z13.s, z13.s, z22.h\n"
".inst 0x45964d8c // uaddwt z12.s, z12.s, z22.h\n"
"11:" // Single vector of channels: Loop: After loop
- "ands x21, %x[n_valid_cells], #0x1\n"
+ "ands x20, %x[n_valid_cells], #0x1\n"
"beq 13f\n"
"12:" // Single vector of channels: Loop: Single input loop
- "ldr x22, [x20], #0x8\n"
- "ld1b { z31.b }, p4/Z, [x22, x27]\n"
+ "ldr x21, [x19], #0x8\n"
+ "ld1b { z31.b }, p4/Z, [x21, x26]\n"
".inst 0x4508abf7 // ushllb z23.h, z31.b, #0x0\n"
".inst 0x4508aff6 // ushllt z22.h, z31.b, #0x0\n"
- "subs x21, x21, #0x1\n"
+ "subs x20, x20, #0x1\n"
".inst 0x459749ef // uaddwb z15.s, z15.s, z23.h\n"
".inst 0x45974dce // uaddwt z14.s, z14.s, z23.h\n"
".inst 0x459649ad // uaddwb z13.s, z13.s, z22.h\n"
@@ -439,7 +438,7 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
"ld1rw { z19.s }, p0/Z, [%x[left_shift]]\n"
".inst 0x4482826f // srshl z15.s, p0/M, z15.s, z19.s\n"
".inst 0x4482826e // srshl z14.s, p0/M, z14.s, z19.s\n"
- "add x20, %x[quant_params], %[offsetof_qp_output_offset]\n"
+ "add x19, %x[quant_params], %[offsetof_qp_output_offset]\n"
".inst 0x4482826d // srshl z13.s, p0/M, z13.s, z19.s\n"
".inst 0x4482826c // srshl z12.s, p0/M, z12.s, z19.s\n"
"ld1rw { z18.s }, p0/Z, [%x[combined_rescale_value]]\n"
@@ -448,7 +447,7 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
"ld1rw { z17.s }, p0/Z, [%x[right_shift]]\n"
".inst 0x04b275ad // sqrdmulh z13.s, z13.s, z18.s\n"
".inst 0x04b2758c // sqrdmulh z12.s, z12.s, z18.s\n"
- "ld1rw { z16.s }, p0/Z, [x20]\n"
+ "ld1rw { z16.s }, p0/Z, [x19]\n"
".inst 0x4482822f // srshl z15.s, p0/M, z15.s, z17.s\n"
".inst 0x4482822e // srshl z14.s, p0/M, z14.s, z17.s\n"
".inst 0x4482822d // srshl z13.s, p0/M, z13.s, z17.s\n"
@@ -470,15 +469,15 @@ void sme_u8q_nhwc_avg_generic_depthfirst_impl(
"smin z12.s, p0/M, z12.s, z19.s\n"
"trn1 z16.h, z13.h, z12.h\n"
"trn1 z16.b, z23.b, z16.b\n"
- "st1b { z16.b }, p4, [%x[outptr], x27]\n"
- "incb x27\n"
- "whilelt p4.b, x27, %x[n_channels]\n"
+ "st1b { z16.b }, p4, [%x[outptr], x26]\n"
+ "incb x26\n"
+ "whilelt p4.b, x26, %x[n_channels]\n"
"b.any 8b\n"
"14:" // End
".inst 0xd503467f // SMSTOP\n"
:
: [accumulator_init] "r" (&accumulator_init), [combined_rescale_value] "r" (&combined_rescale_value), [inptrs] "r" (inptrs), [left_shift] "r" (&left_shift), [n_channels] "r" (n_channels), [n_valid_cells] "r" (n_valid_cells), [offsetof_qp_output_offset] "I" (offsetof(Requantize32, output_offset)), [outptr] "r" (outptr), [quant_params] "r" (&qp), [right_shift] "r" (&right_shift)
- : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", "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"
+ : "cc", "memory", "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "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"
);
}