aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-12-18 18:56:14 +0800
committerH.J. Lu <hjl.tools@gmail.com>2024-12-22 06:07:17 +0800
commit88499d61bd9a36ae3f6bcf11dd8c33ed42062fc5 (patch)
tree477628d6f7c1be2e166e090fd317720dbb445ab0 /sysdeps
parent265e13d33c470446043a3d2033984a1197151e09 (diff)
downloadglibc-88499d61bd9a36ae3f6bcf11dd8c33ed42062fc5.zip
glibc-88499d61bd9a36ae3f6bcf11dd8c33ed42062fc5.tar.gz
glibc-88499d61bd9a36ae3f6bcf11dd8c33ed42062fc5.tar.bz2
Check if -mamx-tile works for testing
Since -mamx-tile is used only for testing, use LIBC_TRY_TEST_CC_COMMAND, instead of LIBC_TRY_CC_AND_TEST_CC_COMMAND to check it and don't check __builtin_ia32_ldtilecfg for Clang. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sysdeps')
-rwxr-xr-xsysdeps/x86_64/configure63
-rw-r--r--sysdeps/x86_64/configure.ac32
2 files changed, 32 insertions, 63 deletions
diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
index 5846b67..bbf520b 100755
--- a/sysdeps/x86_64/configure
+++ b/sysdeps/x86_64/configure
@@ -211,46 +211,10 @@ config_vars="$config_vars
enable-cet = $enable_cet"
# Check if -mamx-tile works properly.
-check_x86_have_amx_tile ()
-{
- eval $1=no
- if grep -q __builtin_ia32_ldtilecfg conftest; then
- eval $1=yes
- fi
-}
-
-conftest_code="
-#include <x86intrin.h>
-"
cat > conftest.c <<EOF
-$conftest_code
+#include <x86intrin.h>
EOF
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -mamx-tile works properly" >&5
-printf %s "checking whether -mamx-tile works properly... " >&6; }
-if test ${libc_cv_x86_have_amx_tile+y}
-then :
- printf %s "(cached) " >&6
-else case e in #(
- e) if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -E -mamx-tile conftest.c -o conftest 1>&5'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }
- then
- check_x86_have_amx_tile libc_cv_x86_have_amx_tile
- else
- libc_cv_x86_have_amx_tile=no
- fi
- ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_x86_have_amx_tile" >&5
-printf "%s\n" "$libc_cv_x86_have_amx_tile" >&6; }
-if test "$TEST_CC" = "$CC"; then
- libc_cv_test_x86_have_amx_tile=$libc_cv_x86_have_amx_tile
-else
saved_CC="$CC"
CC="$TEST_CC"
@@ -260,17 +224,27 @@ if test ${libc_cv_test_x86_have_amx_tile+y}
then :
printf %s "(cached) " >&6
else case e in #(
- e) if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -E -mamx-tile conftest.c -o conftest 1>&5'
+ e) if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -E -mamx-tile conftest.c -o conftest 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }
- then
- check_x86_have_amx_tile libc_cv_test_x86_have_amx_tile
- else
- libc_cv_test_x86_have_amx_tile=no
- fi ;;
+ then
+
+if test $libc_cv_test_clang = yes; then
+ libc_cv_test_x86_have_amx_tile=yes
+else
+ if grep -q __builtin_ia32_ldtilecfg conftest; then
+ libc_cv_test_x86_have_amx_tile=yes
+ else
+ libc_cv_test_x86_have_amx_tile=no
+ fi
+fi
+
+ else
+ libc_cv_test_x86_have_amx_tile=no
+ fi ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_x86_have_amx_tile" >&5
@@ -278,10 +252,9 @@ printf "%s\n" "$libc_cv_test_x86_have_amx_tile" >&6; }
CC="$saved_CC"
-fi
rm -f conftest*
config_vars="$config_vars
-have-mamx-tile = $libc_cv_x86_have_amx_tile"
+have-mamx-tile = $libc_cv_test_x86_have_amx_tile"
# Check if -mapxf is enabled.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -mapxf is enabled" >&5
diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
index fcf457d..4a3f7f4 100644
--- a/sysdeps/x86_64/configure.ac
+++ b/sysdeps/x86_64/configure.ac
@@ -68,27 +68,23 @@ fi
LIBC_CONFIG_VAR([enable-cet], [$enable_cet])
# Check if -mamx-tile works properly.
-check_x86_have_amx_tile ()
-{
- eval $1=no
- if grep -q __builtin_ia32_ldtilecfg conftest; then
- eval $1=yes
- fi
-}
-
-conftest_code="
-#include <x86intrin.h>
-"
-LIBC_TRY_CC_AND_TEST_CC_COMMAND([whether -mamx-tile works properly],
- [$conftest_code],
+LIBC_TRY_TEST_CC_COMMAND([whether -mamx-tile works properly],
+ [#include <x86intrin.h>],
[-E -mamx-tile],
- libc_cv_x86_have_amx_tile,
- [check_x86_have_amx_tile libc_cv_x86_have_amx_tile],
- [libc_cv_x86_have_amx_tile=no],
libc_cv_test_x86_have_amx_tile,
- [check_x86_have_amx_tile libc_cv_test_x86_have_amx_tile],
+ [
+if test $libc_cv_test_clang = yes; then
+ libc_cv_test_x86_have_amx_tile=yes
+else
+ if grep -q __builtin_ia32_ldtilecfg conftest; then
+ libc_cv_test_x86_have_amx_tile=yes
+ else
+ libc_cv_test_x86_have_amx_tile=no
+ fi
+fi
+ ],
[libc_cv_test_x86_have_amx_tile=no])
-LIBC_CONFIG_VAR([have-mamx-tile], [$libc_cv_x86_have_amx_tile])
+LIBC_CONFIG_VAR([have-mamx-tile], [$libc_cv_test_x86_have_amx_tile])
# Check if -mapxf is enabled.
AC_CACHE_CHECK(whether -mapxf is enabled,