llvm-project/libc/cmake/modules/cpu_features/check_cpu_features.cpp.in
Guillaume Chatelet 9c4c32a3d0 Revert D142108 "[libc][NFC] Detect host CPU features using try_compile instead of try_run."
Build bots are failing.
https://lab.llvm.org/buildbot/#/builders/90/builds/44634

This reverts commit 9acc2f37bdfce08ca0c2faec03392db10d1bb7a9.
2023-01-23 10:43:34 +00:00

33 lines
937 B
C++

#include <stdio.h>
#include <stdlib.h>
// This file is instantiated by CMake.
// DEFINITIONS below is replaced with a set of lines like so:
// #ifdef __SSE2__
// "SSE2",
// #endif
//
// This allows for introspection of compiler definitions.
// The output of the program is a single line of semi colon separated feature
// names.
// MSVC is using a different set of preprocessor definitions for
// SSE and SSE2, see _M_IX86_FP in
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
int main(int, char **) {
const char *strings[] = {
@DEFINITIONS@
// If DEFINITIONS turns out to be empty, we don't want to list
// an empty array. So, we add an end of list marker.
"<end_of_feature_list>"
};
const size_t size = sizeof(strings) / sizeof(strings[0]);
for (size_t i = 0; i < size; ++i) {
if (i)
putchar(';');
fputs(strings[i], stdout);
}
return EXIT_SUCCESS;
}