1 // RUN: %clang_cc1 -ffreestanding %s -triple=i686-- -target-feature +rdpru -emit-llvm -o - -Wall -Werror | FileCheck %s
2 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-- -target-feature +rdpru -emit-llvm -o - -Wall -Werror | FileCheck %s
3 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-- -target-cpu znver2 -emit-llvm -o - -Wall -Werror | FileCheck %s
7 // NOTE: This should correspond to the tests in llvm/test/CodeGen/X86/rdpru.ll
9 unsigned long long test_rdpru(int regid
) {
10 // CHECK-LABEL: test_rdpru
11 // CHECK: [[RESULT:%.*]] = call i64 @llvm.x86.rdpru(i32 %{{.*}})
12 // CHECK-NEXT: ret i64 [[RESULT]]
13 return __rdpru(regid
);
16 unsigned long long test_mperf() {
17 // CHECK-LABEL: test_mperf
18 // CHECK: [[RESULT:%.*]] = call i64 @llvm.x86.rdpru(i32 0)
19 // CHECK-NEXT: ret i64 [[RESULT]]
23 unsigned long long test_aperf() {
24 // CHECK-LABEL: test_aperf
25 // CHECK: [[RESULT:%.*]] = call i64 @llvm.x86.rdpru(i32 1)
26 // CHECK-NEXT: ret i64 [[RESULT]]
30 void test_direct_calls_to_builtin_rdpru(int regid
) {
31 // CHECK: call i64 @llvm.x86.rdpru(i32 0)
32 // CHECK: call i64 @llvm.x86.rdpru(i32 1)
33 // CHECK: call i64 @llvm.x86.rdpru(i32 %{{.*}})
34 (void) __builtin_ia32_rdpru(0);
35 (void) __builtin_ia32_rdpru(1);
36 (void) __builtin_ia32_rdpru(regid
);