1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/s390.
4 AC_CACHE_CHECK(for __builtin_tbegin, libc_cv_gcc_builtin_tbegin, [dnl
5 cat > conftest.c <<\EOF
7 void testtransaction ()
9 if (__builtin_tbegin (0) == _HTM_TBEGIN_STARTED)
16 dnl test, if the tbegin instruction is used by __builtin_tbegin
17 if AC_TRY_COMMAND([${CC-cc} -mhtm -O2 -S conftest.c -o - | grep -w tbegin > /dev/null]) ;
19 libc_cv_gcc_builtin_tbegin=yes
21 libc_cv_gcc_builtin_tbegin=no
25 if test "$libc_cv_gcc_builtin_tbegin" = no ; then
26 critic_missing="$critic_missing The used GCC has no support for __builtin_tbegin, which is needed for lock-elision on target S390."
30 AC_CACHE_CHECK([for S390 vector instruction support], libc_cv_asm_s390_vx, [
31 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
34 __asm__ (".machine \"z13\" \n\t"
35 ".machinemode \"zarch_nohighgprs\" \n\t"
36 "vistrbs %%v16,%%v17 \n\t"
37 "locghie %%r1,0" : :);
40 [libc_cv_asm_s390_vx=yes],
41 [libc_cv_asm_s390_vx=no])])
42 if test "$libc_cv_asm_s390_vx" = yes ;
44 AC_DEFINE(HAVE_S390_VX_ASM_SUPPORT)
46 AC_MSG_WARN([Use binutils with vector-support in order to use optimized implementations.])
50 dnl test, if gcc supports S390 vector registers as clobber in inline assembly
51 AC_CACHE_CHECK([for S390 vector support in gcc], libc_cv_gcc_s390_vx, [
52 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
53 void testvecclobber ()
55 __asm__ ("" : : : "v16");
58 [libc_cv_gcc_s390_vx=yes],
59 [libc_cv_gcc_s390_vx=no])])
60 if test "$libc_cv_gcc_s390_vx" = yes ;
62 AC_DEFINE(HAVE_S390_VX_GCC_SUPPORT)
66 AC_CACHE_CHECK([for S390 arch13 zarch instruction support],
67 libc_cv_asm_s390_arch13, [
68 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
69 void testinsn (char *buf)
71 __asm__ (".machine \"arch13\" \n\t"
72 ".machinemode \"zarch_nohighgprs\" \n\t"
74 "mvcrl 0(%0),32(%0) \n\t"
75 "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
76 : : "a" (buf) : "memory", "r0");
79 [libc_cv_asm_s390_arch13=yes],
80 [libc_cv_asm_s390_arch13=no])])
81 if test "$libc_cv_asm_s390_arch13" = yes ;
83 AC_DEFINE(HAVE_S390_ARCH13_ASM_SUPPORT)
87 AC_CACHE_CHECK([for S390 z10 zarch instruction support as default],
88 libc_cv_asm_s390_min_z10_zarch, [
89 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
90 void testinsn (void *a, void *b, int n)
92 __asm__ ("exrl %2,1f \n\t"
94 "1: mvc 0(1,%0),0(%1) \n\t"
96 : : "a" (a), "a" (b), "d" (n)
100 [libc_cv_asm_s390_min_z10_zarch=yes],
101 [libc_cv_asm_s390_min_z10_zarch=no])])
102 if test "$libc_cv_asm_s390_min_z10_zarch" = yes ;
104 AC_DEFINE(HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT)
108 AC_CACHE_CHECK([for S390 z196 zarch instruction support as default],
109 libc_cv_asm_s390_min_z196_zarch, [
110 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
111 float testinsn (double e)
114 __asm__ ("ledbra %0,5,%1,4" : "=f" (d) : "f" (e) );
118 [libc_cv_asm_s390_min_z196_zarch=yes],
119 [libc_cv_asm_s390_min_z196_zarch=no])])
120 if test "$libc_cv_asm_s390_min_z196_zarch" = yes ;
122 AC_DEFINE(HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT)
126 AC_CACHE_CHECK([for S390 z13 zarch instruction support as default],
127 libc_cv_asm_s390_min_z13_zarch, [
128 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
132 __asm__ ("vl %%v16,0(%%r15)\n\t"
134 : "=d" (i) : : "memory", "v16");
138 [libc_cv_asm_s390_min_z13_zarch=yes],
139 [libc_cv_asm_s390_min_z13_zarch=no])])
140 if test "$libc_cv_asm_s390_min_z13_zarch" = yes ;
142 AC_DEFINE(HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT)
146 AC_CACHE_CHECK([for S390 arch13 zarch instruction support as default],
147 libc_cv_asm_s390_min_arch13_zarch, [
148 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
149 void testinsn (char *buf)
151 __asm__ ("lghi %%r0,16 \n\t"
152 "mvcrl 0(%0),32(%0) \n\t"
153 "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
154 : : "a" (buf) : "memory", "r0");
157 [libc_cv_asm_s390_min_arch13_zarch=yes],
158 [libc_cv_asm_s390_min_arch13_zarch=no])])
159 if test "$libc_cv_asm_s390_min_arch13_zarch" = yes ;
161 AC_DEFINE(HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT)
165 dnl test if GCC is new enough. See gcc "Bug 98269 - gcc 6.5.0
166 dnl __builtin_add_overflow() with small uint32_t values incorrectly detects
168 dnl (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269)
169 AC_CACHE_CHECK([if $CC is sufficient to build libc on s390x],
170 libc_cv_compiler_ok_on_s390x, [
171 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
172 #if !defined __GNUC__ || __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 1)
173 #error insufficient compiler for building on s390x
176 [libc_cv_compiler_ok_on_s390x=yes],
177 [libc_cv_compiler_ok_on_s390x=no])])
178 if test "$libc_cv_compiler_ok_on_s390x" != yes; then
179 critic_missing="$critic_missing On s390x, GCC >= 7.1.0 is required."
182 test -n "$critic_missing" && AC_MSG_ERROR([
183 *** $critic_missing])