[AArch64] Add missing clobber, fix zero-init for compare kernels

The "memory" clobber needs to be present even if the asm does not store
anything to memory, since otherwise the compiler would be allowed to
reorder earlier stores to the pointers after they would be needed by the
asm.

Also fix up the zero-initialisation of accumulators in
SumSquareError_NEON, since EOR'ing a register by itself is not a
recognised zeroing idiom on most AArch64 micro-architectures.

Bug: libyuv:976
Change-Id: I3175367abf6f59db8371b4478f1156950277d7c5
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5378705
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
George Steed 2024-03-18 10:12:16 +00:00 committed by Frank Barchard
parent ba0bba5b2b
commit 73f6e82b1a

View File

@ -47,7 +47,7 @@ uint32_t HammingDistance_NEON(const uint8_t* src_a,
"fmov %w3, s4 \n"
: "+r"(src_a), "+r"(src_b), "+r"(count), "=r"(diff)
:
: "cc", "v0", "v1", "v2", "v3", "v4");
: "memory", "cc", "v0", "v1", "v2", "v3", "v4");
return diff;
}
@ -56,10 +56,10 @@ uint32_t SumSquareError_NEON(const uint8_t* src_a,
int count) {
uint32_t sse;
asm volatile(
"eor v16.16b, v16.16b, v16.16b \n"
"eor v18.16b, v18.16b, v18.16b \n"
"eor v17.16b, v17.16b, v17.16b \n"
"eor v19.16b, v19.16b, v19.16b \n"
"movi v16.16b, #0 \n"
"movi v17.16b, #0 \n"
"movi v18.16b, #0 \n"
"movi v19.16b, #0 \n"
"1: \n"
"ld1 {v0.16b}, [%0], #16 \n"
@ -82,7 +82,7 @@ uint32_t SumSquareError_NEON(const uint8_t* src_a,
"fmov %w3, s0 \n"
: "+r"(src_a), "+r"(src_b), "+r"(count), "=r"(sse)
:
: "cc", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19");
: "memory", "cc", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19");
return sse;
}