Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / rdpru-builtins.c
blob03bf0af8336bd6d4fa44e911768993a5a03022b4
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
5 #include <x86intrin.h>
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]]
20 return __mperf();
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]]
27 return __aperf();
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);