From 6d083e2d120e3c8635f34b4e82afef6252b7d399 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Thu, 3 Aug 2017 10:32:34 -0700 Subject: [PATCH] clang 6 build disable some msa functions R=kjellander@chromium.org Bug: libyuv:715 Test: 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" Change-Id: Ia3943b0afc02e05a8bc32350719b296b0b9d5479 Reviewed-on: https://chromium-review.googlesource.com/592720 Reviewed-by: Cheng Wang --- README.chromium | 2 +- include/libyuv/row.h | 108 ++++++++++++++++++++----------------- include/libyuv/scale_row.h | 11 +++- include/libyuv/version.h | 2 +- source/row_msa.cc | 25 ++++++++- source/scale_msa.cc | 4 ++ 6 files changed, 97 insertions(+), 55 deletions(-) diff --git a/README.chromium b/README.chromium index 53ebbc89f..65fef7501 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1662 +Version: 1663 License: BSD License File: LICENSE diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 8e14dcb80..e93faa849 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -75,6 +75,11 @@ extern "C" { #define VISUALC_HAS_AVX2 1 #endif // VisualStudio >= 2012 +// clang 6 mips issue https://bugs.chromium.org/p/libyuv/issues/detail?id=715 +#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__)) @@ -385,72 +390,75 @@ extern "C" { #endif #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) +#define HAS_ARGB4444TOARGBROW_MSA +#define HAS_ARGBADDROW_MSA +#define HAS_ARGBATTENUATEROW_MSA +#define HAS_ARGBGRAYROW_MSA #define HAS_ARGBMIRRORROW_MSA +#define HAS_ARGBMULTIPLYROW_MSA +#define HAS_ARGBSHADEROW_MSA +#define HAS_ARGBSHUFFLEROW_MSA +#define HAS_ARGBSUBTRACTROW_MSA +#define HAS_ARGBTOARGB1555ROW_MSA +#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_ARGB4444TOARGBROW_MSA -#define HAS_ARGBTOYROW_MSA -#define HAS_ARGBTOUVROW_MSA -#define HAS_I422TOARGBROW_MSA -#define HAS_I422TORGBAROW_MSA -#define HAS_I422ALPHATOARGBROW_MSA -#define HAS_I422TORGB24ROW_MSA -#define HAS_ARGBTORGB24ROW_MSA -#define HAS_ARGBTORAWROW_MSA -#define HAS_ARGBTORGB565ROW_MSA -#define HAS_ARGBTOARGB1555ROW_MSA -#define HAS_ARGBTOARGB4444ROW_MSA -#define HAS_ARGBTOUV444ROW_MSA -#define HAS_ARGBMULTIPLYROW_MSA -#define HAS_ARGBADDROW_MSA -#define HAS_ARGBSUBTRACTROW_MSA -#define HAS_ARGBATTENUATEROW_MSA -#define HAS_ARGBTORGB565DITHERROW_MSA -#define HAS_ARGBSHUFFLEROW_MSA -#define HAS_ARGBSHADEROW_MSA -#define HAS_ARGBGRAYROW_MSA -#define HAS_ARGBSEPIAROW_MSA + +#ifndef DISABLE_CLANG_MSA +#define HAS_ABGRTOUVROW_MSA +#define HAS_ABGRTOYROW_MSA #define HAS_ARGB1555TOARGBROW_MSA -#define HAS_RGB565TOARGBROW_MSA -#define HAS_RGB24TOARGBROW_MSA -#define HAS_RAWTOARGBROW_MSA -#define HAS_ARGB1555TOYROW_MSA -#define HAS_RGB565TOYROW_MSA -#define HAS_RGB24TOYROW_MSA -#define HAS_RAWTOYROW_MSA #define HAS_ARGB1555TOUVROW_MSA -#define HAS_RGB565TOUVROW_MSA -#define HAS_RGB24TOUVROW_MSA -#define HAS_RAWTOUVROW_MSA +#define HAS_ARGB1555TOYROW_MSA +#define HAS_ARGBSEPIAROW_MSA +#define HAS_ARGBSETROW_MSA +#define HAS_ARGBTORGB565DITHERROW_MSA +#define HAS_ARGBTOUV444ROW_MSA +#define HAS_ARGBTOUVJROW_MSA +#define HAS_ARGBTOUVROW_MSA +#define HAS_ARGBTOYJROW_MSA +#define HAS_ARGBTOYROW_MSA +#define HAS_BGRATOUVROW_MSA +#define HAS_BGRATOYROW_MSA +#define HAS_I400TOARGBROW_MSA +#define HAS_I422ALPHATOARGBROW_MSA +#define HAS_I422TOARGBROW_MSA +#define HAS_I422TORGB24ROW_MSA +#define HAS_I422TORGBAROW_MSA +#define HAS_I444TOARGBROW_MSA +#define HAS_J400TOARGBROW_MSA #define HAS_NV12TOARGBROW_MSA #define HAS_NV12TORGB565ROW_MSA #define HAS_NV21TOARGBROW_MSA -#define HAS_SOBELROW_MSA -#define HAS_SOBELTOPLANEROW_MSA -#define HAS_SOBELXYROW_MSA -#define HAS_ARGBTOYJROW_MSA -#define HAS_BGRATOYROW_MSA -#define HAS_ABGRTOYROW_MSA -#define HAS_RGBATOYROW_MSA -#define HAS_ARGBTOUVJROW_MSA -#define HAS_BGRATOUVROW_MSA -#define HAS_ABGRTOUVROW_MSA +#define HAS_RAWTOARGBROW_MSA +#define HAS_RAWTOUVROW_MSA +#define HAS_RAWTOYROW_MSA +#define HAS_RGB24TOARGBROW_MSA +#define HAS_RGB24TOUVROW_MSA +#define HAS_RGB24TOYROW_MSA +#define HAS_RGB565TOARGBROW_MSA +#define HAS_RGB565TOUVROW_MSA +#define HAS_RGB565TOYROW_MSA #define HAS_RGBATOUVROW_MSA -#define HAS_I444TOARGBROW_MSA -#define HAS_I400TOARGBROW_MSA -#define HAS_J400TOARGBROW_MSA -#define HAS_YUY2TOARGBROW_MSA +#define HAS_RGBATOYROW_MSA +#define HAS_SOBELROW_MSA +#define HAS_SOBELXYROW_MSA #define HAS_UYVYTOARGBROW_MSA -#define HAS_INTERPOLATEROW_MSA -#define HAS_ARGBSETROW_MSA -#define HAS_RAWTORGB24ROW_MSA -#define HAS_MERGEUVROW_MSA +#define HAS_YUY2TOARGBROW_MSA +#endif #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 edb46cc8c..f607d6314 100644 --- a/include/libyuv/scale_row.h +++ b/include/libyuv/scale_row.h @@ -50,6 +50,11 @@ extern "C" { #define VISUALC_HAS_AVX2 1 #endif // VisualStudio >= 2012 +// clang 6 mips issue https://bugs.chromium.org/p/libyuv/issues/detail?id=715 +#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__)) @@ -106,11 +111,13 @@ extern "C" { #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) #define HAS_SCALEARGBROWDOWN2_MSA -#define HAS_SCALEARGBROWDOWNEVEN_MSA #define HAS_SCALEROWDOWN2_MSA #define HAS_SCALEROWDOWN4_MSA -#define HAS_SCALEROWDOWN38_MSA #define HAS_SCALEADDROW_MSA +#ifndef DISABLE_CLANG_MSA +#define HAS_SCALEARGBROWDOWNEVEN_MSA +#define HAS_SCALEROWDOWN38_MSA +#endif #endif // Scale ARGB vertically with bilinear interpolation. diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 7a624d9f4..e3b978ab6 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 1662 +#define LIBYUV_VERSION 1663 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/row_msa.cc b/source/row_msa.cc index f79de1c7b..a57f0f1a8 100644 --- a/source/row_msa.cc +++ b/source/row_msa.cc @@ -16,6 +16,12 @@ #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" { @@ -367,6 +373,7 @@ 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, @@ -637,6 +644,7 @@ 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; @@ -768,6 +776,8 @@ 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; @@ -931,6 +941,7 @@ 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; @@ -1077,6 +1088,7 @@ 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, @@ -1148,6 +1160,7 @@ void ARGBToUV444Row_MSA(const uint8* src_argb, dst_v += 16; } } +#endif void ARGBMultiplyRow_MSA(const uint8* src_argb0, const uint8* src_argb1, @@ -1295,6 +1308,7 @@ 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, @@ -1338,6 +1352,7 @@ void ARGBToRGB565DitherRow_MSA(const uint8* src_argb, dst_rgb += 16; } } +#endif void ARGBShuffleRow_MSA(const uint8* src_argb, uint8* dst_argb, @@ -1427,6 +1442,7 @@ 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; @@ -1467,6 +1483,7 @@ void ARGBSepiaRow_MSA(uint8* dst_argb, int width) { dst_argb += 32; } } +#endif void ARGB4444ToARGBRow_MSA(const uint8* src_argb4444, uint8* dst_argb, @@ -1497,6 +1514,7 @@ void ARGB4444ToARGBRow_MSA(const uint8* src_argb4444, } } +#ifndef DISABLE_CLANG_MSA void ARGB1555ToARGBRow_MSA(const uint8* src_argb1555, uint8* dst_argb, int width) { @@ -2354,6 +2372,7 @@ void SobelRow_MSA(const uint8* src_sobelx, dst_argb += 64; } } +#endif void SobelToPlaneRow_MSA(const uint8* src_sobelx, const uint8* src_sobely, @@ -2376,6 +2395,7 @@ 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, @@ -2850,6 +2870,7 @@ void UYVYToARGBRow_MSA(const uint8* src_uyvy, rgb_buf += 32; } } +#endif void InterpolateRow_MSA(uint8* dst_ptr, const uint8* src_ptr, @@ -2915,15 +2936,17 @@ void InterpolateRow_MSA(uint8* dst_ptr, } } +#ifndef DISABLE_CLANG_MSA void ARGBSetRow_MSA(uint8* dst_argb, uint32 v32, int width) { int x; - v16u8 dst0 = (v16u8)__msa_fill_w(v32); + v4i32 dst0 = __builtin_msa_fill_w(v32); for (x = 0; x < width; x += 4) { ST_UB(dst0, dst_argb); dst_argb += 16; } } +#endif void RAWToRGB24Row_MSA(const uint8* src_raw, uint8* dst_rgb24, int width) { int x; diff --git a/source/scale_msa.cc b/source/scale_msa.cc index bfcd10fc5..47040cab0 100644 --- a/source/scale_msa.cc +++ b/source/scale_msa.cc @@ -119,6 +119,7 @@ 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, @@ -173,6 +174,7 @@ void ScaleARGBRowDownEvenBox_MSA(const uint8* src_argb, dst_argb += 16; } } +#endif void ScaleRowDown2_MSA(const uint8_t* src_ptr, ptrdiff_t src_stride, @@ -375,6 +377,7 @@ 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, @@ -524,6 +527,7 @@ 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;