Use UDOT for V8QI sad when dot product is available
Uses the UDOT instruction for V8QI SAD on targets with dot product support, improving performance.
This commit enables the use of the UDOT instruction for calculating the absolute difference (SAD) of 8-byte vectors (V8QI) on AArch64 targets that support dot products. The SAD can now be lowered into two instructions: UABD/SABD to compute lane-wise differences, followed by a UDOT instruction. This UDOT effectively accumulates the results from the eight byte lanes into a V2SI vector, leveraging the dot product hardware for better performance.
In Details
On AArch64 targets with TARGET_DOTPROD, the sadv8qi (sum of absolute differences for 8-byte vectors) can be lowered using UABD/SABD to compute lane-wise differences into a temporary V8QI vector, followed by a UDOT instruction. This UDOT instruction accumulates the eight byte lanes into a V2SI result by multiplying with a vector of all-ones. This applies to both signed and unsigned variants of SAD.
- UDOT
- AArch64 SIMD instruction that performs a dot product operation on vectors. It's used here to accumulate results from multiple lanes.
- V8QI
- A Neon/SIMD data type representing a vector of 8 bytes (64 bits).
- V2SI
- A Neon/SIMD data type representing a vector of 2 single-precision integers (2x32 bits).
- SAD
- Sum of Absolute Differences. A common operation in image and signal processing, used here to compare vectors.
- TARGET_DOTPROD
- A GCC target specific macro indicating that the target architecture supports the dot product SIMD instructions.