File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed
SingleSource/Benchmarks/Misc Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,20 @@ if(NOT ARCH STREQUAL "PowerPC" OR NOT TARGET_OS STREQUAL "Darwin")
35
35
list (APPEND Source dt.c )
36
36
endif ()
37
37
if (ARCH STREQUAL "AArch64" )
38
- file (WRITE ${CMAKE_CURRENT_BINARY_DIR} /CheckHaveAArch64FMV.h "void __init_cpu_features_resolver(void);" )
39
- check_symbol_exists (__init_cpu_features_resolver ${CMAKE_CURRENT_BINARY_DIR} /CheckHaveAArch64FMV.h HAVE_AARCH64_FMV )
40
- if (HAVE_AARCH64_FMV AND TARGET_OS STREQUAL "Darwin" )
41
- list (APPEND Source aarch64-init-cpu-features.c )
38
+ if (TARGET_OS STREQUAL "Darwin" )
39
+ file (WRITE ${CMAKE_CURRENT_BINARY_DIR} /CheckHasAArch64FMV.h "void __init_cpu_features_resolver(void);" )
40
+ check_symbol_exists (__init_cpu_features_resolver ${CMAKE_CURRENT_BINARY_DIR} /CheckHasAArch64FMV.h HAS_AARCH64_FMV )
41
+ if (HAS_AARCH64_FMV )
42
+ list (APPEND CFLAGS -DHAS_DARWIN_FMV )
43
+ list (APPEND Source aarch64-init-cpu-features.c )
44
+ endif ()
45
+ elseif (TARGET_OS STREQUAL "Linux" )
46
+ file (WRITE ${CMAKE_CURRENT_BINARY_DIR} /CheckHasAArch64FMV.h "void __init_cpu_features(void);" )
47
+ check_symbol_exists (__init_cpu_features ${CMAKE_CURRENT_BINARY_DIR} /CheckHasAArch64FMV.h HAS_AARCH64_FMV )
48
+ if (HAS_AARCH64_FMV )
49
+ list (APPEND CFLAGS -DHAS_LINUX_FMV )
50
+ list (APPEND Source aarch64-init-cpu-features.c )
51
+ endif ()
42
52
endif ()
43
53
endif ()
44
54
llvm_singlesource ()
Original file line number Diff line number Diff line change @@ -4,15 +4,21 @@ extern struct {
4
4
unsigned long long features ;
5
5
} __aarch64_cpu_features ;
6
6
7
- void __init_cpu_features_resolver (void );
7
+ #if HAS_DARWIN_FMV
8
+ # define RUNTIME_INIT __init_cpu_features_resolver
9
+ #elif HAS_LINUX_FMV
10
+ # define RUNTIME_INIT __init_cpu_features
11
+ #endif
12
+
13
+ void RUNTIME_INIT (void );
8
14
9
15
int main () {
10
- __init_cpu_features_resolver ();
16
+ RUNTIME_INIT ();
11
17
const unsigned long long first = __aarch64_cpu_features .features ;
12
18
13
19
// Manually reset it, so we can check that the result is consistent.
14
20
__aarch64_cpu_features .features = 0 ;
15
- __init_cpu_features_resolver ();
21
+ RUNTIME_INIT ();
16
22
17
23
if (__aarch64_cpu_features .features != first ) {
18
24
printf ("FAILED consistency test: 0x%llx != 0x%llx\n" , first ,
@@ -24,6 +30,6 @@ int main() {
24
30
// per-iteration measurement in microseconds.
25
31
for (int i = 0 ; i < 1000000 ; i ++ ) {
26
32
__aarch64_cpu_features .features = 0 ;
27
- __init_cpu_features_resolver ();
33
+ RUNTIME_INIT ();
28
34
}
29
35
}
You can’t perform that action at this time.
0 commit comments