1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-64
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -ffreestanding -triple i386 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-32
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc #include <cpuid.h>
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuc // CHECK-64: {{.*}} call { i32, i32, i32, i32 } asm " xchgq %rbx,${1:q}\0A cpuid\0A xchgq %rbx,${1:q}", "={ax},=r,={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}})
7*0a6a1f1dSLionel Sambuc // CHECK-64: {{.*}} call { i32, i32, i32, i32 } asm " xchgq %rbx,${1:q}\0A cpuid\0A xchgq %rbx,${1:q}", "={ax},=r,={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}}, i32 %{{[a-z0-9]+}})
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc // CHECK-32: {{.*}} call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}})
10*0a6a1f1dSLionel Sambuc // CHECK-32: {{.*}} call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}}, i32 %{{[a-z0-9]+}})
11*0a6a1f1dSLionel Sambuc
12*0a6a1f1dSLionel Sambuc unsigned eax0, ebx0, ecx0, edx0;
13*0a6a1f1dSLionel Sambuc unsigned eax1, ebx1, ecx1, edx1;
14*0a6a1f1dSLionel Sambuc
test_cpuid(unsigned level,unsigned count)15*0a6a1f1dSLionel Sambuc void test_cpuid(unsigned level, unsigned count) {
16*0a6a1f1dSLionel Sambuc __cpuid(level, eax1, ebx1, ecx1, edx1);
17*0a6a1f1dSLionel Sambuc __cpuid_count(level, count, eax0, ebx0, ecx0, edx0);
18*0a6a1f1dSLionel Sambuc }
19