forked from mattsta/cmake-cpu-detect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPUFeatureDetect.cmake
878 lines (759 loc) · 32.3 KB
/
CPUFeatureDetect.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
# generated by parsing clang X86Target.def CPU definitions
include(CheckCSourceCompiles)
# Helper to generate final flags given current build type...
function(genFinalFlags RESULT_PREFIX)
# CMake doesn't have any case insensitive string compares, so nudge BUILD_TYPE:
string(TOUPPER "${CMAKE_BUILD_TYPE}" KNOWN_BUILD_TYPE)
set(FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} ")
if (KNOWN_BUILD_TYPE MATCHES DEBUG)
string(APPEND FLAGS "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_DEBUG} ")
elseif(KNOWN_BUILD_TYPE MATCHES RELEASE)
string(APPEND FLAGS "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE} ")
elseif(KNOWN_BUILD_TYPE MATCHES RELWITHDEBINFO)
string(APPEND FLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ")
elseif(KNOWN_BUILD_TYPE MATCHES MINSIZEREL)
string(APPEND FLAGS "${CMAKE_C_FLAGS_MINSIZEREL} ${CMAKE_CXX_FLAGS_MINSIZEREL} ")
endif()
set(${RESULT_PREFIX}_FLAGS ${FLAGS} PARENT_SCOPE)
endfunction(genFinalFlags)
# Yes, this function looks WEIRD because it has 100% duplicated behavior
# because CMake aggressively caches the results of feature detection.
#
# If we are cross-compiling against architectures, CMake will _never_ run
# the feature detection a second time even if we change all our compile flags.
#
# So, we ONLY run feature detection if we are using "march=native".
# If not using "march=native", parse cflags to check the arch for compilation.
#
# CPU features are based on our knowledge of compiler<->cpu interactions
# as obtained from clang's description of CPU features inside X86Target.def.
#
# Feature detection is looking at the defines you'd find just by using:
# > clang -march=native -dM -E - < /dev/null
function(genCPUFeatures RESULT_PREFIX)
# CMake doesn't have case insensitive string compares, so nudge BUILD_TYPE:
string(TOUPPER "${CMAKE_BUILD_TYPE}" KNOWN_BUILD_TYPE)
genFinalFlags(BUILDING)
if(CMAKE_BUILD_TYPE MATCHES Debug)
message("[${RESULT_PREFIX}] flags: ${genCPUFeaturesCachedFlags_${RESULT_PREFIX}}")
endif()
if(NOT (genCPUFeaturesCachedFlags_${RESULT_PREFIX} STREQUAL "${BUILDING_FLAGS}"))
if(CMAKE_BUILD_TYPE MATCHES Debug)
message("Checking features against build flags: ${BUILDING_FLAGS}")
endif()
set(genCPUFeaturesCachedFlags_${RESULT_PREFIX} ${BUILDING_FLAGS} CACHE INTERNAL "prevflag")
unset(${RESULT_PREFIX}_FEATURE_AES CACHE)
unset(${RESULT_PREFIX}_AES CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX CACHE)
unset(${RESULT_PREFIX}_AVX CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX2 CACHE)
unset(${RESULT_PREFIX}_AVX2 CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX5124FMAPS CACHE)
unset(${RESULT_PREFIX}_AVX5124FMAPS CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX5124VNNIW CACHE)
unset(${RESULT_PREFIX}_AVX5124VNNIW CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512BF16 CACHE)
unset(${RESULT_PREFIX}_AVX512BF16 CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512BITALG CACHE)
unset(${RESULT_PREFIX}_AVX512BITALG CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512BW CACHE)
unset(${RESULT_PREFIX}_AVX512BW CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512CD CACHE)
unset(${RESULT_PREFIX}_AVX512CD CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512DQ CACHE)
unset(${RESULT_PREFIX}_AVX512DQ CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512ER CACHE)
unset(${RESULT_PREFIX}_AVX512ER CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512F CACHE)
unset(${RESULT_PREFIX}_AVX512F CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512IFMA CACHE)
unset(${RESULT_PREFIX}_AVX512IFMA CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512PF CACHE)
unset(${RESULT_PREFIX}_AVX512PF CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512VBMI CACHE)
unset(${RESULT_PREFIX}_AVX512VBMI CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512VBMI2 CACHE)
unset(${RESULT_PREFIX}_AVX512VBMI2 CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512VL CACHE)
unset(${RESULT_PREFIX}_AVX512VL CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512VNNI CACHE)
unset(${RESULT_PREFIX}_AVX512VNNI CACHE)
unset(${RESULT_PREFIX}_FEATURE_AVX512VPOPCNTDQ CACHE)
unset(${RESULT_PREFIX}_AVX512VPOPCNTDQ CACHE)
unset(${RESULT_PREFIX}_FEATURE_BMI CACHE)
unset(${RESULT_PREFIX}_BMI CACHE)
unset(${RESULT_PREFIX}_FEATURE_BMI2 CACHE)
unset(${RESULT_PREFIX}_BMI2 CACHE)
unset(${RESULT_PREFIX}_FEATURE_CMOV CACHE)
unset(${RESULT_PREFIX}_CMOV CACHE)
unset(${RESULT_PREFIX}_FEATURE_FMA CACHE)
unset(${RESULT_PREFIX}_FMA CACHE)
unset(${RESULT_PREFIX}_FEATURE_FMA4 CACHE)
unset(${RESULT_PREFIX}_FMA4 CACHE)
unset(${RESULT_PREFIX}_FEATURE_GFNI CACHE)
unset(${RESULT_PREFIX}_GFNI CACHE)
unset(${RESULT_PREFIX}_FEATURE_MMX CACHE)
unset(${RESULT_PREFIX}_MMX CACHE)
unset(${RESULT_PREFIX}_FEATURE_PCLMUL CACHE)
unset(${RESULT_PREFIX}_PCLMUL CACHE)
unset(${RESULT_PREFIX}_FEATURE_POPCNT CACHE)
unset(${RESULT_PREFIX}_POPCNT CACHE)
unset(${RESULT_PREFIX}_FEATURE_SSE CACHE)
unset(${RESULT_PREFIX}_SSE CACHE)
unset(${RESULT_PREFIX}_FEATURE_SSE2 CACHE)
unset(${RESULT_PREFIX}_SSE2 CACHE)
unset(${RESULT_PREFIX}_FEATURE_SSE3 CACHE)
unset(${RESULT_PREFIX}_SSE3 CACHE)
unset(${RESULT_PREFIX}_FEATURE_SSE4_1 CACHE)
unset(${RESULT_PREFIX}_SSE4_1 CACHE)
unset(${RESULT_PREFIX}_FEATURE_SSE4_2 CACHE)
unset(${RESULT_PREFIX}_SSE4_2 CACHE)
unset(${RESULT_PREFIX}_FEATURE_SSE4_A CACHE)
unset(${RESULT_PREFIX}_SSE4_A CACHE)
unset(${RESULT_PREFIX}_FEATURE_SSSE3 CACHE)
unset(${RESULT_PREFIX}_SSSE3 CACHE)
unset(${RESULT_PREFIX}_FEATURE_VPCLMULQDQ CACHE)
unset(${RESULT_PREFIX}_VPCLMULQDQ CACHE)
unset(${RESULT_PREFIX}_FEATURE_XOP CACHE)
unset(${RESULT_PREFIX}_XOP CACHE)
endif()
set(CMAKE_REQUIRED_FLAGS ${BUILDING_FLAGS})
# If using native or no march, use feature detection (result perma-cached)
if (("${BUILDING_FLAGS}" MATCHES "march=native") OR
(NOT "${BUILDING_FLAGS}" MATCHES "march=") OR
("${KNOWN_BUILD_TYPE}" STREQUAL ""))
check_c_source_compiles("
#ifndef __AES__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AES)
set(${RESULT_PREFIX}_AES ${${RESULT_PREFIX}_FEATURE_AES} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX)
set(${RESULT_PREFIX}_AVX ${${RESULT_PREFIX}_FEATURE_AVX} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX2__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX2)
set(${RESULT_PREFIX}_AVX2 ${${RESULT_PREFIX}_FEATURE_AVX2} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX5124FMAPS__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX5124FMAPS)
set(${RESULT_PREFIX}_AVX5124FMAPS ${${RESULT_PREFIX}_FEATURE_AVX5124FMAPS} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX5124VNNIW__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX5124VNNIW)
set(${RESULT_PREFIX}_AVX5124VNNIW ${${RESULT_PREFIX}_FEATURE_AVX5124VNNIW} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512BF16__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512BF16)
set(${RESULT_PREFIX}_AVX512BF16 ${${RESULT_PREFIX}_FEATURE_AVX512BF16} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512BITALG__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512BITALG)
set(${RESULT_PREFIX}_AVX512BITALG ${${RESULT_PREFIX}_FEATURE_AVX512BITALG} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512BW__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512BW)
set(${RESULT_PREFIX}_AVX512BW ${${RESULT_PREFIX}_FEATURE_AVX512BW} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512CD__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512CD)
set(${RESULT_PREFIX}_AVX512CD ${${RESULT_PREFIX}_FEATURE_AVX512CD} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512DQ__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512DQ)
set(${RESULT_PREFIX}_AVX512DQ ${${RESULT_PREFIX}_FEATURE_AVX512DQ} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512ER__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512ER)
set(${RESULT_PREFIX}_AVX512ER ${${RESULT_PREFIX}_FEATURE_AVX512ER} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512F__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512F)
set(${RESULT_PREFIX}_AVX512F ${${RESULT_PREFIX}_FEATURE_AVX512F} PARENT_SCOPE)
set(${RESULT_PREFIX}_AVX512 ${RESULT_PREFIX}_FEATURE_AVX512F PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512IFMA__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512IFMA)
set(${RESULT_PREFIX}_AVX512IFMA ${${RESULT_PREFIX}_FEATURE_AVX512IFMA} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512PF__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512PF)
set(${RESULT_PREFIX}_AVX512PF ${${RESULT_PREFIX}_FEATURE_AVX512PF} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512VBMI__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512VBMI)
set(${RESULT_PREFIX}_AVX512VBMI ${${RESULT_PREFIX}_FEATURE_AVX512VBMI} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512VBMI2__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512VBMI2)
set(${RESULT_PREFIX}_AVX512VBMI2 ${${RESULT_PREFIX}_FEATURE_AVX512VBMI2} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512VL__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512VL)
set(${RESULT_PREFIX}_AVX512VL ${${RESULT_PREFIX}_FEATURE_AVX512VL} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512VNNI__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512VNNI)
set(${RESULT_PREFIX}_AVX512VNNI ${${RESULT_PREFIX}_FEATURE_AVX512VNNI} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __AVX512VPOPCNTDQ__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_AVX512VPOPCNTDQ)
set(${RESULT_PREFIX}_AVX512VPOPCNTDQ ${${RESULT_PREFIX}_FEATURE_AVX512VPOPCNTDQ} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __BMI__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_BMI)
set(${RESULT_PREFIX}_BMI ${${RESULT_PREFIX}_FEATURE_BMI} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __BMI2__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_BMI2)
set(${RESULT_PREFIX}_BMI2 ${${RESULT_PREFIX}_FEATURE_BMI2} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __CMOV__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_CMOV)
set(${RESULT_PREFIX}_CMOV ${${RESULT_PREFIX}_FEATURE_CMOV} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __FMA__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_FMA)
set(${RESULT_PREFIX}_FMA ${${RESULT_PREFIX}_FEATURE_FMA} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __FMA4__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_FMA4)
set(${RESULT_PREFIX}_FMA4 ${${RESULT_PREFIX}_FEATURE_FMA4} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __GFNI__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_GFNI)
set(${RESULT_PREFIX}_GFNI ${${RESULT_PREFIX}_FEATURE_GFNI} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __MMX__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_MMX)
set(${RESULT_PREFIX}_MMX ${${RESULT_PREFIX}_FEATURE_MMX} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __PCLMUL__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_PCLMUL)
set(${RESULT_PREFIX}_PCLMUL ${${RESULT_PREFIX}_FEATURE_PCLMUL} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __POPCNT__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_POPCNT)
set(${RESULT_PREFIX}_POPCNT ${${RESULT_PREFIX}_FEATURE_POPCNT} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __SSE__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_SSE)
set(${RESULT_PREFIX}_SSE ${${RESULT_PREFIX}_FEATURE_SSE} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __SSE2__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_SSE2)
set(${RESULT_PREFIX}_SSE2 ${${RESULT_PREFIX}_FEATURE_SSE2} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __SSE3__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_SSE3)
set(${RESULT_PREFIX}_SSE3 ${${RESULT_PREFIX}_FEATURE_SSE3} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __SSE4_1__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_SSE4_1)
set(${RESULT_PREFIX}_SSE4_1 ${${RESULT_PREFIX}_FEATURE_SSE4_1} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __SSE4_2__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_SSE4_2)
set(${RESULT_PREFIX}_SSE4_2 ${${RESULT_PREFIX}_FEATURE_SSE4_2} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __SSE4_A__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_SSE4_A)
set(${RESULT_PREFIX}_SSE4_A ${${RESULT_PREFIX}_FEATURE_SSE4_A} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __SSSE3__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_SSSE3)
set(${RESULT_PREFIX}_SSSE3 ${${RESULT_PREFIX}_FEATURE_SSSE3} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __VPCLMULQDQ__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_VPCLMULQDQ)
set(${RESULT_PREFIX}_VPCLMULQDQ ${${RESULT_PREFIX}_FEATURE_VPCLMULQDQ} PARENT_SCOPE)
check_c_source_compiles("
#ifndef __XOP__
#error not supported
#endif
int main(void) {
return 0;
}" ${RESULT_PREFIX}_FEATURE_XOP)
set(${RESULT_PREFIX}_XOP ${${RESULT_PREFIX}_FEATURE_XOP} PARENT_SCOPE)
else()
# else, use march=string to check feature capability
set(CLANG_FEATURE_MAP_AES bdver1 bdver2 bdver3 bdver4 broadwell btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 corei7-avx haswell ivybridge knl knm sandybridge skx skylake skylake-avx512 westmere znver1 znver2)
message(STATUS "Querying for ${marchName} AES...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AES)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AES... - found")
set(${RESULT_PREFIX}_AES YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX bdver1 bdver2 bdver3 bdver4 broadwell btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 corei7-avx haswell ivybridge knl knm sandybridge skx skylake skylake-avx512 znver1 znver2)
message(STATUS "Querying for ${marchName} AVX...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX... - found")
set(${RESULT_PREFIX}_AVX YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX2 bdver4 broadwell cannonlake cascadelake cooperlake core-avx2 haswell knl knm skx skylake skylake-avx512 znver1 znver2)
message(STATUS "Querying for ${marchName} AVX2...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX2)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX2... - found")
set(${RESULT_PREFIX}_AVX2 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX5124FMAPS cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX5124FMAPS...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX5124FMAPS)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX5124FMAPS... - found")
set(${RESULT_PREFIX}_AVX5124FMAPS YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX5124VNNIW cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX5124VNNIW...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX5124VNNIW)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX5124VNNIW... - found")
set(${RESULT_PREFIX}_AVX5124VNNIW YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512BF16 cooperlake)
message(STATUS "Querying for ${marchName} AVX512BF16...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512BF16)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512BF16... - found")
set(${RESULT_PREFIX}_AVX512BF16 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512BITALG cooperlake)
message(STATUS "Querying for ${marchName} AVX512BITALG...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512BITALG)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512BITALG... - found")
set(${RESULT_PREFIX}_AVX512BITALG YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512BW cannonlake cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX512BW...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512BW)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512BW... - found")
set(${RESULT_PREFIX}_AVX512BW YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512CD cannonlake cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX512CD...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512CD)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512CD... - found")
set(${RESULT_PREFIX}_AVX512CD YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512DQ cannonlake cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX512DQ...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512DQ)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512DQ... - found")
set(${RESULT_PREFIX}_AVX512DQ YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512ER cannonlake cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX512ER...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512ER)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512ER... - found")
set(${RESULT_PREFIX}_AVX512ER YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512F cannonlake cascadelake cooperlake knl knm skx skylake-avx512)
message(STATUS "Querying for ${marchName} AVX512F...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512F)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512F... - found")
set(${RESULT_PREFIX}_AVX512F YES PARENT_SCOPE)
set(${RESULT_PREFIX}_AVX512 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512IFMA cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX512IFMA...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512IFMA)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512IFMA... - found")
set(${RESULT_PREFIX}_AVX512IFMA YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512PF cannonlake cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX512PF...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512PF)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512PF... - found")
set(${RESULT_PREFIX}_AVX512PF YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512VBMI cannonlake cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX512VBMI...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512VBMI)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512VBMI... - found")
set(${RESULT_PREFIX}_AVX512VBMI YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512VBMI2 cascadelake cooperlake)
message(STATUS "Querying for ${marchName} AVX512VBMI2...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512VBMI2)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512VBMI2... - found")
set(${RESULT_PREFIX}_AVX512VBMI2 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512VL cannonlake cascadelake cooperlake knm)
message(STATUS "Querying for ${marchName} AVX512VL...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512VL)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512VL... - found")
set(${RESULT_PREFIX}_AVX512VL YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512VNNI cascadelake cooperlake)
message(STATUS "Querying for ${marchName} AVX512VNNI...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512VNNI)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512VNNI... - found")
set(${RESULT_PREFIX}_AVX512VNNI YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_AVX512VPOPCNTDQ cascadelake cooperlake)
message(STATUS "Querying for ${marchName} AVX512VPOPCNTDQ...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_AVX512VPOPCNTDQ)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} AVX512VPOPCNTDQ... - found")
set(${RESULT_PREFIX}_AVX512VPOPCNTDQ YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_BMI bdver1 bdver2 bdver3 bdver4 broadwell btver2 cannonlake cascadelake cooperlake core-avx2 haswell knl knm skx skylake skylake-avx512 znver1 znver2)
message(STATUS "Querying for ${marchName} BMI...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_BMI)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} BMI... - found")
set(${RESULT_PREFIX}_BMI YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_BMI2 bdver4 broadwell cannonlake cascadelake cooperlake core-avx2 haswell knl knm skx skylake skylake-avx512 znver1 znver2)
message(STATUS "Querying for ${marchName} BMI2...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_BMI2)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} BMI2... - found")
set(${RESULT_PREFIX}_BMI2 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_CMOV amdfam10 atom barcelona bdver1 bdver2 bdver3 bdver4 bonnell broadwell btver1 btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 core2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} CMOV...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_CMOV)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} CMOV... - found")
set(${RESULT_PREFIX}_CMOV YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_FMA bdver2 bdver3 bdver4 broadwell cannonlake cascadelake cooperlake core-avx2 haswell knl knm skx skylake skylake-avx512 znver1 znver2)
message(STATUS "Querying for ${marchName} FMA...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_FMA)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} FMA... - found")
set(${RESULT_PREFIX}_FMA YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_FMA4 bdver1 bdver2 bdver3 bdver4 broadwell cannonlake cascadelake cooperlake core-avx2 haswell knl knm skx skylake skylake-avx512 znver1 znver2)
message(STATUS "Querying for ${marchName} FMA4...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_FMA4)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} FMA4... - found")
set(${RESULT_PREFIX}_FMA4 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_GFNI cascadelake cooperlake)
message(STATUS "Querying for ${marchName} GFNI...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_GFNI)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} GFNI... - found")
set(${RESULT_PREFIX}_GFNI YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_MMX amdfam10 atom barcelona bdver1 bdver2 bdver3 bdver4 bonnell broadwell btver1 btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 core2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} MMX...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_MMX)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} MMX... - found")
set(${RESULT_PREFIX}_MMX YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_PCLMUL bdver1 bdver2 bdver3 bdver4 broadwell btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 corei7-avx haswell ivybridge knl knm sandybridge skx skylake skylake-avx512 westmere znver1 znver2)
message(STATUS "Querying for ${marchName} PCLMUL...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_PCLMUL)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} PCLMUL... - found")
set(${RESULT_PREFIX}_PCLMUL YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_POPCNT bdver1 bdver2 bdver3 bdver4 broadwell btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 corei7-avx haswell ivybridge knl knm sandybridge skx skylake skylake-avx512 westmere znver1 znver2)
message(STATUS "Querying for ${marchName} POPCNT...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_POPCNT)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} POPCNT... - found")
set(${RESULT_PREFIX}_POPCNT YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_SSE amdfam10 atom barcelona bdver1 bdver2 bdver3 bdver4 bonnell broadwell btver1 btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 core2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} SSE...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_SSE)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} SSE... - found")
set(${RESULT_PREFIX}_SSE YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_SSE2 amdfam10 atom barcelona bdver1 bdver2 bdver3 bdver4 bonnell broadwell btver1 btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 core2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} SSE2...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_SSE2)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} SSE2... - found")
set(${RESULT_PREFIX}_SSE2 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_SSE3 amdfam10 atom barcelona bdver1 bdver2 bdver3 bdver4 bonnell broadwell btver1 btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 core2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} SSE3...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_SSE3)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} SSE3... - found")
set(${RESULT_PREFIX}_SSE3 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_SSE4_1 bdver1 bdver2 bdver3 bdver4 broadwell btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} SSE4_1...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_SSE4_1)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} SSE4_1... - found")
set(${RESULT_PREFIX}_SSE4_1 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_SSE4_2 bdver1 bdver2 bdver3 bdver4 broadwell btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} SSE4_2...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_SSE4_2)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} SSE4_2... - found")
set(${RESULT_PREFIX}_SSE4_2 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_SSE4_A amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 broadwell btver1 btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} SSE4_A...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_SSE4_A)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} SSE4_A... - found")
set(${RESULT_PREFIX}_SSE4_A YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_SSSE3 amdfam10 atom barcelona bdver1 bdver2 bdver3 bdver4 bonnell broadwell btver1 btver2 cannonlake cascadelake cooperlake core-avx-i core-avx2 core2 corei7 corei7-avx haswell ivybridge knl knm nehalem sandybridge silvermont skx skylake skylake-avx512 slm westmere znver1 znver2)
message(STATUS "Querying for ${marchName} SSSE3...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_SSSE3)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} SSSE3... - found")
set(${RESULT_PREFIX}_SSSE3 YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_VPCLMULQDQ cascadelake cooperlake)
message(STATUS "Querying for ${marchName} VPCLMULQDQ...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_VPCLMULQDQ)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} VPCLMULQDQ... - found")
set(${RESULT_PREFIX}_VPCLMULQDQ YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
set(CLANG_FEATURE_MAP_XOP bdver1 bdver2 bdver3 bdver4 broadwell cannonlake cascadelake cooperlake core-avx2 haswell knl knm skx skylake skylake-avx512 znver1 znver2)
message(STATUS "Querying for ${marchName} XOP...")
foreach(marchName IN LISTS CLANG_FEATURE_MAP_XOP)
if ("${BUILDING_FLAGS}" MATCHES "march=${marchName}")
message(STATUS "Querying for ${marchName} XOP... - found")
set(${RESULT_PREFIX}_XOP YES PARENT_SCOPE)
endif()
set(CMAKE_REQUIRED_FLAGS)
endforeach(marchName)
endif()
endfunction()