build: Checking for compiler support of LoongArch LSX should be guarded

In the configure script, checking whether the LoongArch LSX intrinsics
are supported by the compiler was done unconditionally, regardless of
the targetted host platform. Compared to how we support the other SIMD
platforms and compilers, this is rather unconventional.

We are placing this check under the guard of its own platform, for the
time being. A full solution, in line with the rest of the configure.ac
patterns concering SIMD optimizations, is TODO.

We also do an overall cleanup in the SIMD section of configure.ac, and,
finally, we regenerate the configure script.
This commit is contained in:
Cosmin Truta 2024-02-20 23:14:32 +02:00
parent 29e31f622f
commit 14a348ddc8
2 changed files with 219 additions and 220 deletions

231
configure vendored
View File

@ -1544,36 +1544,36 @@ Optional Features:
default - use --disable-unversioned-libpng-config to
change this.
--enable-hardware-optimizations
Enable hardware optimizations: =no/off, yes/on:
Enable hardware optimizations: =no/off, yes/on.
--enable-arm-neon Enable ARM NEON optimizations: =no/off, check, api,
yes/on: no/off: disable the optimizations; check:
yes/on. no/off: disable the optimizations; check:
use internal checking code (deprecated and poorly
supported); api: disable by default, enable by a
call to png_set_option; yes/on: turn on
unconditionally. If not specified: determined by the
compiler.
--enable-mips-msa Enable MIPS MSA optimizations: =no/off, check, api,
yes/on: no/off: disable the optimizations; check:
yes/on. no/off: disable the optimizations; check:
use internal checking code (deprecated and poorly
supported); api: disable by default, enable by a
call to png_set_option; yes/on: turn on
unconditionally. If not specified: determined by the
compiler.
--enable-mips-mmi Enable MIPS MMI optimizations: =no/off, check, api,
yes/on: no/off: disable the optimizations; check:
yes/on. no/off: disable the optimizations; check:
use internal checking code (deprecated and poorly
supported); api: disable by default, enable by a
call to png_set_option; yes/on: turn on
unconditionally. If not specified: determined by the
compiler.
--enable-intel-sse Enable Intel SSE optimizations: =no/off, yes/on:
--enable-intel-sse Enable Intel SSE optimizations: =no/off, yes/on.
no/off: disable the optimizations; yes/on: enable
the optimizations. If not specified: determined by
the compiler.
--enable-powerpc-vsx Enable POWERPC VSX optimizations: =no/off, check,
api, yes/on: no/off: disable the optimizations;
check: use internal checking code api: disable by
default, enable by a call to png_set_option yes/on:
api, yes/on. no/off: disable the optimizations;
check: use internal checking code; api: disable by
default, enable by a call to png_set_option; yes/on:
turn on unconditionally. If not specified:
determined by the compiler.
--enable-loongarch-lsx
@ -14227,9 +14227,9 @@ if test "$have_ld_version_script" = "yes"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for symbol prefix" >&5
printf %s "checking for symbol prefix... " >&6; }
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
| ${CPP-${CC-gcc} -E} - 2>&1 \
| ${EGREP-grep} "^PREFIX=" \
| ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
| ${CPP:-${CC:-gcc} -E} - 2>&1 \
| ${EGREP:-grep} "^PREFIX=" \
| ${SED:-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SYMBOL_PREFIX" >&5
printf "%s\n" "$SYMBOL_PREFIX" >&6; }
@ -14429,10 +14429,8 @@ printf "%s\n" "#define PNG_LOONGARCH_LSX_OPT 1" >>confdefs.h
fi
# ARM
# ===
#
# ARM NEON (SIMD) support.
# ARM NEON
# ========
# Check whether --enable-arm-neon was given.
if test ${enable_arm_neon+y}
@ -14457,21 +14455,22 @@ printf "%s\n" "#define PNG_ARM_NEON_API_SUPPORTED /**/" >>confdefs.h
printf "%s\n" "#define PNG_ARM_NEON_OPT 2" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-arm-neon: please specify 'check' or 'api', if
you want the optimizations unconditionally pass -mfpu=neon
to the compiler." >&5
printf "%s\n" "$as_me: WARNING: --enable-arm-neon: please specify 'check' or 'api', if
you want the optimizations unconditionally pass -mfpu=neon
to the compiler." >&2;};;
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-arm-neon: please specify 'check' or 'api';
if you want the optimizations unconditionally,
pass '-mfpu=neon' to the compiler." >&5
printf "%s\n" "$as_me: WARNING: --enable-arm-neon: please specify 'check' or 'api';
if you want the optimizations unconditionally,
pass '-mfpu=neon' to the compiler." >&2;};;
*)
as_fn_error $? "--enable-arm-neon=${enable_arm_neon}: invalid value" "$LINENO" 5
as_fn_error $? "--enable-arm-neon=${enable_arm_neon}:
invalid argument" "$LINENO" 5
esac
fi
# Add ARM-specific files to all builds where $host_cpu is arm ('arm*') or
# where ARM optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'arm*')
# where ARM optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'arm*'.)
if test "$enable_arm_neon" != 'no' &&
case "$host_cpu" in
@ -14486,10 +14485,8 @@ else
fi
# MIPS
# ====
#
# MIPS MSA (SIMD) support.
# MIPS MSA
# ========
# Check whether --enable-mips-msa was given.
if test ${enable_mips_msa+y}
@ -14514,21 +14511,22 @@ printf "%s\n" "#define PNG_MIPS_MSA_API_SUPPORTED /**/" >>confdefs.h
printf "%s\n" "#define PNG_MIPS_MSA_OPT 2" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-mips-msa: please specify 'check' or 'api', if
you want the optimizations unconditionally pass '-mmsa -mfp64'
to the compiler." >&5
printf "%s\n" "$as_me: WARNING: --enable-mips-msa: please specify 'check' or 'api', if
you want the optimizations unconditionally pass '-mmsa -mfp64'
to the compiler." >&2;};;
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-mips-msa: please specify 'check' or 'api';
if you want the optimizations unconditionally,
pass '-mmsa -mfp64' to the compiler." >&5
printf "%s\n" "$as_me: WARNING: --enable-mips-msa: please specify 'check' or 'api';
if you want the optimizations unconditionally,
pass '-mmsa -mfp64' to the compiler." >&2;};;
*)
as_fn_error $? "--enable-mips-msa=${enable_mips_msa}: invalid value" "$LINENO" 5
as_fn_error $? "--enable-mips-msa=${enable_mips_msa}:
invalid argument" "$LINENO" 5
esac
fi
# Add MIPS-specific files to all builds where $host_cpu is mips ('mips*') or
# where MIPS optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'mips*')
# where MIPS optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'mips*'.)
if test "$enable_mips_msa" != 'no' &&
case "$host_cpu" in
@ -14542,10 +14540,8 @@ else
fi
# MIPS
# ===
#
# MIPS MMI (SIMD) support.
# MIPS MMI
# ========
# Check whether --enable-mips-mmi was given.
if test ${enable_mips_mmi+y}
@ -14570,25 +14566,26 @@ printf "%s\n" "#define PNG_MIPS_MMI_API_SUPPORTED /**/" >>confdefs.h
printf "%s\n" "#define PNG_MIPS_MMI_OPT 1" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-mips-mmi: please specify 'check' or 'api', if
you want the optimizations unconditionally pass '-mloongson-mmi -march=loongson3a'
to the compiler." >&5
printf "%s\n" "$as_me: WARNING: --enable-mips-mmi: please specify 'check' or 'api', if
you want the optimizations unconditionally pass '-mloongson-mmi -march=loongson3a'
to the compiler." >&2;};;
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-mips-mmi: please specify 'check' or 'api';
if you want the optimizations unconditionally
pass '-mloongson-mmi -march=loongson3a' to the compiler." >&5
printf "%s\n" "$as_me: WARNING: --enable-mips-mmi: please specify 'check' or 'api';
if you want the optimizations unconditionally
pass '-mloongson-mmi -march=loongson3a' to the compiler." >&2;};;
*)
as_fn_error $? "--enable-mips-mmi=${enable_mips_mmi}: invalid value" "$LINENO" 5
as_fn_error $? "--enable-mips-mmi=${enable_mips_mmi}:
invalid argument" "$LINENO" 5
esac
fi
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
# where MIPS optimizations were explicitly requested (this allows a fallback if a
# future host CPU does not match 'mips*')
# where MIPS optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'mips*'.)
if test "$enable_mips_mmi" != 'no' &&
case "$host_cpu" in
mipsel*|mips64el*) :;;
mipsel*|mips64el*) : ;;
esac; then
PNG_MIPS_MMI_TRUE=
PNG_MIPS_MMI_FALSE='#'
@ -14598,10 +14595,8 @@ else
fi
# INTEL
# =====
#
# INTEL SSE (SIMD) support.
# INTEL SSE
# =========
# Check whether --enable-intel-sse was given.
if test ${enable_intel_sse+y}
@ -14619,14 +14614,15 @@ printf "%s\n" "#define PNG_INTEL_SSE_OPT 0" >>confdefs.h
printf "%s\n" "#define PNG_INTEL_SSE_OPT 1" >>confdefs.h
;;
*)
as_fn_error $? "--enable-intel-sse=${enable_intel_sse}: invalid value" "$LINENO" 5
as_fn_error $? "--enable-intel-sse=${enable_intel_sse}:
invalid argument" "$LINENO" 5
esac
fi
# Add Intel-specific files to all builds where $host_cpu is Intel ('x86*') or
# where Intel optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'x86*')
# where Intel optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'x86*'.)
if test "$enable_intel_sse" != 'no' &&
case "$host_cpu" in
i?86|x86_64) : ;;
@ -14640,10 +14636,8 @@ else
fi
# PowerPC
# =======
#
# PowerPC VSX (SIMD) support.
# POWERPC VSX
# ===========
# Check whether --enable-powerpc-vsx was given.
if test ${enable_powerpc_vsx+y}
@ -14660,10 +14654,10 @@ printf "%s\n" "#define PNG_POWERPC_VSX_OPT 0" >>confdefs.h
printf "%s\n" "#define PNG_POWERPC_VSX_CHECK_SUPPORTED /**/" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-powerpc-vsx Please check contrib/powerpc/README file
for the list of supported OSes." >&5
printf "%s\n" "$as_me: WARNING: --enable-powerpc-vsx Please check contrib/powerpc/README file
for the list of supported OSes." >&2;};;
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-powerpc-vsx: please see contrib/powerpc/README
for the list of supported systems." >&5
printf "%s\n" "$as_me: WARNING: --enable-powerpc-vsx: please see contrib/powerpc/README
for the list of supported systems." >&2;};;
api)
printf "%s\n" "#define PNG_POWERPC_VSX_API_SUPPORTED /**/" >>confdefs.h
@ -14672,21 +14666,22 @@ printf "%s\n" "#define PNG_POWERPC_VSX_API_SUPPORTED /**/" >>confdefs.h
printf "%s\n" "#define PNG_POWERPC_VSX_OPT 2" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-powerpc-vsx: please specify 'check' or 'api', if
you want the optimizations unconditionally pass '-maltivec -mvsx'
or '-mcpu=power8' to the compiler." >&5
printf "%s\n" "$as_me: WARNING: --enable-powerpc-vsx: please specify 'check' or 'api', if
you want the optimizations unconditionally pass '-maltivec -mvsx'
or '-mcpu=power8' to the compiler." >&2;};;
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --enable-powerpc-vsx: please specify 'check' or 'api';
if you want the optimizations unconditionally,
pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler." >&5
printf "%s\n" "$as_me: WARNING: --enable-powerpc-vsx: please specify 'check' or 'api';
if you want the optimizations unconditionally,
pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler." >&2;};;
*)
as_fn_error $? "--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value" "$LINENO" 5
as_fn_error $? "--enable-powerpc-vsx=${enable_powerpc_vsx}:
invalid argument" "$LINENO" 5
esac
fi
# Add PowerPC-specific files to all builds where $host_cpu is powerpc('powerpc*')
# or where PowerPC optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'powerpc*')
# Add PowerPC-specific files to all builds where $host_cpu is powerpc
# ('powerpc*') or where PowerPC optimizations were explicitly requested.
# (This allows a fallback if a future host CPU does not match 'powerpc*'.)
if test "$enable_powerpc_vsx" != 'no' &&
case "$host_cpu" in
@ -14700,38 +14695,8 @@ else
fi
# LOONGARCH
# ===
#
# LOONGARCH LSX (SIMD) support
if test "$LSX_CFLAGS" = ''; then
LSX_CFLAGS="-mlsx"
fi
compiler_support_loongarch_lsx=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use loongarch LSX intrinsics" >&5
printf %s "checking whether to use loongarch LSX intrinsics... " >&6; }
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $LSX_CFLAGS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include<lsxintrin.h>
int main(){
__m128i a, b, c;
a = __lsx_vadd_w(b, c);
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
compiler_support_loongarch_lsx=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$save_CFLAGS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $compiler_support_loongarch_lsx" >&5
printf "%s\n" "$compiler_support_loongarch_lsx" >&6; }
# LOONGARCH LSX
# =============
# Check whether --enable-loongarch-lsx was given.
if test ${enable_loongarch_lsx+y}
@ -14750,13 +14715,44 @@ printf "%s\n" "#define PNG_LOONGARCH_LSX_OPT 1" >>confdefs.h
;;
*)
as_fn_error $? "--enable-loongarch-lsx=${enable_loongarch_lsx}: invalid value" "$LINENO" 5
as_fn_error $? "--enable-loongarch-lsx=${enable_loongarch_lsx}:
invalid argument" "$LINENO" 5
esac
fi
if test "$enable_loongarch_lsx" != 'no'; then
if test $compiler_support_loongarch_lsx = yes; then
# FIXME: This section should not be needed.
if test "$enable_loongarch_lsx" != "no" &&
case "$host_cpu" in
loongarch*) : ;;
*) test "$enable_loongarch_lsx" != '' ;;
esac
then
compiler_support_loongarch_lsx=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use LoongArch LSX intrinsics" >&5
printf %s "checking whether to use LoongArch LSX intrinsics... " >&6; }
save_CFLAGS="$CFLAGS"
LSX_CFLAGS="${LSX_CFLAGS:-"-mlsx"}"
CFLAGS="$CFLAGS $LSX_CFLAGS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <lsxintrin.h>
int main(){
__m128i a, b, c;
a = __lsx_vadd_w(b, c);
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
compiler_support_loongarch_lsx=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS="$save_CFLAGS"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $compiler_support_loongarch_lsx" >&5
printf "%s\n" "$compiler_support_loongarch_lsx" >&6; }
if test "$compiler_support_loongarch_lsx" = "yes"; then
printf "%s\n" "#define PNG_LOONGARCH_LSX_OPT 1" >>confdefs.h
@ -14766,14 +14762,15 @@ printf "%s\n" "$as_me: WARNING: Compiler does not support loongarch LSX." >&2;}
fi
fi
# Add LOONGARCH specific files to all builds where the host_cpu is loongarch ('loongarch*') or
# where LOONGARCH optimizations were explicitly requested (this allows a fallback if a
# future host CPU does not match 'loongarch*')
# Add LoongArch specific files to all builds where the host_cpu is loongarch
# ('loongarch*') or where LoongArch optimizations were explicitly requested.
# (This allows a fallback if a future host CPU does not match 'loongarch*'.)
if test "$enable_loongarch_lsx" != 'no' && test $compiler_support_loongarch_lsx = yes &&
if test "$enable_loongarch_lsx" != "no" &&
test "$compiler_support_loongarch_lsx" = "yes" &&
case "$host_cpu" in
loongarch*) :;;
*) test "$enable_loongarch_lsx" != '';;
loongarch*) : ;;
*) test "$enable_loongarch_lsx" != '' ;;
esac; then
PNG_LOONGARCH_LSX_TRUE=
PNG_LOONGARCH_LSX_FALSE='#'

