xref: /llvm-project/clang/test/Headers/__cpuidex_conflict.c (revision c310b4e7bd2a6e736fbcd8d4885ff46b45ab9977)
1 // Make sure that __cpuidex in cpuid.h doesn't conflict with the MS
2 // extensions built in by ensuring compilation succeeds:
3 // RUN: %clang_cc1 %s -ffreestanding -fms-extensions -fms-compatibility \
4 // RUN:  -fms-compatibility-version=19.00 -triple x86_64-pc-windows-msvc -emit-llvm -o -
5 // %clang_cc1 %s -ffreestanding -triple x86_64-w64-windows-gnu -fms-extensions -emit-llvm -o -
6 // RUN: %clang_cc1 %s -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu
7 
8 typedef __SIZE_TYPE__ size_t;
9 
10 // We declare __cpuidex here as where the buitlin should be exposed (MSVC), the
11 // declaration is in <intrin.h>, but <intrin.h> is not available from all the
12 // targets that are being tested here.
13 void __cpuidex (int[4], int, int);
14 
15 #include <cpuid.h>
16 
17 int cpuid_info[4];
18 
19 void test_cpuidex(unsigned level, unsigned count) {
20   __cpuidex(cpuid_info, level, count);
21 }
22 
23