2016-09-28 19:59:09 +08:00
|
|
|
// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
|
2016-06-01 20:21:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include <x86intrin.h>
|
|
|
|
|
|
|
|
unsigned long long test_rdpmc(int a) {
|
|
|
|
return _rdpmc(a);
|
|
|
|
// CHECK: @test_rdpmc
|
|
|
|
// CHECK: call i64 @llvm.x86.rdpmc
|
|
|
|
}
|
|
|
|
|
|
|
|
int test_rdtsc() {
|
|
|
|
return _rdtsc();
|
|
|
|
// CHECK: @test_rdtsc
|
|
|
|
// CHECK: call i64 @llvm.x86.rdtsc
|
|
|
|
}
|
2018-09-08 03:14:24 +08:00
|
|
|
|
|
|
|
unsigned long long test_rdtscp(unsigned int *a) {
|
|
|
|
// CHECK: @test_rdtscp
|
|
|
|
// CHECK: [[RDTSCP:%.*]] = call { i64, i32 } @llvm.x86.rdtscp
|
|
|
|
// CHECK: [[TSC_AUX:%.*]] = extractvalue { i64, i32 } [[RDTSCP]], 1
|
|
|
|
// CHECK: store i32 [[TSC_AUX]], i32* %{{.*}}
|
|
|
|
// CHECK: [[TSC:%.*]] = extractvalue { i64, i32 } [[RDTSCP]], 0
|
|
|
|
return __rdtscp(a);
|
|
|
|
}
|