1 // FIXME: XFAIL the test because it is expected to return non-zero value.
2 // XFAIL: *
3 // REQUIRES: x86-target-arch
4 // RUN: %clang_builtins %s %librt -o %t && %run %t
5 // REQUIRES: librt_has_cpu_model
6 //===-- cpu_model_test.c - Test __builtin_cpu_supports --------------------===//
7 //
8 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
9 // See https://llvm.org/LICENSE.txt for license information.
10 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //
12 //===----------------------------------------------------------------------===//
13 //
14 // This file tests __builtin_cpu_supports for the compiler_rt library.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #include <stdio.h>
19 
20 int main (void) {
21 #if defined(i386) || defined(__x86_64__)
22   if(__builtin_cpu_supports("avx2"))
23     return 4;
24   else
25     return 3;
26 #else
27   printf("skipped\n");
28   return 0;
29 #endif
30 }
31