S390: Also check vector support in memmove ifunc-selector [BZ #27511]
[glibc.git] / sysdeps / s390 / configure.ac
blobe6df62491907c8b5562a0942ca7c9d533a4ec486
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/s390.
4 dnl It is always possible to access static and hidden symbols in an
5 dnl position independent way.
6 AC_DEFINE(PI_STATIC_AND_HIDDEN)
8 AC_CACHE_CHECK(for __builtin_tbegin, libc_cv_gcc_builtin_tbegin, [dnl
9 cat > conftest.c <<\EOF
10 #include <htmintrin.h>
11 void testtransaction ()
13   if (__builtin_tbegin (0) == _HTM_TBEGIN_STARTED)
14     {
15       __builtin_tend ();
16     }
18 EOF
19 dnl
20 dnl test, if the tbegin instruction is used by __builtin_tbegin
21 if AC_TRY_COMMAND([${CC-cc} -mhtm -O2 -S conftest.c -o - | grep -w tbegin > /dev/null]) ;
22 then
23   libc_cv_gcc_builtin_tbegin=yes
24 else
25   libc_cv_gcc_builtin_tbegin=no
27 rm -f conftest* ])
29 if test "$libc_cv_gcc_builtin_tbegin" = no ; then
30    critic_missing="$critic_missing The used GCC has no support for __builtin_tbegin, which is needed for lock-elision on target S390."
34 AC_CACHE_CHECK(for S390 vector instruction support, libc_cv_asm_s390_vx, [dnl
35 cat > conftest.c <<\EOF
36 void testvecinsn ()
38     __asm__ (".machine \"z13\" \n\t"
39              ".machinemode \"zarch_nohighgprs\" \n\t"
40              "vistrbs %%v16,%%v17 \n\t"
41              "locghie %%r1,0" : :);
43 EOF
44 dnl
45 dnl test, if assembler supports S390 vector instructions
46 if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
47 then
48   libc_cv_asm_s390_vx=yes
49 else
50   libc_cv_asm_s390_vx=no
52 rm -f conftest* ])
54 if test "$libc_cv_asm_s390_vx" = yes ;
55 then
56   AC_DEFINE(HAVE_S390_VX_ASM_SUPPORT)
57 else
58   AC_MSG_WARN([Use binutils with vector-support in order to use optimized implementations.])
61 AC_CACHE_CHECK(for S390 vector support in gcc, libc_cv_gcc_s390_vx, [dnl
62 cat > conftest.c <<\EOF
63 void testvecclobber ()
65   __asm__ ("" : : : "v16");
67 EOF
68 dnl
69 dnl test, if gcc supports S390 vector registers as clobber in inline assembly
70 if AC_TRY_COMMAND([${CC-cc} --shared conftest.c -o conftest.o &> /dev/null]) ;
71 then
72   libc_cv_gcc_s390_vx=yes
73 else
74   libc_cv_gcc_s390_vx=no
76 rm -f conftest* ])
78 if test "$libc_cv_gcc_s390_vx" = yes ;
79 then
80   AC_DEFINE(HAVE_S390_VX_GCC_SUPPORT)
83 AC_CACHE_CHECK(for S390 arch13 zarch instruction support,
84                libc_cv_asm_s390_arch13, [dnl
85 cat > conftest.c <<\EOF
86 void testinsn (char *buf)
88     __asm__ (".machine \"arch13\" \n\t"
89              ".machinemode \"zarch_nohighgprs\" \n\t"
90              "lghi %%r0,16 \n\t"
91              "mvcrl 0(%0),32(%0) \n\t"
92              "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
93              : : "a" (buf) : "memory", "r0");
95 EOF
96 dnl test, if assembler supports S390 arch13 instructions
97 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
98                         -o conftest.o &> /dev/null]) ;
99 then
100   libc_cv_asm_s390_arch13=yes
101 else
102   libc_cv_asm_s390_arch13=no
104 rm -f conftest* ])
105 if test "$libc_cv_asm_s390_arch13" = yes ;
106 then
107   AC_DEFINE(HAVE_S390_ARCH13_ASM_SUPPORT)
111 AC_CACHE_CHECK(for S390 z10 zarch instruction support as default,
112                libc_cv_asm_s390_min_z10_zarch, [dnl
113 cat > conftest.c <<\EOF
114 void testinsn (void *a, void *b, int n)
116     __asm__ ("exrl %2,1f \n\t"
117              "j 2f \n\t"
118              "1: mvc 0(1,%0),0(%1) \n\t"
119              "2:"
120              : : "a" (a), "a" (b), "d" (n)
121              : "memory", "cc");
125 dnl test, if assembler supports S390 z10 zarch instructions as default
126 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
127                         -o conftest.o &> /dev/null]) ;
128 then
129   libc_cv_asm_s390_min_z10_zarch=yes
130 else
131   libc_cv_asm_s390_min_z10_zarch=no
133 rm -f conftest* ])
135 if test "$libc_cv_asm_s390_min_z10_zarch" = yes ;
136 then
137   AC_DEFINE(HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT)
140 AC_CACHE_CHECK(for S390 z196 zarch instruction support as default,
141                libc_cv_asm_s390_min_z196_zarch, [dnl
142 cat > conftest.c <<\EOF
143 float testinsn (double e)
145     float d;
146     __asm__ ("ledbra %0,5,%1,4" : "=f" (d) : "f" (e) );
147     return d;
151 dnl test, if assembler supports S390 z196 zarch instructions as default
152 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
153                         -o conftest.o &> /dev/null]) ;
154 then
155   libc_cv_asm_s390_min_z196_zarch=yes
156 else
157   libc_cv_asm_s390_min_z196_zarch=no
159 rm -f conftest* ])
161 if test "$libc_cv_asm_s390_min_z196_zarch" = yes ;
162 then
163   AC_DEFINE(HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT)
166 AC_CACHE_CHECK(for S390 z13 zarch instruction support as default,
167                libc_cv_asm_s390_min_z13_zarch, [dnl
168 cat > conftest.c <<\EOF
169 int testinsn (void)
171     int i;
172     __asm__ ("vl %%v16,0(%%r15)\n\t"
173              "vlgvf %0,%%v16,0"
174              : "=d" (i) : : "memory", "v16");
175     return i;
179 dnl test, if assembler supports S390 z13 zarch instructions as default
180 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
181                         -o conftest.o &> /dev/null]) ;
182 then
183   libc_cv_asm_s390_min_z13_zarch=yes
184 else
185   libc_cv_asm_s390_min_z13_zarch=no
187 rm -f conftest* ])
189 if test "$libc_cv_asm_s390_min_z13_zarch" = yes ;
190 then
191   AC_DEFINE(HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT)
194 AC_CACHE_CHECK(for S390 arch13 zarch instruction support as default,
195                libc_cv_asm_s390_min_arch13_zarch, [dnl
196 cat > conftest.c <<\EOF
197 void testinsn (char *buf)
199     __asm__ ("lghi %%r0,16 \n\t"
200              "mvcrl 0(%0),32(%0) \n\t"
201              "vstrs %%v20,%%v20,%%v20,%%v20,0,2"
202              : : "a" (buf) : "memory", "r0");
205 dnl test, if assembler supports S390 arch13 zarch instructions as default
206 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c
207                         -o conftest.o &> /dev/null]) ;
208 then
209   libc_cv_asm_s390_min_arch13_zarch=yes
210 else
211   libc_cv_asm_s390_min_arch13_zarch=no
213 rm -f conftest* ])
214 if test "$libc_cv_asm_s390_min_arch13_zarch" = yes ;
215 then
216   AC_DEFINE(HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT)
219 dnl test if GCC is new enough. See gcc "Bug 98269 - gcc 6.5.0
220 dnl __builtin_add_overflow() with small uint32_t values incorrectly detects
221 dnl overflow
222 dnl (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269)
223 AC_CACHE_CHECK([if $CC is sufficient to build libc on s390x],
224 libc_cv_compiler_ok_on_s390x, [
225 AC_TRY_COMPILE([], [
226 #if !defined __GNUC__ || __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 1)
227 #error insufficient compiler for building on s390x
228 #endif
230         [libc_cv_compiler_ok_on_s390x=yes],
231         [libc_cv_compiler_ok_on_s390x=no])])
232 if test "$libc_cv_compiler_ok_on_s390x" != yes; then
233    critic_missing="$critic_missing On s390x, GCC >= 7.1.0 is required."
236 test -n "$critic_missing" && AC_MSG_ERROR([
237 *** $critic_missing])