[Workflow] Try to fix code-formatter failing to find changes in some cases.
[llvm-project.git] / lldb / utils / lit-cpuid / lit-cpuid.cpp
blobbe322cb6aa42a956d4f9a90442b68b29efdc3240
1 //===- lit-cpuid.cpp - Get CPU feature flags for lit exported features ----===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // lit-cpuid obtains the feature list for the currently running CPU, and outputs
10 // those flags that are interesting for LLDB lit tests.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/ADT/StringMap.h"
15 #include "llvm/Support/raw_ostream.h"
16 #include "llvm/TargetParser/Host.h"
18 using namespace llvm;
20 int main(int argc, char **argv) {
21 #if defined(__i386__) || defined(_M_IX86) || \
22 defined(__x86_64__) || defined(_M_X64)
23 StringMap<bool> features;
25 if (!sys::getHostCPUFeatures(features))
26 return 1;
28 if (features["sse"])
29 outs() << "sse\n";
30 if (features["avx"])
31 outs() << "avx\n";
32 if (features["avx512f"])
33 outs() << "avx512f\n";
34 #endif
36 return 0;