xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/rdpmc.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86-64 -mcpu=generic | FileCheck %s --check-prefix=CHECK --check-prefix=X86-64
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 -mcpu=generic | FileCheck %s --check-prefix=CHECK --check-prefix=X86
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Verify that we correctly lower the "Read Performance-Monitoring Counters"
5*9880d681SAndroid Build Coastguard Worker; x86 builtin.
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine i64 @test_builtin_read_pmc(i32 %ID) {
9*9880d681SAndroid Build Coastguard Worker  %1 = tail call i64 @llvm.x86.rdpmc(i32 %ID)
10*9880d681SAndroid Build Coastguard Worker  ret i64 %1
11*9880d681SAndroid Build Coastguard Worker}
12*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_builtin_read_pmc
13*9880d681SAndroid Build Coastguard Worker; CHECK: rdpmc
14*9880d681SAndroid Build Coastguard Worker; X86-NOT: shlq
15*9880d681SAndroid Build Coastguard Worker; X86-NOT: or
16*9880d681SAndroid Build Coastguard Worker; X86-64: shlq
17*9880d681SAndroid Build Coastguard Worker; X86-64: or
18*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: mov
19*9880d681SAndroid Build Coastguard Worker; CHECK: ret
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workerdeclare i64 @llvm.x86.rdpmc(i32 %ID)
22*9880d681SAndroid Build Coastguard Worker
23