4 if not ('X86' in config.root.targets):
5 # We need support for X86.
6 config.unsupported = True
8 elif not ('x86_64' in config.root.host_triple):
9 # We need to be running on an X86 host.
10 config.unsupported = True
13 # We need libpfm to be installed and allow reading perf counters. We can
14 # only know that at runtime, so we try to measure the latency of an empty
15 # code snippet and bail out on error.
16 llvm_exegesis_exe = lit.util.which('llvm-exegesis', config.llvm_tools_dir)
17 if not llvm_exegesis_exe:
18 print('llvm-exegesis not found')
19 config.unsupported = True
22 with open(os.devnull, 'w') as quiet:
23 check_llvm_exegesis_uops_result = subprocess.call(
24 [llvm_exegesis_exe, '-mode', 'uops', '-snippets-file', '/dev/null'], stdout=quiet, stderr=quiet)
25 check_llvm_exegesis_latency_result = subprocess.call(
26 [llvm_exegesis_exe, '-mode', 'latency', '-snippets-file', '/dev/null'], stdout=quiet, stderr=quiet)
28 print('could not exec llvm-exegesis')
29 config.unsupported = True
30 if not check_llvm_exegesis_uops_result == 0:
31 config.unsupported = True
32 if not check_llvm_exegesis_latency_result == 0:
33 config.unsupported = True