From 8d7ed8af356a2a2b3feab24c501769705fdae989 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Thu, 20 Aug 2026 20:14:23 -0700 Subject: [PATCH] Fix undeclared register clobbers in x86 and NEON assembly List of affected functions: - ARGBToAB64Row_SSSE3 (row_gcc.cc): add xmm3 clobber - ARGBToAB64Row_AVX2 (row_gcc.cc): add xmm3 clobber - ARGBToAB64Row_NEON (row_neon64.cc): add v5, v6, v7 clobbers - ARGBToUV444MatrixRow_NEON (row_neon.cc): add q13 clobber - ARGBSepiaRow_NEON_DotProd (row_neon64.cc): add v23 clobber - I422ToRGB24Row_NEON (row_neon.cc): remove dead d6 mutation - I422ToRGB565Row_NEON (row_neon.cc): remove dead d6 mutation - MergeAR64Row_NEON (row_neon.cc, row_neon64.cc): add q14, v30 clobbers - MergeXR30Row_AVX2 (row_gcc.cc): add xmm6 clobber - MergeXR64Row_NEON (row_neon.cc, row_neon64.cc): add q14, v30 clobbers - NV12ToRGB24Row_NEON (row_neon.cc): remove dead d6 mutation - NV12ToRGB565Row_NEON (row_neon.cc): remove dead d6 mutation - NV21ToRGB24Row_NEON (row_neon.cc): remove dead d6 mutation - RGBToUV444MatrixRow_NEON (row_neon.cc): add q13 clobber - ScaleRowDown2Box_SSSE3 (scale_gcc.cc): add xmm4 clobber - ScaleRowDown2Box_AVX2 (scale_gcc.cc): add xmm4 clobber - SobelToPlaneRow_SSE2 (row_gcc.cc): remove dead xmm5 mutation - UYVYToARGBRow_SSSE3 (row_gcc.cc): add xmm6, xmm7 clobbers Test: ninja -C out/Release libyuv_unittest && ./out/Release/libyuv_unittest Bug: 489489002 Change-Id: I0a8794be0423ef36d679a45e276738c2e42d2fb8 TAG=agy CONV=16035e35-dcc9-4b8f-90f7-f17b299bc523 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8258080 Commit-Queue: Frank Barchard Reviewed-by: richard winterton --- source/row_gcc.cc | 11 +++++------ source/row_neon.cc | 13 ++++--------- source/row_neon64.cc | 8 ++++---- source/scale_gcc.cc | 4 ++-- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/source/row_gcc.cc b/source/row_gcc.cc index 74d710f4c..5078b5441 100644 --- a/source/row_gcc.cc +++ b/source/row_gcc.cc @@ -1160,7 +1160,7 @@ void ARGBToAB64Row_SSSE3(const uint8_t* src_argb, "+r"(width) // %2 : "m"(kShuffleARGBToAB64Lo), // %3 "m"(kShuffleARGBToAB64Hi) // %4 - : "memory", "cc", "xmm0", "xmm1", "xmm2"); + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3"); } void AR64ToARGBRow_SSSE3(const uint16_t* src_ar64, @@ -1259,7 +1259,7 @@ void ARGBToAB64Row_AVX2(const uint8_t* src_argb, "+r"(width) // %2 : "m"(kShuffleARGBToAB64Lo), // %3 "m"(kShuffleARGBToAB64Hi) // %3 - : "memory", "cc", "xmm0", "xmm1", "xmm2"); + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3"); } #endif @@ -2947,7 +2947,7 @@ void OMITFP UYVYToARGBRow_SSSE3(const uint8_t* uyvy_buf, : [yuvconstants] "r"(yuvconstants), // %[yuvconstants] [kShuffleUYVYY] "m"(kShuffleUYVYY), [kShuffleUYVYUV] "m"(kShuffleUYVYUV) : "memory", "cc", YUVTORGB_REGS "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", - "xmm5"); + "xmm5", "xmm6", "xmm7"); } void OMITFP P210ToARGBRow_SSSE3(const uint16_t* y_buf, @@ -6632,7 +6632,8 @@ void MergeXR30Row_AVX2(const uint16_t* src_r, #else : "rm"(shift) // %5 #endif - : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"); + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", + "xmm6"); } #endif @@ -8700,8 +8701,6 @@ void SobelToPlaneRow_SSE2(const uint8_t* src_sobelx, int width) { asm volatile( "sub %0,%1 \n" - "pcmpeqb %%xmm5,%%xmm5 \n" - "pslld $0x18,%%xmm5 \n" // 8 pixel loop. LABELALIGN diff --git a/source/row_neon.cc b/source/row_neon.cc index 9afb2cd1a..06de40e80 100644 --- a/source/row_neon.cc +++ b/source/row_neon.cc @@ -292,7 +292,6 @@ void I422ToRGB24Row_NEON(const uint8_t* src_y, int width) { asm volatile( YUVTORGB_SETUP - "vmov.u8 d6, #255 \n" "1: \n" // READYUV422 "subs %[width], %[width], #8 \n" YUVTORGB RGBTORGB8 @@ -323,7 +322,6 @@ void I422ToRGB565Row_NEON(const uint8_t* src_y, int width) { asm volatile( YUVTORGB_SETUP - "vmov.u8 d6, #255 \n" "1: \n" // READYUV422 "subs %[width], %[width], #8 \n" YUVTORGB RGBTORGB8 ARGBTORGB565 @@ -494,7 +492,6 @@ void NV12ToRGB24Row_NEON(const uint8_t* src_y, int width) { asm volatile( YUVTORGB_SETUP - "vmov.u8 d6, #255 \n" "1: \n" // READNV12 YUVTORGB RGBTORGB8 "subs %[width], %[width], #8 \n" @@ -516,7 +513,6 @@ void NV21ToRGB24Row_NEON(const uint8_t* src_y, int width) { asm volatile( YUVTORGB_SETUP - "vmov.u8 d6, #255 \n" "1: \n" // READNV21 YUVTORGB RGBTORGB8 "subs %[width], %[width], #8 \n" @@ -538,7 +534,6 @@ void NV12ToRGB565Row_NEON(const uint8_t* src_y, int width) { asm volatile( YUVTORGB_SETUP - "vmov.u8 d6, #255 \n" "1: \n" // READNV12 YUVTORGB RGBTORGB8 "subs %[width], %[width], #8 \n" ARGBTORGB565 @@ -1063,7 +1058,7 @@ void MergeAR64Row_NEON(const uint16_t* src_r, "+r"(width) // %5 : "r"(shift), // %6 "r"(mask) // %7 - : "memory", "cc", "q0", "q1", "q2", "q3", "q15"); + : "memory", "cc", "q0", "q1", "q2", "q3", "q14", "q15"); } void MergeXR64Row_NEON(const uint16_t* src_r, @@ -1100,7 +1095,7 @@ void MergeXR64Row_NEON(const uint16_t* src_r, "+r"(width) // %4 : "r"(shift), // %5 "r"(mask) // %6 - : "memory", "cc", "q0", "q1", "q2", "q3", "q15"); + : "memory", "cc", "q0", "q1", "q2", "q3", "q14", "q15"); } void MergeARGB16To8Row_NEON(const uint16_t* src_r, @@ -1894,7 +1889,7 @@ void ARGBToUV444MatrixRow_NEON(const uint8_t* src_argb, "r"(&c->kRGBToV), // %5 "r"(&c->kAddUV) // %6 : "cc", "memory", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", - "q10", "q11", "q12"); + "q10", "q11", "q12", "q13"); } // 8x1 pixels. @@ -1946,7 +1941,7 @@ void RGBToUV444MatrixRow_NEON(const uint8_t* src_rgb, "r"(&c->kRGBToV), // %5 "r"(&c->kAddUV) // %6 : "cc", "memory", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", - "q10", "q11", "q12"); + "q10", "q11", "q12", "q13"); } // clang-format off diff --git a/source/row_neon64.cc b/source/row_neon64.cc index ead3e6cdd..7727c0acb 100644 --- a/source/row_neon64.cc +++ b/source/row_neon64.cc @@ -1701,7 +1701,7 @@ void MergeAR64Row_NEON(const uint16_t* src_r, "+r"(width) // %5 : "r"(shift), // %6 "r"(mask) // %7 - : "memory", "cc", "v0", "v1", "v2", "v3", "v31"); + : "memory", "cc", "v0", "v1", "v2", "v3", "v30", "v31"); } void MergeXR64Row_NEON(const uint16_t* src_r, @@ -1741,7 +1741,7 @@ void MergeXR64Row_NEON(const uint16_t* src_r, "+r"(width) // %4 : "r"(shift), // %5 "r"(mask) // %6 - : "memory", "cc", "v0", "v1", "v2", "v3", "v31"); + : "memory", "cc", "v0", "v1", "v2", "v3", "v30", "v31"); } void MergeARGB16To8Row_NEON(const uint16_t* src_r, @@ -2657,7 +2657,7 @@ void ARGBToAB64Row_NEON(const uint8_t* src_argb, "+r"(dst_ab64), // %1 "+r"(width) // %2 : "r"(&kShuffleARGBToAB64[0]) // %3 - : "cc", "memory", "v0", "v1", "v2", "v3", "v4"); + : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7"); } #endif // LIBYUV_USE_ST2 @@ -4063,7 +4063,7 @@ void ARGBSepiaRow_NEON_DotProd(uint8_t* dst_argb, int width) { : [coeffs] "r"(&kARGBSepiaRowCoeffs), // %[coeffs] [indices] "r"(&kARGBSepiaRowAlphaIndices) // %[indices] : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v20", - "v21", "v22", "v24", "v25", "v26", "v28", "v29", "v30"); + "v21", "v22", "v23", "v24", "v25", "v26", "v28", "v29", "v30"); } // Tranform 8 ARGB pixels (32 bytes) with color matrix. diff --git a/source/scale_gcc.cc b/source/scale_gcc.cc index 773076669..e9100f656 100644 --- a/source/scale_gcc.cc +++ b/source/scale_gcc.cc @@ -187,7 +187,7 @@ void ScaleRowDown2Box_SSSE3(const uint8_t* src_ptr, "+r"(dst_ptr), // %1 "+r"(dst_width) // %2 : "r"(src_stride) // %3 - : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm5"); + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"); } #ifdef HAS_SCALEROWDOWN2_AVX2 @@ -287,7 +287,7 @@ void ScaleRowDown2Box_AVX2(const uint8_t* src_ptr, "+r"(dst_ptr), // %1 "+r"(dst_width) // %2 : "r"(src_stride) // %3 - : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm5"); + : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"); } #endif // HAS_SCALEROWDOWN2_AVX2