Bug 1948198 - Enable LSX for libpng on LoongArch64. r=firefox-build-system-reviewers,tnikkel,glandium

Enable LSX unconditionally for LoongArch64 because its availability
is guaranteed for LoongArch desktop and server platforms, which are
general-purpose and popular, according to [the *Software Development and
Build Convention for LoongArch Architectures* spec, version 0.2][softdev-conv].

[softdev-conv]: https://github.com/loongson/la-softdev-convention/blob/v0.2/la-softdev-convention.adoc#73-vector-instruction-support

This change partially reverts D231469.

Differential Revision: https://phabricator.services.mozilla.com/D238166
This commit is contained in:
WANG Xuerui
2025-03-03 10:17:09 +00:00
parent a3f02582d1
commit 7504aaa18b
2 changed files with 13 additions and 1 deletions

View File

@@ -72,7 +72,12 @@ if CONFIG['HAVE_ALTIVEC']:
] ]
if CONFIG['TARGET_CPU'] == 'loongarch64': if CONFIG['TARGET_CPU'] == 'loongarch64':
CFLAGS += ['-mno-lsx'] DEFINES['MOZ_PNG_USE_LOONGARCH_LSX'] = True
CFLAGS += ['-mlsx']
UNIFIED_SOURCES += [
'loongarch/filter_lsx_intrinsics.c',
'loongarch/loongarch_lsx_init.c',
]
if CONFIG['MOZ_TREE_FREETYPE']: if CONFIG['MOZ_TREE_FREETYPE']:
DEFINES['FT_CONFIG_OPTION_USE_PNG'] = True DEFINES['FT_CONFIG_OPTION_USE_PNG'] = True

View File

@@ -54,6 +54,13 @@
# define PNG_ARM_NEON_OPT 0 # define PNG_ARM_NEON_OPT 0
#endif #endif
#ifdef MOZ_PNG_USE_LOONGARCH_LSX
# undef PNG_LOONGARCH_LSX_OPT /* Let libpng decide */
# define PNG_ALIGNED_MEMORY_SUPPORTED
#else
# define PNG_LOONGARCH_LSX_OPT 0
#endif
#ifdef MOZ_PNG_USE_MIPS_MSA #ifdef MOZ_PNG_USE_MIPS_MSA
# undef PNG_MIPS_MSA_OPT # undef PNG_MIPS_MSA_OPT
# define PNG_ALIGNED_MEMORY_SUPPORTED # define PNG_ALIGNED_MEMORY_SUPPORTED