mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 18:56:06 +00:00

This is the clang side of D51803. The llvm intrinsic now returns two results. So we need to emit an explicit store in IR for the out parameter. This is similar to addcarry/subborrow/rdrand/rdseed. Differential Revision: https://reviews.llvm.org/D51805 llvm-svn: 341699
26 lines
679 B
C
26 lines
679 B
C
// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
|
|
|
|
|
|
#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
|
|
}
|
|
|
|
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);
|
|
}
|