From 1b7af2e5a912143b789487761c2ba9e8a8622246 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Mon, 17 Aug 2026 13:21:09 -0700 Subject: [PATCH] HalfWidthRow_16To8_SSSE3 fix 32 bit build pmaddwd constant 2 Test: compile for android_x86 (32 bit) Was source/row_gcc.cc:5524:7: error: inline assembly requires more registers than available 5524 | "movd %4,%%xmm2 \n" | ^ Bug: b/547388714 Change-Id: I5aa01516c2fd7e8c37fad72fa044a7e51d7410b8 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8265047 Reviewed-by: richard winterton Reviewed-by: Wan-Teh Chang --- README.chromium | 2 +- include/libyuv/version.h | 2 +- source/row_gcc.cc | 40 +++++++++++++++------------------------- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/README.chromium b/README.chromium index ce06ea2ce..86d9981a1 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: https://chromium.googlesource.com/libyuv/libyuv/ -Version: 1959 +Version: 1960 Revision: DEPS License: BSD-3-Clause License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 8e6470095..97c25657e 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1959 +#define LIBYUV_VERSION 1960 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/row_gcc.cc b/source/row_gcc.cc index e2bcc85b3..37212b2a3 100644 --- a/source/row_gcc.cc +++ b/source/row_gcc.cc @@ -5525,10 +5525,9 @@ void HalfWidthRow_16To8_SSSE3(const uint16_t* src_uv, "punpcklwd %%xmm2,%%xmm2 \n" "pshufd $0x0,%%xmm2,%%xmm2 \n" "pcmpeqw %%xmm5,%%xmm5 \n" + "pcmpeqw %%xmm6,%%xmm6 \n" "psrlw $15,%%xmm5 \n" - "mov $2,%%eax \n" - "movd %%eax,%%xmm6 \n" - "pshufd $0x0,%%xmm6,%%xmm6 \n" + "pmaddwd %%xmm6,%%xmm6 \n" "movdqa %5,%%xmm7 \n" // 8 pixels per loop. @@ -5556,19 +5555,15 @@ void HalfWidthRow_16To8_SSSE3(const uint16_t* src_uv, "packuswb %%xmm0,%%xmm0 \n" "movq %%xmm0,(%1) \n" "add $0x08,%1 \n" - "subl $0x08,%2 \n" + "sub $0x08,%2 \n" "jg 1b \n" : "+r"(src_uv), // %0 "+r"(dst_uv), // %1 -#if defined(__i386__) - "+m"(width) // %2 -#else "+r"(width) // %2 -#endif : "r"(src_uv_stride), // %3 - "r"(scale), // %4 + "rm"(scale), // %4 "m"(kShuffleMaskHalfWidth16To8) // %5 - : "eax", "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"); } #endif // HAS_HALFWIDTHROW_16TO8_SSSE3 @@ -5604,7 +5599,7 @@ void HalfRow_16To8_AVX2(const uint16_t* src_uv, "+r"(dst_uv), // %1 "+r"(width) // %2 : "r"(src_uv_stride), // %3 - "r"(scale) // %4 + "rm"(scale) // %4 : "memory", "cc", "xmm0", "xmm1", "xmm2"); } #endif // HAS_HALFROW_16TO8_AVX2 @@ -5619,10 +5614,8 @@ void HalfWidthRow_16To8_AVX2(const uint16_t* src_uv, "vmovd %4,%%xmm2 \n" "vpbroadcastw %%xmm2,%%ymm2 \n" "vpcmpeqw %%ymm5,%%ymm5,%%ymm5 \n" + "vpmaddwd %%ymm5,%%ymm5,%%ymm6 \n" "vpsrlw $15,%%ymm5,%%ymm5 \n" - "mov $2,%%eax \n" - "vmovd %%eax,%%xmm6 \n" - "vpbroadcastd %%xmm6,%%ymm6 \n" // 16 pixels per loop. LABELALIGN @@ -5656,8 +5649,8 @@ void HalfWidthRow_16To8_AVX2(const uint16_t* src_uv, "+r"(dst_uv), // %1 "+r"(width) // %2 : "r"(src_uv_stride), // %3 - "r"(scale) // %4 - : "eax", "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", + "rm"(scale) // %4 + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6"); } #endif // HAS_HALFWIDTHROW_16TO8_AVX2 @@ -5694,7 +5687,7 @@ void HalfRow_16To8_AVX512BW(const uint16_t* src_uv, "+r"(src_uv1), // %1 "+r"(dst_uv), // %2 "+r"(width) // %3 - : "r"(shift) // %4 + : "rm"(shift) // %4 : "memory", "cc", "xmm0", "xmm1", "xmm2"); } #endif // HAS_HALFROW_16TO8_AVX512BW @@ -5708,12 +5701,9 @@ void HalfWidthRow_16To8_AVX512BW(const uint16_t* src_uv, const uint16_t* src_uv1 = src_uv + src_uv_stride; asm volatile( "vpbroadcastw %4,%%zmm2 \n" - "mov $1,%%eax \n" - "vmovd %%eax,%%xmm5 \n" - "vpbroadcastw %%xmm5,%%zmm5 \n" - "mov $2,%%eax \n" - "vmovd %%eax,%%xmm6 \n" - "vpbroadcastd %%xmm6,%%zmm6 \n" + "vpternlogd $0xff,%%zmm5,%%zmm5,%%zmm5 \n" + "vpmaddwd %%zmm5,%%zmm5,%%zmm6 \n" + "vpabsw %%zmm5,%%zmm5 \n" // 32 pixels per loop. LABELALIGN @@ -5747,8 +5737,8 @@ void HalfWidthRow_16To8_AVX512BW(const uint16_t* src_uv, "+r"(src_uv1), // %1 "+r"(dst_uv), // %2 "+r"(width) // %3 - : "r"(scale) // %4 - : "eax", "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", + : "rm"(scale) // %4 + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6"); } #endif // HAS_HALFWIDTHROW_16TO8_AVX512BW