about summary refs log tree commit diff
path: root/sysdeps/x86_64/configure.ac
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-02-28 12:08:03 -0800
committerH.J. Lu <hjl.tools@gmail.com>2024-04-01 10:55:17 -0700
commit853e915fdd6ae6c5f1a7a68d2594ec8dbfef1286 (patch)
tree4daa8c3b1c53af6e65a84c94abee88b11fef669b /sysdeps/x86_64/configure.ac
parenta364304718725a31ab141936322855c76c73e35e (diff)
downloadglibc-853e915fdd6ae6c5f1a7a68d2594ec8dbfef1286.tar.gz
glibc-853e915fdd6ae6c5f1a7a68d2594ec8dbfef1286.tar.xz
glibc-853e915fdd6ae6c5f1a7a68d2594ec8dbfef1286.zip
x86-64: Update _dl_tlsdesc_dynamic to preserve AMX registers
_dl_tlsdesc_dynamic should also preserve AMX registers which are
caller-saved.  Add X86_XSTATE_TILECFG_ID and X86_XSTATE_TILEDATA_ID
to x86-64 TLSDESC_CALL_STATE_SAVE_MASK.  Compute the AMX state size
and save it in xsave_state_full_size which is only used by
_dl_tlsdesc_dynamic_xsave and _dl_tlsdesc_dynamic_xsavec.  This fixes
the AMX part of BZ #31372.  Tested on AMX processor.

AMX test is enabled only for compilers with the fix for

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114098

GCC 14 and GCC 11/12/13 branches have the bug fix.
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>

(cherry picked from commit 9b7091415af47082664717210ac49d51551456ab)
Diffstat (limited to 'sysdeps/x86_64/configure.ac')
-rw-r--r--sysdeps/x86_64/configure.ac15
1 files changed, 15 insertions, 0 deletions
diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
index d1f803c02e..c714c47351 100644
--- a/sysdeps/x86_64/configure.ac
+++ b/sysdeps/x86_64/configure.ac
@@ -61,5 +61,20 @@ elif test $enable_cet = permissive; then
 fi
 LIBC_CONFIG_VAR([enable-cet], [$enable_cet])
 
+# Check if -mamx-tile works properly.
+AC_CACHE_CHECK(whether -mamx-tile works properly,
+	       libc_cv_x86_have_amx_tile, [dnl
+cat > conftest.c <<EOF
+#include <x86intrin.h>
+EOF
+	       libc_cv_x86_have_amx_tile=no
+	       if AC_TRY_COMMAND(${CC-cc} -E $CFLAGS -mamx-tile conftest.c > conftest.i); then
+		 if grep -q __builtin_ia32_ldtilecfg conftest.i; then
+		   libc_cv_x86_have_amx_tile=yes
+	         fi
+	       fi
+	       rm -rf conftest*])
+LIBC_CONFIG_VAR([have-mamx-tile], [$libc_cv_x86_have_amx_tile])
+
 test -n "$critic_missing" && AC_MSG_ERROR([
 *** $critic_missing])