diff --git a/libyuv.gyp b/libyuv.gyp index 45df0d2e26192..e2aa2d7c69404 100644 --- a/libyuv.gyp +++ b/libyuv.gyp @@ -71,9 +71,7 @@ # '-mthumb', # arm32 not thumb ], 'cflags_mozilla!': [ - '-mfpu=vfp', - '-mfpu=vfpv3', - '-mfpu=vfpv3-d16', + '<@(moz_neon_cflags_block_list)', ], 'conditions': [ # Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug. @@ -108,16 +106,6 @@ '-ffat-lto-objects', ], }], - # arm64 does not need -mfpu=neon option as neon is not optional - ['target_arch != "arm64"', { - 'cflags': [ - '-mfpu=neon', - # '-marm', # arm32 not thumb - ], - 'cflags_mozilla': [ - '-mfpu=neon', - ], - }], ], }], ['build_msa != 0', { @@ -157,6 +145,11 @@ }], ], }], + ['target_arch == "arm64" and moz_have_arm_sve2 != 1 and build_with_mozilla == 1', { + 'defines' :[ + 'LIBYUV_DISABLE_SVE', + ] + }], ], #conditions 'defines': [ # Enable the following 3 macros to turn off assembly for specified CPU. @@ -186,12 +179,94 @@ '-Wl,--dynamic-linker,/system/bin/linker', ], }], + ['target_arch == "armv7" or target_arch == "arm64" and moz_have_arm_i8mm_and_dot_prod == 1 and build_with_mozilla == 1', { + 'dependencies': [ + ':libyuv_neon', + ], + }], + ['target_arch == "arm64" and moz_have_arm_sve2 == 1 and build_with_mozilla == 1', { + 'dependencies': [ + ':libyuv_sve', + ], + }], ], #conditions }, 'sources': [ '<@(libyuv_sources)', ], }, + { + 'target_name': 'libyuv_neon', + 'type': 'static_library', + 'variables': { + 'optimize': 'max', # enable O2 and ltcg. + }, + 'conditions': [ + ['target_arch == "arm64" and moz_have_arm_i8mm_and_dot_prod == 1 and build_with_mozilla == 1', { + 'cflags_mozilla': [ + '-march=armv8.2-a+dotprod+i8mm', + ], + }], + # arm64 does not need -mfpu=neon option as neon is not optional + ['target_arch != "arm64"', { + 'cflags': [ + '-mfpu=neon', + # '-marm', # arm32 not thumb + ], + 'cflags_mozilla': [ + '-mfpu=neon', + ], + }], + ['build_neon != 0', { + 'cflags_mozilla!': [ + '<@(moz_neon_cflags_block_list)', + ], + 'sources': [ + '<@(libyuv_neon_sources)', + ], + }], + ], #conditions + 'include_dirs': [ + 'include', + '.', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + 'include', + '.', + ], #conditions + }, + }, + { + 'target_name': 'libyuv_sve', + 'type': 'static_library', + 'variables': { + 'optimize': 'max', # enable O2 and ltcg. + }, + 'conditions': [ + ['target_arch == "arm64" and moz_have_arm_sve2 == 1 and build_with_mozilla == 1', { + 'cflags_mozilla!': [ + '<@(moz_neon_cflags_block_list)', + ], + 'cflags_mozilla': [ + '-march=armv9-a+dotprod+sve2+i8mm', + ], + 'sources': [ + '<@(libyuv_sve_sources)', + ], + }], + ], #conditions + 'include_dirs': [ + 'include', + '.', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + 'include', + '.', + ], #conditions + }, + }, ], # targets. } diff --git a/libyuv.gypi b/libyuv.gypi index 74fa0fe63b57b..1fd1be71e3414 100644 --- a/libyuv.gypi +++ b/libyuv.gypi @@ -8,6 +8,29 @@ { 'variables': { + 'moz_have_arm_sve2%': '<(moz_have_arm_sve2)', + 'moz_have_arm_i8mm_and_dot_prod%': '<(moz_have_arm_i8mm_and_dot_prod)', + 'moz_neon_cflags_block_list': [ + '-mfpu=vfp', + '-mfpu=vfpv3', + '-mfpu=vfpv3-d16', + ], + # Needs to be reflected in upstream gyp file. + 'libyuv_sve_sources': [ + # sources. + 'source/row_sve.cc', + ], + 'libyuv_neon_sources': [ + # ARM Source Files + "source/compare_neon.cc", + "source/compare_neon64.cc", + "source/rotate_neon.cc", + "source/rotate_neon64.cc", + "source/row_neon.cc", + "source/row_neon64.cc", + "source/scale_neon.cc", + "source/scale_neon64.cc", + ], 'libyuv_sources': [ # includes. 'include/libyuv.h', @@ -41,8 +64,6 @@ 'source/compare_common.cc', 'source/compare_gcc.cc', 'source/compare_msa.cc', - 'source/compare_neon.cc', - 'source/compare_neon64.cc', 'source/compare_win.cc', 'source/convert.cc', 'source/convert_argb.cc', @@ -62,8 +83,6 @@ 'source/rotate_gcc.cc', 'source/rotate_lsx.cc', 'source/rotate_msa.cc', - 'source/rotate_neon.cc', - 'source/rotate_neon64.cc', 'source/rotate_win.cc', 'source/row_any.cc', 'source/row_common.cc', @@ -71,8 +90,6 @@ 'source/row_msa.cc', 'source/row_lasx.cc', 'source/row_lsx.cc', - 'source/row_neon.cc', - 'source/row_neon64.cc', 'source/row_win.cc', 'source/scale.cc', 'source/scale_any.cc', @@ -81,8 +98,6 @@ 'source/scale_gcc.cc', 'source/scale_lsx.cc', 'source/scale_msa.cc', - 'source/scale_neon.cc', - 'source/scale_neon64.cc', 'source/scale_rgb.cc', 'source/scale_uv.cc', 'source/scale_win.cc',