]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Check if -mamx-tile works for testing
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 18 Dec 2024 10:56:14 +0000 (18:56 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 21 Dec 2024 22:07:17 +0000 (06:07 +0800)
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>
sysdeps/x86_64/configure
sysdeps/x86_64/configure.ac

index 5846b67c2fb7f928cd2066c9aa566ae89d5de191..bbf520bfc9c16c97e943bf5c92311e25fffb7fb9 100755 (executable)
@@ -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
index fcf457d03b66697a2ef7cc1414eb7dfed1cde8bf..4a3f7f454101455fe8ac59fb02fafbf3e4be29d1 100644 (file)
@@ -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,