@@ -88,15 +88,74 @@ define(X86_PATTERN,
88
88
define ( X86_64_PATTERN ,
89
89
[ [ athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | zen*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | tremont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-* | icelake*-*-* | tigerlake*-*-* | rocketlake*-*-* | alderlake*-*-* | raptorlake*-*-*] ] )
90
90
91
+ define ( X86_64_ADX_PATTERN ,
92
+ [ [ zen*-*-* | x86_64-v3*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-* | icelake*-*-* | tigerlake*-*-* | rocketlake*-*-* | alderlake*-*-* | raptorlake*-*-*] ] )
93
+
91
94
define ( ARM64_PATTERN ,
92
- [ [ aarch64-*-*] ] )
95
+ [ [ armcortexa53-*-* | armcortexa53neon-*-* | armcortexa55-*-* | armcortexa55neon-*-* | armcortexa57-*-* | armcortexa57neon-*-* | armcortexa7 [ 2-9 ] -*-* | armcortexa7 [ 2-9 ] neon-*-* | armexynosm1-*-* | armthunderx-*-* | armxgene1-*-* | aarch64*-*-* | applem [ 1-9 ] *-*-* | armv8* -*-*] ] )
93
96
94
97
define ( SLOW_VROUNDPD_PATTERN ,
95
98
[ [ haswell* | broadwell* | skylake* | kabylake* | icelake* | tigerlake* | rocketlake* | alderlake* | raptorlake*] ] )
96
99
97
100
define ( FAST_VROUNDPD_PATTERN ,
98
101
[ [ znver[ 2-4] * | sandybridge* | ivybridge*] ] )
99
102
103
+
104
+ dnl FLINT_CHECK_CPU_SET_T([action-if-true],[action-if-false])
105
+ dnl -----------------------
106
+ dnl Checks if cpu_set_t is supported.
107
+ dnl
108
+ dnl FIXME: Does this cover all BSD systems?
109
+
110
+ AC_DEFUN ( [ FLINT_CHECK_CPU_SET_T] ,
111
+ [ AC_CACHE_CHECK ( [ if cpu_set_t is supported] ,
112
+ flint_cv_check_cpu_set_t ,
113
+ [ flint_cv_check_cpu_set_t="no"
114
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [
115
+ #define _GNU_SOURCE
116
+ #include <sched.h>
117
+ #include <pthread.h>
118
+ ] ,
119
+ [ cpu_set_t s;
120
+ CPU_ZERO(&s);
121
+ pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), 0);] ) ] ,
122
+ [ flint_cv_check_cpu_set_t="yes"] )
123
+ ] )
124
+ AS_VAR_IF ( [ flint_cv_check_cpu_set_t] ,"yes" ,
125
+ [ m4_default ( [ $1 ] , : ) ] ,
126
+ [ m4_default ( [ $2 ] , : ) ] )
127
+ ] )
128
+
129
+
130
+ dnl FLINT_CHECK_NTL([action-if-true],[action-if-false])
131
+ dnl -----------------------
132
+ dnl Checks if linking with NTL works.
133
+
134
+ AC_DEFUN ( [ FLINT_CHECK_NTL] ,
135
+ [ AC_REQUIRE ( [ AC_PROG_CXX ] )
136
+ AC_CACHE_CHECK ( [ if linking with NTL works] ,
137
+ flint_cv_check_ntl ,
138
+ [ flint_cv_check_ntl="no"
139
+ save_LIBS="$LIBS"
140
+ LIBS="-lntl $LIBS"
141
+ AC_LANG_PUSH ( [ C++] )
142
+ AC_LINK_IFELSE ( [ AC_LANG_PROGRAM (
143
+ [ [ #include <NTL/ZZ.h>
144
+ ] ] , [ NTL::ZZ a, b, c;
145
+ std::cin >> a;
146
+ std::cin >> b;
147
+ c = (a+1)*(b+1);
148
+ std::cout << c << "\n";] ) ] ,
149
+ [ flint_cv_check_ntl="yes"] )
150
+ AC_LANG_POP ( [ C++] )
151
+ LIBS="$save_LIBS"
152
+ ] )
153
+ AS_VAR_IF ( [ flint_cv_check_ntl] ,"yes" ,
154
+ [ m4_default ( [ $1 ] , : ) ] ,
155
+ [ m4_default ( [ $2 ] , : ) ] )
156
+ ] )
157
+
158
+
100
159
dnl FLINT_PREPROC_IFELSE(input,[action-if-true],[action-if-false])
101
160
dnl -----------------------
102
161
dnl Runs preprocessor with CFLAGS.
@@ -114,48 +173,6 @@ ac_cpp="$ac_cpp"
114
173
] )
115
174
116
175
117
- dnl FLINT_ARCH
118
- dnl -----------------------
119
- dnl Checks compiler for architectures.
120
- dnl
121
- dnl NOTE: This has to be called after all CFLAGS has been gathered.
122
- dnl
123
- dnl FIXME: Currently only Clang and GCC. Support more compilers?
124
-
125
- AC_DEFUN ( [ FLINT_ARCH] ,
126
- [ AC_CACHE_CHECK ( [ for host architecture] ,
127
- flint_cv_arch ,
128
- [ flint_cv_arch="unknown"
129
- is_gnu="no"
130
- AC_PREPROC_IFELSE ( [ AC_LANG_SOURCE ( [
131
- #ifndef __GNUC__
132
- # error
133
- error
134
- #endif
135
- ] ) ] ,
136
- [ is_gnu="yes"] )
137
-
138
- dnl We only know how to proceed with GCC or Clang
139
- AS_VAR_IF ( [ is_gnu] ,"yes" ,[
140
- is_clang="no"
141
- AC_PREPROC_IFELSE ( [ AC_LANG_SOURCE ( [
142
- #ifndef __clang__
143
- # error
144
- error
145
- #endif
146
- ] ) ] ,
147
- [ is_clang="yes"] )
148
-
149
- AS_VAR_IF ( [ is_clang] ,"yes" ,[
150
- flint_cv_arch=[ `echo | $CC -v $CFLAGS -E - 2>&1 | grep "cc1" | sed -n 's/.*-target-cpu \([ ^ ] *\).*/\1/p'`]
151
- ] ,[
152
- flint_cv_arch=[ `echo | $CC -v $CFLAGS -E - 2>&1 | grep "cc1" | sed -n 's/.*-march=\([ ^ ] *\).*/\1/p'`]
153
- ] )
154
- ] )
155
- ] )
156
- ] )
157
-
158
-
159
176
dnl FLINT_CHECK_GMP_H(MAJOR, MINOR, PATCHLEVEL)
160
177
dnl -----------------------
161
178
dnl Checks that gmp.h can be found and that its version fullfills the version
263
280
] )
264
281
] )
265
282
266
- dnl FLINT_SYSTEM_V_ABI([action-success][,action-fail])
267
- dnl -----------------------
268
- dnl Checks if System V ABI.
269
- dnl Do "action-success" if this succeeds, "action-fail" if not.
270
-
271
- AC_DEFUN ( [ FLINT_SYSTEM_V_ABI] ,
272
- [ AC_CACHE_CHECK ( [ if system uses System V ABI] ,
273
- flint_cv_system_v_abi ,
274
- AC_PREPROC_IFELSE ( [ AC_LANG_PROGRAM ( [ ] ,[
275
- #if !(defined(__APPLE__) || defined(__unix__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)) || defined(__CYGWIN__)
276
- #error Dead man
277
- error
278
- #endif
279
- ] ) ] ,
280
- [ flint_cv_system_v_abi="yes"] ,
281
- [ flint_cv_system_v_abi="no"]
282
- ) )
283
- AS_VAR_IF ( [ flint_cv_system_v_abi] ,"yes" ,
284
- [ m4_default ( [ $1 ] , : ) ] ,
285
- [ m4_default ( [ $2 ] , : ) ] )
286
- ] )
287
-
288
-
289
- dnl FLINT_CHECK_ADX([action-success][,action-fail])
290
- dnl -----------------------
291
- dnl Checks if CPU supports the ADX instruction set. Will only run if host CPU
292
- dnl is x86_64. Do "action-success" if this succeeds, "action-fail" if not.
293
-
294
- AC_DEFUN ( [ FLINT_CHECK_ADX] ,
295
- [ AS_VAR_IF ( [ host_cpu] ,"x86_64" ,
296
- [ AC_CACHE_CHECK ( [ if ADX instruction set is supported by CPU] ,
297
- flint_cv_check_adx ,
298
- FLINT_PREPROC_IFELSE ( [ AC_LANG_SOURCE ( [
299
- #if !defined(__ADX__)
300
- #error Dead man
301
- error
302
- #endif
303
- ] ) ] ,
304
- flint_cv_check_adx="yes" ,
305
- flint_cv_check_adx="no" )
306
- ) ] )
307
- AS_VAR_IF ( flint_cv_check_adx ,yes ,
308
- [ m4_default ( [ $1 ] , : ) ] ,
309
- [ m4_default ( [ $2 ] , : ) ] )
310
- ] )
311
-
312
-
313
- dnl FLINT_CHECK_ARMV8([action-success][,action-fail])
314
- dnl -----------------------
315
- dnl Checks if CPU supports the ARM v8-A instruction set. Will only run if host
316
- dnl CPU is aarch64. Do "action-success" if this succeeds, "action-fail" if not.
317
-
318
- AC_DEFUN ( [ FLINT_CHECK_ARMV8] ,
319
- [ AS_VAR_IF ( [ host_cpu] ,"aarch64" ,
320
- [ AC_CACHE_CHECK ( [ if ARM v8-A instruction set is supported by CPU] ,
321
- flint_cv_check_armv8a ,
322
- FLINT_PREPROC_IFELSE ( [ AC_LANG_SOURCE ( [
323
- #if __ARM_ARCH != 8
324
- #error Dead man
325
- error
326
- #endif
327
- ] ) ] ,
328
- flint_cv_check_armv8a="yes" ,
329
- flint_cv_check_armv8a="no" )
330
- ) ] )
331
- AS_VAR_IF ( flint_cv_check_armv8a ,yes ,
332
- [ m4_default ( [ $1 ] , : ) ] ,
333
- [ m4_default ( [ $2 ] , : ) ] )
334
- ] )
335
-
336
-
337
- dnl FLINT_HAVE_ASM([action-success][,action-fail])
338
- dnl -----------------------
339
- dnl Checks if system use FLINT's assembly.
340
- dnl Do "action-success" if this succeeds, "action-fail" if not.
341
-
342
- AC_DEFUN ( [ FLINT_HAVE_ASM] ,
343
- [ AC_REQUIRE ( [ FLINT_ABI] )
344
- AC_REQUIRE ( [ FLINT_SYSTEM_V_ABI] )
345
- AC_REQUIRE ( [ FLINT_CHECK_ADX] )
346
- AC_REQUIRE ( [ FLINT_CHECK_ARMV8] )
347
-
348
- AC_CACHE_CHECK ( [ if system can use FLINT's assembly] ,
349
- flint_cv_have_asm ,
350
- [ flint_cv_have_asm="no"
351
- if test "$flint_cv_abi" = "64" && test "$flint_cv_system_v_abi" = "yes";
352
- then
353
- if test "$flint_cv_check_adx" = "yes" || test "$flint_cv_check_armv8a" = "yes";
354
- then
355
- flint_cv_have_asm="yes"
356
- fi
357
- fi] )
358
-
359
- AS_VAR_IF ( [ flint_cv_have_asm] ,"yes" ,
360
- [ m4_default ( [ $1 ] , : ) ] ,
361
- [ m4_default ( [ $2 ] , : ) ] )
362
- ] )
363
-
364
283
365
284
dnl FLINT_HAVE_FFT_SMALL_ARM_H
366
285
dnl -----------------------
0 commit comments