From 68f852d835c5da218080f1e04256b0fbc6c21e9c Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Tue, 7 Nov 2017 18:46:33 -0800 Subject: [PATCH] Remove DISABLE_CLANG_MSA cleanup to remove ifdefs around functions affected by a clang bug. gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"mips64el\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_clang=true" ninja -v -C out/Release libyuv_unittest Bug: libyuv:634 Test: build for mips with clang Change-Id: I278b368dbb2fe89082240e280267d0a27a214c78 Reviewed-on: https://chromium-review.googlesource.com/757980 Reviewed-by: Frank Barchard Commit-Queue: Frank Barchard --- include/libyuv/compare_row.h | 10 ----- include/libyuv/row.h | 72 ++++++++++++++++-------------------- include/libyuv/scale_row.h | 24 ++++-------- source/compare_msa.cc | 2 - source/row_msa.cc | 29 --------------- source/scale_msa.cc | 8 ---- 6 files changed, 38 insertions(+), 107 deletions(-) diff --git a/include/libyuv/compare_row.h b/include/libyuv/compare_row.h index 9b7013a24..76ed8ab8a 100644 --- a/include/libyuv/compare_row.h +++ b/include/libyuv/compare_row.h @@ -42,13 +42,6 @@ extern "C" { #endif // clang >= 3.4 #endif // __clang__ -// clang 6 mips issue https://bugs.chromium.org/p/libyuv/issues/detail?id=715 -// broken in clang version 6.0.0 (trunk 308728) -// fixed in clang version 6.0.0 (trunk 310694) -#if defined(__clang__) -// #define DISABLE_CLANG_MSA 1 -#endif - // The following are available for Visual C: #if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && \ (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2)) @@ -91,11 +84,8 @@ extern "C" { #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) #define HAS_HAMMINGDISTANCE_MSA - -#ifndef DISABLE_CLANG_MSA #define HAS_SUMSQUAREERROR_MSA #endif -#endif uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count); uint32 HammingDistance_SSE42(const uint8* src_a, const uint8* src_b, int count); diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 5ccf94d9d..9a9b9580b 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -75,13 +75,6 @@ extern "C" { #define VISUALC_HAS_AVX2 1 #endif // VisualStudio >= 2012 -// clang 6 mips issue https://bugs.chromium.org/p/libyuv/issues/detail?id=715 -// broken in clang version 6.0.0 (trunk 308728) -// fixed in clang version 6.0.0 (trunk 310694) -#if defined(__clang__) -// #define DISABLE_CLANG_MSA 1 -#endif - // The following are available on all x86 platforms: #if !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) @@ -414,12 +407,23 @@ extern "C" { #endif #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) +#define HAS_ABGRTOUVROW_MSA +#define HAS_ABGRTOYROW_MSA +#define HAS_ARGB1555TOARGBROW_MSA +#define HAS_ARGB1555TOUVROW_MSA +#define HAS_ARGB1555TOYROW_MSA #define HAS_ARGB4444TOARGBROW_MSA #define HAS_ARGBADDROW_MSA #define HAS_ARGBATTENUATEROW_MSA +#define HAS_ARGBBLENDROW_MSA +#define HAS_ARGBCOLORMATRIXROW_MSA +#define HAS_ARGBEXTRACTALPHAROW_MSA #define HAS_ARGBGRAYROW_MSA #define HAS_ARGBMIRRORROW_MSA #define HAS_ARGBMULTIPLYROW_MSA +#define HAS_ARGBQUANTIZEROW_MSA +#define HAS_ARGBSEPIAROW_MSA +#define HAS_ARGBSETROW_MSA #define HAS_ARGBSHADEROW_MSA #define HAS_ARGBSHUFFLEROW_MSA #define HAS_ARGBSUBTRACTROW_MSA @@ -427,33 +431,8 @@ extern "C" { #define HAS_ARGBTOARGB4444ROW_MSA #define HAS_ARGBTORAWROW_MSA #define HAS_ARGBTORGB24ROW_MSA -#define HAS_ARGBTORGB565ROW_MSA -#define HAS_I422TOUYVYROW_MSA -#define HAS_I422TOYUY2ROW_MSA -#define HAS_INTERPOLATEROW_MSA -#define HAS_MERGEUVROW_MSA -#define HAS_MIRRORROW_MSA -#define HAS_RAWTORGB24ROW_MSA -#define HAS_SOBELTOPLANEROW_MSA -#define HAS_UYVYTOUVROW_MSA -#define HAS_UYVYTOYROW_MSA -#define HAS_YUY2TOUV422ROW_MSA -#define HAS_YUY2TOUVROW_MSA -#define HAS_YUY2TOYROW_MSA -#define HAS_ARGBEXTRACTALPHAROW_MSA -#define HAS_SPLITUVROW_MSA -#define HAS_MIRRORUVROW_MSA -#define HAS_HALFFLOATROW_MSA - -#ifndef DISABLE_CLANG_MSA -#define HAS_ABGRTOUVROW_MSA -#define HAS_ABGRTOYROW_MSA -#define HAS_ARGB1555TOARGBROW_MSA -#define HAS_ARGB1555TOUVROW_MSA -#define HAS_ARGB1555TOYROW_MSA -#define HAS_ARGBSEPIAROW_MSA -#define HAS_ARGBSETROW_MSA #define HAS_ARGBTORGB565DITHERROW_MSA +#define HAS_ARGBTORGB565ROW_MSA #define HAS_ARGBTOUV444ROW_MSA #define HAS_ARGBTOUVJROW_MSA #define HAS_ARGBTOUVROW_MSA @@ -461,17 +440,25 @@ extern "C" { #define HAS_ARGBTOYROW_MSA #define HAS_BGRATOUVROW_MSA #define HAS_BGRATOYROW_MSA +#define HAS_HALFFLOATROW_MSA #define HAS_I400TOARGBROW_MSA #define HAS_I422ALPHATOARGBROW_MSA #define HAS_I422TOARGBROW_MSA #define HAS_I422TORGB24ROW_MSA #define HAS_I422TORGBAROW_MSA +#define HAS_I422TOUYVYROW_MSA +#define HAS_I422TOYUY2ROW_MSA #define HAS_I444TOARGBROW_MSA +#define HAS_INTERPOLATEROW_MSA #define HAS_J400TOARGBROW_MSA +#define HAS_MERGEUVROW_MSA +#define HAS_MIRRORROW_MSA +#define HAS_MIRRORUVROW_MSA #define HAS_NV12TOARGBROW_MSA #define HAS_NV12TORGB565ROW_MSA #define HAS_NV21TOARGBROW_MSA #define HAS_RAWTOARGBROW_MSA +#define HAS_RAWTORGB24ROW_MSA #define HAS_RAWTOUVROW_MSA #define HAS_RAWTOYROW_MSA #define HAS_RGB24TOARGBROW_MSA @@ -482,17 +469,20 @@ extern "C" { #define HAS_RGB565TOYROW_MSA #define HAS_RGBATOUVROW_MSA #define HAS_RGBATOYROW_MSA -#define HAS_SOBELROW_MSA -#define HAS_SOBELXYROW_MSA -#define HAS_UYVYTOARGBROW_MSA -#define HAS_YUY2TOARGBROW_MSA -#define HAS_ARGBBLENDROW_MSA -#define HAS_ARGBQUANTIZEROW_MSA -#define HAS_ARGBCOLORMATRIXROW_MSA #define HAS_SETROW_MSA +#define HAS_SOBELROW_MSA +#define HAS_SOBELTOPLANEROW_MSA #define HAS_SOBELXROW_MSA +#define HAS_SOBELXYROW_MSA #define HAS_SOBELYROW_MSA -#endif +#define HAS_SPLITUVROW_MSA +#define HAS_UYVYTOARGBROW_MSA +#define HAS_UYVYTOUVROW_MSA +#define HAS_UYVYTOYROW_MSA +#define HAS_YUY2TOARGBROW_MSA +#define HAS_YUY2TOUV422ROW_MSA +#define HAS_YUY2TOUVROW_MSA +#define HAS_YUY2TOYROW_MSA #endif #if defined(_MSC_VER) && !defined(__CLR_VER) && !defined(__clang__) diff --git a/include/libyuv/scale_row.h b/include/libyuv/scale_row.h index ebafac4f6..534898cdd 100644 --- a/include/libyuv/scale_row.h +++ b/include/libyuv/scale_row.h @@ -50,13 +50,6 @@ extern "C" { #define VISUALC_HAS_AVX2 1 #endif // VisualStudio >= 2012 -// clang 6 mips issue https://bugs.chromium.org/p/libyuv/issues/detail?id=715 -// broken in clang version 6.0.0 (trunk 308728) -// fixed in clang version 6.0.0 (trunk 310694) -#if defined(__clang__) -// #define DISABLE_CLANG_MSA 1 -#endif - // The following are available on all x86 platforms: #if !defined(LIBYUV_DISABLE_X86) && \ (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) @@ -112,19 +105,16 @@ extern "C" { #endif #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) -#define HAS_SCALEARGBROWDOWN2_MSA -#define HAS_SCALEROWDOWN2_MSA -#define HAS_SCALEROWDOWN4_MSA #define HAS_SCALEADDROW_MSA #define HAS_SCALEARGBCOLS_MSA -#define HAS_SCALEROWDOWN34_MSA - -#ifndef DISABLE_CLANG_MSA -#define HAS_SCALEARGBROWDOWNEVEN_MSA -#define HAS_SCALEROWDOWN38_MSA -#define HAS_SCALEFILTERCOLS_MSA #define HAS_SCALEARGBFILTERCOLS_MSA -#endif +#define HAS_SCALEARGBROWDOWN2_MSA +#define HAS_SCALEARGBROWDOWNEVEN_MSA +#define HAS_SCALEFILTERCOLS_MSA +#define HAS_SCALEROWDOWN2_MSA +#define HAS_SCALEROWDOWN34_MSA +#define HAS_SCALEROWDOWN38_MSA +#define HAS_SCALEROWDOWN4_MSA #endif // Scale ARGB vertically with bilinear interpolation. diff --git a/source/compare_msa.cc b/source/compare_msa.cc index da484d5cd..efb5185aa 100644 --- a/source/compare_msa.cc +++ b/source/compare_msa.cc @@ -47,7 +47,6 @@ uint32 HammingDistance_MSA(const uint8* src_a, const uint8* src_b, int count) { return diff; } -#ifndef DISABLE_CLANG_MSA uint32 SumSquareError_MSA(const uint8* src_a, const uint8* src_b, int count) { uint32 sse = 0u; int i; @@ -85,7 +84,6 @@ uint32 SumSquareError_MSA(const uint8* src_a, const uint8* src_b, int count) { sse += (uint32)__msa_copy_u_w((v4i32)tmp0, 2); return sse; } -#endif #ifdef __cplusplus } // extern "C" diff --git a/source/row_msa.cc b/source/row_msa.cc index 89fc248f8..5cc23450a 100644 --- a/source/row_msa.cc +++ b/source/row_msa.cc @@ -16,12 +16,6 @@ #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) #include "libyuv/macros_msa.h" -// caveat - as of clang 6, some functions do not build under clang. -// The macro DISABLE_CLANG_MSA is set for clang builds to disable -// affected functions. -// __msa_fill_w() is one affected intrinsic. -// See Also: https://bugs.chromium.org/p/libyuv/issues/detail?id=715 - #ifdef __cplusplus namespace libyuv { extern "C" { @@ -373,7 +367,6 @@ void I422ToUYVYRow_MSA(const uint8* src_y, } } -#ifndef DISABLE_CLANG_MSA void I422ToARGBRow_MSA(const uint8* src_y, const uint8* src_u, const uint8* src_v, @@ -644,7 +637,6 @@ void I422ToARGB1555Row_MSA(const uint8* src_y, dst_argb1555 += 16; } } -#endif void YUY2ToYRow_MSA(const uint8* src_yuy2, uint8* dst_y, int width) { int x; @@ -776,8 +768,6 @@ void UYVYToUV422Row_MSA(const uint8* src_uyvy, } } -#ifndef DISABLE_CLANG_MSA - void ARGBToYRow_MSA(const uint8* src_argb0, uint8* dst_y, int width) { int x; v16u8 src0, src1, src2, src3, vec0, vec1, vec2, vec3, dst0; @@ -941,7 +931,6 @@ void ARGBToUVRow_MSA(const uint8* src_argb0, dst_v += 16; } } -#endif void ARGBToRGB24Row_MSA(const uint8* src_argb, uint8* dst_rgb, int width) { int x; @@ -1088,7 +1077,6 @@ void ARGBToARGB4444Row_MSA(const uint8* src_argb, uint8* dst_rgb, int width) { } } -#ifndef DISABLE_CLANG_MSA void ARGBToUV444Row_MSA(const uint8* src_argb, uint8* dst_u, uint8* dst_v, @@ -1160,7 +1148,6 @@ void ARGBToUV444Row_MSA(const uint8* src_argb, dst_v += 16; } } -#endif void ARGBMultiplyRow_MSA(const uint8* src_argb0, const uint8* src_argb1, @@ -1308,7 +1295,6 @@ void ARGBAttenuateRow_MSA(const uint8* src_argb, uint8* dst_argb, int width) { } } -#ifndef DISABLE_CLANG_MSA void ARGBToRGB565DitherRow_MSA(const uint8* src_argb, uint8* dst_rgb, uint32 dither4, @@ -1352,7 +1338,6 @@ void ARGBToRGB565DitherRow_MSA(const uint8* src_argb, dst_rgb += 16; } } -#endif void ARGBShuffleRow_MSA(const uint8* src_argb, uint8* dst_argb, @@ -1442,7 +1427,6 @@ void ARGBGrayRow_MSA(const uint8* src_argb, uint8* dst_argb, int width) { } } -#ifndef DISABLE_CLANG_MSA void ARGBSepiaRow_MSA(uint8* dst_argb, int width) { int x; v16u8 src0, src1, dst0, dst1, vec0, vec1, vec2, vec3, vec4, vec5; @@ -1483,7 +1467,6 @@ void ARGBSepiaRow_MSA(uint8* dst_argb, int width) { dst_argb += 32; } } -#endif void ARGB4444ToARGBRow_MSA(const uint8* src_argb4444, uint8* dst_argb, @@ -1514,7 +1497,6 @@ void ARGB4444ToARGBRow_MSA(const uint8* src_argb4444, } } -#ifndef DISABLE_CLANG_MSA void ARGB1555ToARGBRow_MSA(const uint8* src_argb1555, uint8* dst_argb, int width) { @@ -2372,7 +2354,6 @@ void SobelRow_MSA(const uint8* src_sobelx, dst_argb += 64; } } -#endif void SobelToPlaneRow_MSA(const uint8* src_sobelx, const uint8* src_sobely, @@ -2395,7 +2376,6 @@ void SobelToPlaneRow_MSA(const uint8* src_sobelx, } } -#ifndef DISABLE_CLANG_MSA void SobelXYRow_MSA(const uint8* src_sobelx, const uint8* src_sobely, uint8* dst_argb, @@ -2870,7 +2850,6 @@ void UYVYToARGBRow_MSA(const uint8* src_uyvy, rgb_buf += 32; } } -#endif void InterpolateRow_MSA(uint8* dst_ptr, const uint8* src_ptr, @@ -2936,7 +2915,6 @@ void InterpolateRow_MSA(uint8* dst_ptr, } } -#ifndef DISABLE_CLANG_MSA void ARGBSetRow_MSA(uint8* dst_argb, uint32 v32, int width) { int x; v4i32 dst0 = __builtin_msa_fill_w(v32); @@ -2946,7 +2924,6 @@ void ARGBSetRow_MSA(uint8* dst_argb, uint32 v32, int width) { dst_argb += 16; } } -#endif void RAWToRGB24Row_MSA(const uint8* src_raw, uint8* dst_rgb24, int width) { int x; @@ -3010,7 +2987,6 @@ void ARGBExtractAlphaRow_MSA(const uint8* src_argb, uint8* dst_a, int width) { } } -#ifndef DISABLE_CLANG_MSA void ARGBBlendRow_MSA(const uint8* src_argb0, const uint8* src_argb1, uint8* dst_argb, @@ -3290,7 +3266,6 @@ void ARGBColorMatrixRow_MSA(const uint8* src_argb, dst_argb += 32; } } -#endif void SplitUVRow_MSA(const uint8* src_uv, uint8* dst_u, @@ -3316,7 +3291,6 @@ void SplitUVRow_MSA(const uint8* src_uv, } } -#ifndef DISABLE_CLANG_MSA void SetRow_MSA(uint8* dst, uint8 v8, int width) { int x; v16u8 dst0 = (v16u8)__msa_fill_b(v8); @@ -3326,7 +3300,6 @@ void SetRow_MSA(uint8* dst, uint8 v8, int width) { dst += 16; } } -#endif void MirrorUVRow_MSA(const uint8* src_uv, uint8* dst_u, @@ -3357,7 +3330,6 @@ void MirrorUVRow_MSA(const uint8* src_uv, } } -#ifndef DISABLE_CLANG_MSA void SobelXRow_MSA(const uint8* src_y0, const uint8* src_y1, const uint8* src_y2, @@ -3456,7 +3428,6 @@ void SobelYRow_MSA(const uint8* src_y0, dst_sobely += 16; } } -#endif void HalfFloatRow_MSA(const uint16* src, uint16* dst, float scale, int width) { int i; diff --git a/source/scale_msa.cc b/source/scale_msa.cc index c246e5e8e..df1f482be 100644 --- a/source/scale_msa.cc +++ b/source/scale_msa.cc @@ -127,7 +127,6 @@ void ScaleARGBRowDownEven_MSA(const uint8_t* src_argb, } } -#ifndef DISABLE_CLANG_MSA void ScaleARGBRowDownEvenBox_MSA(const uint8* src_argb, ptrdiff_t src_stride, int src_stepx, @@ -182,7 +181,6 @@ void ScaleARGBRowDownEvenBox_MSA(const uint8* src_argb, dst_argb += 16; } } -#endif void ScaleRowDown2_MSA(const uint8_t* src_ptr, ptrdiff_t src_stride, @@ -385,7 +383,6 @@ void ScaleRowDown38_MSA(const uint8_t* src_ptr, } } -#ifndef DISABLE_CLANG_MSA void ScaleRowDown38_2_Box_MSA(const uint8_t* src_ptr, ptrdiff_t src_stride, uint8_t* dst_ptr, @@ -535,7 +532,6 @@ void ScaleRowDown38_3_Box_MSA(const uint8_t* src_ptr, dst_ptr += 12; } } -#endif void ScaleAddRow_MSA(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width) { int x; @@ -557,7 +553,6 @@ void ScaleAddRow_MSA(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width) { } } -#ifndef DISABLE_CLANG_MSA void ScaleFilterCols_MSA(uint8* dst_ptr, const uint8* src_ptr, int dst_width, @@ -634,7 +629,6 @@ void ScaleFilterCols_MSA(uint8* dst_ptr, dst_ptr += 16; } } -#endif void ScaleARGBCols_MSA(uint8* dst_argb, const uint8* src_argb, @@ -663,7 +657,6 @@ void ScaleARGBCols_MSA(uint8* dst_argb, } } -#ifndef DISABLE_CLANG_MSA void ScaleARGBFilterCols_MSA(uint8* dst_argb, const uint8* src_argb, int dst_width, @@ -728,7 +721,6 @@ void ScaleARGBFilterCols_MSA(uint8* dst_argb, dst_argb += 32; } } -#endif void ScaleRowDown34_MSA(const uint8* src_ptr, ptrdiff_t src_stride,