Frank Barchard c28ebdd357 [libyuv] Rewrite LoongArch LSX/LASX kernels in compact inline asm
Reduce loop unrolling across LoongArch LSX (128-bit) and LASX (256-bit)
row, rotate, and scale kernels to match SSE2/SSSE3 and AVX2 (1-2 vectors
per iteration), rewrite intrinsics/macro implementations into GCC/Clang
inline assembly, update all _Any wrapper masks and IS_ALIGNED dispatch
checks, and port all remaining LSX Convert (+19) and Rotate (+2) kernels
to LASX for full parity:

ISA              | Compare | Convert | Rotate  | Scale
-----------------|---------|---------|---------|--------
MIPS/Loong (Any) |    0    |    68   |    4    |   20
  LSX            |    0    |    68   |    4    |   20
  LASX           |    0    |    68   |    4    |    0

Removes 1,935 macro/helper lines from loongson_intrinsics.h (-99.3%) and
reduces total LoongArch compiled .text size by 9,246 bytes (-24.3%
overall, -36.9% row_lsx.cc, -52.7% scale_lsx.cc, -31.2% rotate_lsx.cc,
-2.8% row_lasx.cc while adding +25 LASX functions):

File               | Before   | After    | Change
-------------------|----------|----------|--------
scale_lsx.cc.o     | 6,102 B  | 2,888 B  | -52.7%
row_lsx.cc.o       | 16,704 B | 10,544 B | -36.9%
rotate_lsx.cc.o    | 1,488 B  | 1,024 B  | -31.2%
row_lasx.cc.o      | 13,168 B | 12,800 B |  -2.8%
rotate_lasx.cc.o   |   544 B  | 1,504 B  | +176.5%
TOTAL .text        | 38,006 B | 28,760 B | -24.3%

R=wtc@google.com, yuanhecai@loongson.cn

Test: qemu-loongarch64 -cpu la464 libyuv_unittest (LASX and LIBYUV_DISABLE_LASX=1)
Change-Id: I11c1143ad2aad0399f10b2c3fc9bc4c02c740c59
2026-10-12 18:39:22 -07:00
..
libyuv [libyuv] Rewrite LoongArch LSX/LASX kernels in compact inline asm 2026-10-12 18:39:22 -07:00
libyuv.h libyuv.h: Add scale_rgb.h and remove scale_row.h 2026-08-26 19:06:22 -07:00