Clang Project

clang_source_code/test/CodeGen/ms-intrinsics-cpuid.c
1// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
2// RUN:         -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck %s
3// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
4// RUN:         -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck %s
5
6// intrin.h needs size_t, but -ffreestanding prevents us from getting it from
7// stddef.h.  Work around it with this typedef.
8typedef __SIZE_TYPE__ size_t;
9
10#include <intrin.h>
11
12void test__cpuid(int *info, int level) {
13  __cpuid(info, level);
14}
15// CHECK-LABEL: define {{.*}} @test__cpuid(i32* %{{.*}}, i32 %{{.*}})
16// CHECK: call { i32, i32, i32, i32 } asm "cpuid",
17// CHECK-SAME:   "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"
18// CHECK-SAME:   (i32 %{{.*}}, i32 0)
19