View File

@ -226,9 +226,9 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_ld_version_script" = "yes"; then
AC_MSG_CHECKING([for symbol prefix])
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
| ${CPP-${CC-gcc} -E} - 2>&1 \
| ${EGREP-grep} "^PREFIX=" \
| ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
| ${CPP:-${CC:-gcc} -E} - 2>&1 \
| ${EGREP:-grep} "^PREFIX=" \
| ${SED:-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
AC_SUBST(SYMBOL_PREFIX)
AC_MSG_RESULT($SYMBOL_PREFIX)
fi
@ -321,7 +321,7 @@ AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
#
AC_ARG_ENABLE([hardware-optimizations],
AS_HELP_STRING([[[--enable-hardware-optimizations]]],
[Enable hardware optimizations: =no/off, yes/on:]),
[Enable hardware optimizations: =no/off, yes/on.]),
[case "$enableval" in
no|off)
# disable hardware optimization on all systems:
@ -379,17 +379,16 @@ AC_ARG_ENABLE([hardware-optimizations],
;;
esac])
# ARM
# ===
#
# ARM NEON (SIMD) support.
# ARM NEON
# ========
AC_ARG_ENABLE([arm-neon],
AS_HELP_STRING([[[--enable-arm-neon]]],
[Enable ARM NEON optimizations: =no/off, check, api, yes/on:]
[no/off: disable the optimizations; check: use internal checking code]
[(deprecated and poorly supported); api: disable by default, enable by]
[a call to png_set_option; yes/on: turn on unconditionally.]
[Enable ARM NEON optimizations: =no/off, check, api, yes/on.]
[no/off: disable the optimizations;]
[check: use internal checking code (deprecated and poorly supported);]
[api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
@ -407,16 +406,17 @@ AC_ARG_ENABLE([arm-neon],
yes|on)
AC_DEFINE([PNG_ARM_NEON_OPT], [2],
[Enable ARM Neon optimizations])
AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if]
[you want the optimizations unconditionally pass -mfpu=neon]
[to the compiler.]);;
AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api';]
[if you want the optimizations unconditionally,]
[pass '-mfpu=neon' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}:]
[invalid argument])
esac])
# Add ARM-specific files to all builds where $host_cpu is arm ('arm*') or
# where ARM optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'arm*')
# where ARM optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'arm*'.)
AM_CONDITIONAL([PNG_ARM_NEON],
[test "$enable_arm_neon" != 'no' &&
@ -425,17 +425,16 @@ AM_CONDITIONAL([PNG_ARM_NEON],
*) test "$enable_arm_neon" != '' ;;
esac])
# MIPS
# ====
#
# MIPS MSA (SIMD) support.
# MIPS MSA
# ========
AC_ARG_ENABLE([mips-msa],
AS_HELP_STRING([[[--enable-mips-msa]]],
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on:]
[no/off: disable the optimizations; check: use internal checking code]
[(deprecated and poorly supported); api: disable by default, enable by]
[a call to png_set_option; yes/on: turn on unconditionally.]
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on.]
[no/off: disable the optimizations;]
[check: use internal checking code (deprecated and poorly supported);]
[api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
@ -453,16 +452,17 @@ AC_ARG_ENABLE([mips-msa],
yes|on)
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
[Enable MIPS MSA optimizations])
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if]
[you want the optimizations unconditionally pass '-mmsa -mfp64']
[to the compiler.]);;
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api';]
[if you want the optimizations unconditionally,]
[pass '-mmsa -mfp64' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}:]
[invalid argument])
esac])
# Add MIPS-specific files to all builds where $host_cpu is mips ('mips*') or
# where MIPS optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'mips*')
# where MIPS optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'mips*'.)
AM_CONDITIONAL([PNG_MIPS_MSA],
[test "$enable_mips_msa" != 'no' &&
@ -470,17 +470,16 @@ AM_CONDITIONAL([PNG_MIPS_MSA],
mipsel*|mips64el*) : ;;
esac])
# MIPS
# ===
#
# MIPS MMI (SIMD) support.
# MIPS MMI
# ========
AC_ARG_ENABLE([mips-mmi],
AS_HELP_STRING([[[--enable-mips-mmi]]],
[Enable MIPS MMI optimizations: =no/off, check, api, yes/on:]
[no/off: disable the optimizations; check: use internal checking code]
[(deprecated and poorly supported); api: disable by default, enable by]
[a call to png_set_option; yes/on: turn on unconditionally.]
[Enable MIPS MMI optimizations: =no/off, check, api, yes/on.]
[no/off: disable the optimizations;]
[check: use internal checking code (deprecated and poorly supported);]
[api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
@ -498,31 +497,30 @@ AC_ARG_ENABLE([mips-mmi],
yes|on)
AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
[Enable MIPS MMI optimizations])
AC_MSG_WARN([--enable-mips-mmi: please specify 'check' or 'api', if]
[you want the optimizations unconditionally pass '-mloongson-mmi -march=loongson3a']
[to the compiler.]);;
AC_MSG_WARN([--enable-mips-mmi: please specify 'check' or 'api';]
[if you want the optimizations unconditionally]
[pass '-mloongson-mmi -march=loongson3a' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-mips-mmi=${enable_mips_mmi}: invalid value])
AC_MSG_ERROR([--enable-mips-mmi=${enable_mips_mmi}:]
[invalid argument])
esac])
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
# where MIPS optimizations were explicitly requested (this allows a fallback if a
# future host CPU does not match 'mips*')
# where MIPS optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'mips*'.)
AM_CONDITIONAL([PNG_MIPS_MMI],
[test "$enable_mips_mmi" != 'no' &&
case "$host_cpu" in
mipsel*|mips64el*) :;;
mipsel*|mips64el*) : ;;
esac])
# INTEL
# =====
#
# INTEL SSE (SIMD) support.
# INTEL SSE
# =========
AC_ARG_ENABLE([intel-sse],
AS_HELP_STRING([[[--enable-intel-sse]]],
[Enable Intel SSE optimizations: =no/off, yes/on:]
[Enable Intel SSE optimizations: =no/off, yes/on.]
[no/off: disable the optimizations;]
[yes/on: enable the optimizations.]
[If not specified: determined by the compiler.]),
@ -537,12 +535,13 @@ AC_ARG_ENABLE([intel-sse],
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
[Enable Intel SSE optimizations]);;
*)
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}:]
[invalid argument])
esac])
# Add Intel-specific files to all builds where $host_cpu is Intel ('x86*') or
# where Intel optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'x86*')
# where Intel optimizations were explicitly requested. (This allows a fallback
# if a future host CPU does not match 'x86*'.)
AM_CONDITIONAL([PNG_INTEL_SSE],
[test "$enable_intel_sse" != 'no' &&
case "$host_cpu" in
@ -550,16 +549,15 @@ AM_CONDITIONAL([PNG_INTEL_SSE],
*) test "$enable_intel_sse" != '' ;;
esac])
# PowerPC
# =======
#
# PowerPC VSX (SIMD) support.
# POWERPC VSX
# ===========
AC_ARG_ENABLE([powerpc-vsx],
AS_HELP_STRING([[[--enable-powerpc-vsx]]],
[Enable POWERPC VSX optimizations: =no/off, check, api, yes/on:]
[no/off: disable the optimizations; check: use internal checking code]
[api: disable by default, enable by a call to png_set_option]
[Enable POWERPC VSX optimizations: =no/off, check, api, yes/on.]
[no/off: disable the optimizations;]
[check: use internal checking code;]
[api: disable by default, enable by a call to png_set_option;]
[yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
@ -572,24 +570,25 @@ AS_HELP_STRING([[[--enable-powerpc-vsx]]],
check)
AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [],
[Check for POWERPC VSX support at run-time])
AC_MSG_WARN([--enable-powerpc-vsx Please check contrib/powerpc/README file]
[for the list of supported OSes.]);;
AC_MSG_WARN([--enable-powerpc-vsx: please see contrib/powerpc/README]
[for the list of supported systems.]);;
api)
AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
[Turn on POWERPC VSX optimizations at run-time]);;
yes|on)
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
[Enable POWERPC VSX optimizations])
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api', if]
[you want the optimizations unconditionally pass '-maltivec -mvsx']
[or '-mcpu=power8' to the compiler.]);;
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api';]
[if you want the optimizations unconditionally,]
[pass '-maltivec -mvsx' or '-mcpu=power8' to the compiler.]);;
*)
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value])
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}:]
[invalid argument])
esac])
# Add PowerPC-specific files to all builds where $host_cpu is powerpc('powerpc*')
# or where PowerPC optimizations were explicitly requested (this allows a fallback
# if a future host CPU does not match 'powerpc*')
# Add PowerPC-specific files to all builds where $host_cpu is powerpc
# ('powerpc*') or where PowerPC optimizations were explicitly requested.
# (This allows a fallback if a future host CPU does not match 'powerpc*'.)
AM_CONDITIONAL([PNG_POWERPC_VSX],
[test "$enable_powerpc_vsx" != 'no' &&
@ -597,28 +596,8 @@ AM_CONDITIONAL([PNG_POWERPC_VSX],
powerpc*|ppc64*) : ;;
esac])
# LOONGARCH
# ===
#
# LOONGARCH LSX (SIMD) support
if test "$LSX_CFLAGS" = ''; then
LSX_CFLAGS="-mlsx"
fi
compiler_support_loongarch_lsx=no
AC_MSG_CHECKING(whether to use loongarch LSX intrinsics)
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $LSX_CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include<lsxintrin.h>
int main(){
__m128i a, b, c;
a = __lsx_vadd_w(b, c);
return 0;
}]])],compiler_support_loongarch_lsx=yes)
CFLAGS=$save_CFLAGS
AC_MSG_RESULT($compiler_support_loongarch_lsx)
# LOONGARCH LSX
# =============
AC_ARG_ENABLE([loongarch-lsx],
AS_HELP_STRING([[[--enable-loongarch-lsx]]],
@ -638,26 +617,49 @@ AC_ARG_ENABLE([loongarch-lsx],
[Enable LOONGARCH LSX optimizations])
;;
*)
AC_MSG_ERROR([--enable-loongarch-lsx=${enable_loongarch_lsx}: invalid value])
AC_MSG_ERROR([--enable-loongarch-lsx=${enable_loongarch_lsx}:]
[invalid argument])
esac])
if test "$enable_loongarch_lsx" != 'no'; then
if test $compiler_support_loongarch_lsx = yes; then
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1], [Enable LOONGARCH LSX optimizations])
# FIXME: This section should not be needed.
if test "$enable_loongarch_lsx" != "no" &&
case "$host_cpu" in
loongarch*) : ;;
*) test "$enable_loongarch_lsx" != '' ;;
esac
then
compiler_support_loongarch_lsx=no
AC_MSG_CHECKING(whether to use LoongArch LSX intrinsics)
save_CFLAGS="$CFLAGS"
LSX_CFLAGS="${LSX_CFLAGS:-"-mlsx"}"
CFLAGS="$CFLAGS $LSX_CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <lsxintrin.h>
int main(){
__m128i a, b, c;
a = __lsx_vadd_w(b, c);
return 0;
}]])],compiler_support_loongarch_lsx=yes)
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($compiler_support_loongarch_lsx)
if test "$compiler_support_loongarch_lsx" = "yes"; then
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
[Enable LOONGARCH LSX optimizations])
else
AC_MSG_WARN([Compiler does not support loongarch LSX.])
fi
fi
# Add LOONGARCH specific files to all builds where the host_cpu is loongarch ('loongarch*') or
# where LOONGARCH optimizations were explicitly requested (this allows a fallback if a
# future host CPU does not match 'loongarch*')
# Add LoongArch specific files to all builds where the host_cpu is loongarch
# ('loongarch*') or where LoongArch optimizations were explicitly requested.
# (This allows a fallback if a future host CPU does not match 'loongarch*'.)
AM_CONDITIONAL([PNG_LOONGARCH_LSX],
[test "$enable_loongarch_lsx" != 'no' && test $compiler_support_loongarch_lsx = yes &&
[test "$enable_loongarch_lsx" != "no" &&
test "$compiler_support_loongarch_lsx" = "yes" &&
case "$host_cpu" in
loongarch*) :;;
*) test "$enable_loongarch_lsx" != '';;
loongarch*) : ;;
*) test "$enable_loongarch_lsx" != '' ;;
esac])
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])