Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autotools: detect ASIMD only when in 64-bit #5663

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 26 additions & 22 deletions src/configure
Original file line number Diff line number Diff line change
Expand Up @@ -9430,10 +9430,11 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

CC="$CC_BACKUP -march=armv8-a+simd"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ASIMD" >&5
if test "$CPU_BIT_STR" -eq 64; then
CC="$CC_BACKUP -march=armv8-a+simd"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ASIMD" >&5
$as_echo_n "checking for ASIMD... " >&6; }
if test "$cross_compiling" = yes; then :
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
Expand All @@ -9442,30 +9443,31 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#include <arm_neon.h>
#include <stdio.h>
extern void exit(int);
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}
#include <arm_neon.h>
#include <stdio.h>
extern void exit(int);
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}


_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
CPU_BEST_FLAGS="-march=armv8-a+simd"
SIMD_NAME="ASIMD"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
SIMD_NAME="ASIMD"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ARCH_LINK=arm64le.h
ARCH_LINK=arm64le.h

else
CPU_NOTFOUND="1"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NEON" >&5
$as_echo_n "checking for NEON... " >&6; }
Expand Down Expand Up @@ -9494,34 +9496,36 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ASIMD" >&5
if test "$CPU_BIT_STR" -eq 64; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ASIMD" >&5
$as_echo_n "checking for ASIMD... " >&6; }
CC="$CC_BACKUP -march=armv8-a+simd"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
CC="$CC_BACKUP -march=armv8-a+simd"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#include <arm_neon.h>
#include <stdio.h>
extern void exit(int);
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}
#include <arm_neon.h>
#include <stdio.h>
extern void exit(int);
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}


_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
CPU_BEST_FLAGS="-march=armv8-a+simd"
SIMD_NAME="ASIMD"
ARCH_LINK=arm64le.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
SIMD_NAME="ASIMD"
ARCH_LINK=arm64le.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }

else
CPU_NOTFOUND="1"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
fi
fi

Expand Down
72 changes: 38 additions & 34 deletions src/m4/jtr_arm_logic.m4
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,25 @@ if test "x$enable_native_tests" = xyes; then
,[CPU_NOTFOUND="1"]
[AC_MSG_RESULT(no)]
)
CC="$CC_BACKUP -march=armv8-a+simd"
AC_MSG_CHECKING([for ASIMD])
AC_RUN_IFELSE(
[
AC_LANG_SOURCE(
[[#include <arm_neon.h>
#include <stdio.h>
extern void exit(int);
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}]]
)]
,[CPU_BEST_FLAGS="-march=armv8-a+simd"]
[SIMD_NAME="ASIMD"]
[AC_MSG_RESULT([yes])]
[ARCH_LINK=arm64le.h]
,[CPU_NOTFOUND="1"]
[AC_MSG_RESULT(no)]
)
if test "$CPU_BIT_STR" -eq 64; then
CC="$CC_BACKUP -march=armv8-a+simd"
AC_MSG_CHECKING([for ASIMD])
AC_RUN_IFELSE(
[
AC_LANG_SOURCE(
[[#include <arm_neon.h>
#include <stdio.h>
extern void exit(int);
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}]]
)]
,[CPU_BEST_FLAGS="-march=armv8-a+simd"]
[SIMD_NAME="ASIMD"]
[AC_MSG_RESULT([yes])]
[ARCH_LINK=arm64le.h]
,[CPU_NOTFOUND="1"]
[AC_MSG_RESULT(no)]
)
fi
else
dnl ======================================================================
dnl cross-compile versions of the same tests
Expand All @@ -81,23 +83,25 @@ dnl ======================================================================
,[CPU_NOTFOUND="1"]
[AC_MSG_RESULT(no)]
)
AC_MSG_CHECKING([for ASIMD])
CC="$CC_BACKUP -march=armv8-a+simd"
AC_LINK_IFELSE(
[
AC_LANG_SOURCE(
[[#include <arm_neon.h>
#include <stdio.h>
extern void exit(int);
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}]]
)]
,[CPU_BEST_FLAGS="-march=armv8-a+simd"]
[SIMD_NAME="ASIMD"]
[ARCH_LINK=arm64le.h]
[AC_MSG_RESULT([yes])]
,[CPU_NOTFOUND="1"]
[AC_MSG_RESULT(no)]
)
if test "$CPU_BIT_STR" -eq 64; then
AC_MSG_CHECKING([for ASIMD])
CC="$CC_BACKUP -march=armv8-a+simd"
AC_LINK_IFELSE(
[
AC_LANG_SOURCE(
[[#include <arm_neon.h>
#include <stdio.h>
extern void exit(int);
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}]]
)]
,[CPU_BEST_FLAGS="-march=armv8-a+simd"]
[SIMD_NAME="ASIMD"]
[ARCH_LINK=arm64le.h]
[AC_MSG_RESULT([yes])]
,[CPU_NOTFOUND="1"]
[AC_MSG_RESULT(no)]
)
fi
fi
fi

Expand Down