Pavel Iliin 568babab7e
[AArch64] Implement __builtin_cpu_supports, compiler-rt tests. (#82378)
The patch complements https://github.com/llvm/llvm-project/pull/68919
and adds AArch64 support for builtin
`__builtin_cpu_supports("feature1+...+featureN")`
which return true if all specified CPU features in argument are
detected. Also compiler-rt aarch64 native run tests for features
detection mechanism were added and 'cpu_model' check was fixed after its
refactor merged https://github.com/llvm/llvm-project/pull/75635 Original
RFC was https://reviews.llvm.org/D153153
2024-02-22 23:33:54 +00:00

20 lines
395 B
C

// REQUIRES: x86-target-arch
// RUN: %clang_builtins %s %librt -o %t && %run %t
// REQUIRES: librt_has_x86
// FIXME: XFAIL the test because it is expected to return non-zero value.
// XFAIL: *
#include <stdio.h>
int main (void) {
#if defined(i386) || defined(__x86_64__)
if(__builtin_cpu_supports("avx2"))
return 4;
else
return 3;
#else
printf("skipped\n");
return 0;
#endif
}