Skip to content

Commit e7b4798

Browse files
autotools: detect ASIMD only when in 64-bit
It doesn't make much sense to run this test if we already know we're on ARMv7 hardware. Fix: openwall#5656. Signed-off-by: Claudio André <[email protected]>
1 parent cc59c0f commit e7b4798

File tree

2 files changed

+64
-56
lines changed

2 files changed

+64
-56
lines changed

src/configure

+26-22
Original file line numberDiff line numberDiff line change
@@ -9430,10 +9430,11 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
94309430
conftest.$ac_objext conftest.beam conftest.$ac_ext
94319431
fi
94329432

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

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

94509451

94519452
_ACEOF
94529453
if ac_fn_c_try_run "$LINENO"; then :
94539454
CPU_BEST_FLAGS="-march=armv8-a+simd"
9454-
SIMD_NAME="ASIMD"
9455-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9455+
SIMD_NAME="ASIMD"
9456+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
94569457
$as_echo "yes" >&6; }
9457-
ARCH_LINK=arm64le.h
9458+
ARCH_LINK=arm64le.h
94589459

94599460
else
94609461
CPU_NOTFOUND="1"
9461-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9462+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
94629463
$as_echo "no" >&6; }
94639464

94649465
fi
94659466
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
94669467
conftest.$ac_objext conftest.beam conftest.$ac_ext
94679468
fi
94689469

9470+
fi
94699471
else
94709472
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NEON" >&5
94719473
$as_echo_n "checking for NEON... " >&6; }
@@ -9494,34 +9496,36 @@ $as_echo "no" >&6; }
94949496
fi
94959497
rm -f core conftest.err conftest.$ac_objext \
94969498
conftest$ac_exeext conftest.$ac_ext
9497-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ASIMD" >&5
9499+
if test "$CPU_BIT_STR" -eq 64; then
9500+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ASIMD" >&5
94989501
$as_echo_n "checking for ASIMD... " >&6; }
9499-
CC="$CC_BACKUP -march=armv8-a+simd"
9500-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9502+
CC="$CC_BACKUP -march=armv8-a+simd"
9503+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
95019504
/* end confdefs.h. */
95029505

9503-
#include <arm_neon.h>
9504-
#include <stdio.h>
9505-
extern void exit(int);
9506-
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}
9506+
#include <arm_neon.h>
9507+
#include <stdio.h>
9508+
extern void exit(int);
9509+
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}
95079510

95089511

95099512
_ACEOF
95109513
if ac_fn_c_try_link "$LINENO"; then :
95119514
CPU_BEST_FLAGS="-march=armv8-a+simd"
9512-
SIMD_NAME="ASIMD"
9513-
ARCH_LINK=arm64le.h
9514-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9515+
SIMD_NAME="ASIMD"
9516+
ARCH_LINK=arm64le.h
9517+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
95159518
$as_echo "yes" >&6; }
95169519

95179520
else
95189521
CPU_NOTFOUND="1"
9519-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9522+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
95209523
$as_echo "no" >&6; }
95219524

95229525
fi
95239526
rm -f core conftest.err conftest.$ac_objext \
95249527
conftest$ac_exeext conftest.$ac_ext
9528+
fi
95259529
fi
95269530
fi
95279531

src/m4/jtr_arm_logic.m4

+38-34
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,25 @@ if test "x$enable_native_tests" = xyes; then
4444
,[CPU_NOTFOUND="1"]
4545
[AC_MSG_RESULT(no)]
4646
)
47-
CC="$CC_BACKUP -march=armv8-a+simd"
48-
AC_MSG_CHECKING([for ASIMD])
49-
AC_RUN_IFELSE(
50-
[
51-
AC_LANG_SOURCE(
52-
[[#include <arm_neon.h>
53-
#include <stdio.h>
54-
extern void exit(int);
55-
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}]]
56-
)]
57-
,[CPU_BEST_FLAGS="-march=armv8-a+simd"]
58-
[SIMD_NAME="ASIMD"]
59-
[AC_MSG_RESULT([yes])]
60-
[ARCH_LINK=arm64le.h]
61-
,[CPU_NOTFOUND="1"]
62-
[AC_MSG_RESULT(no)]
63-
)
47+
if test "$CPU_BIT_STR" -eq 64; then
48+
CC="$CC_BACKUP -march=armv8-a+simd"
49+
AC_MSG_CHECKING([for ASIMD])
50+
AC_RUN_IFELSE(
51+
[
52+
AC_LANG_SOURCE(
53+
[[#include <arm_neon.h>
54+
#include <stdio.h>
55+
extern void exit(int);
56+
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}]]
57+
)]
58+
,[CPU_BEST_FLAGS="-march=armv8-a+simd"]
59+
[SIMD_NAME="ASIMD"]
60+
[AC_MSG_RESULT([yes])]
61+
[ARCH_LINK=arm64le.h]
62+
,[CPU_NOTFOUND="1"]
63+
[AC_MSG_RESULT(no)]
64+
)
65+
fi
6466
else
6567
dnl ======================================================================
6668
dnl cross-compile versions of the same tests
@@ -81,23 +83,25 @@ dnl ======================================================================
8183
,[CPU_NOTFOUND="1"]
8284
[AC_MSG_RESULT(no)]
8385
)
84-
AC_MSG_CHECKING([for ASIMD])
85-
CC="$CC_BACKUP -march=armv8-a+simd"
86-
AC_LINK_IFELSE(
87-
[
88-
AC_LANG_SOURCE(
89-
[[#include <arm_neon.h>
90-
#include <stdio.h>
91-
extern void exit(int);
92-
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}]]
93-
)]
94-
,[CPU_BEST_FLAGS="-march=armv8-a+simd"]
95-
[SIMD_NAME="ASIMD"]
96-
[ARCH_LINK=arm64le.h]
97-
[AC_MSG_RESULT([yes])]
98-
,[CPU_NOTFOUND="1"]
99-
[AC_MSG_RESULT(no)]
100-
)
86+
if test "$CPU_BIT_STR" -eq 64; then
87+
AC_MSG_CHECKING([for ASIMD])
88+
CC="$CC_BACKUP -march=armv8-a+simd"
89+
AC_LINK_IFELSE(
90+
[
91+
AC_LANG_SOURCE(
92+
[[#include <arm_neon.h>
93+
#include <stdio.h>
94+
extern void exit(int);
95+
int main(){uint32x4_t t;*((long*)&t)=1;t=veorq_u32(t,t);if((*(unsigned*)&t)==88)printf(".");exit(0);}]]
96+
)]
97+
,[CPU_BEST_FLAGS="-march=armv8-a+simd"]
98+
[SIMD_NAME="ASIMD"]
99+
[ARCH_LINK=arm64le.h]
100+
[AC_MSG_RESULT([yes])]
101+
,[CPU_NOTFOUND="1"]
102+
[AC_MSG_RESULT(no)]
103+
)
104+
fi
101105
fi
102106
fi
103107

0 commit comments

Comments
 (0)