xref: /llvm-project/llvm/test/CodeGen/X86/rdtsc-upgrade.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown-unknown -mcpu=generic | FileCheck %s --check-prefix=X86
3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=generic | FileCheck %s --check-prefix=X64
4
5; Verify upgrading of the old form of the rdtscp intrinsic.
6
7define i64 @test_builtin_rdtscp(ptr %A) {
8; X86-LABEL: test_builtin_rdtscp:
9; X86:       # %bb.0:
10; X86-NEXT:    pushl %esi
11; X86-NEXT:    .cfi_def_cfa_offset 8
12; X86-NEXT:    .cfi_offset %esi, -8
13; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
14; X86-NEXT:    rdtscp
15; X86-NEXT:    movl %ecx, (%esi)
16; X86-NEXT:    popl %esi
17; X86-NEXT:    .cfi_def_cfa_offset 4
18; X86-NEXT:    retl
19;
20; X64-LABEL: test_builtin_rdtscp:
21; X64:       # %bb.0:
22; X64-NEXT:    rdtscp
23; X64-NEXT:    shlq $32, %rdx
24; X64-NEXT:    orq %rdx, %rax
25; X64-NEXT:    movl %ecx, (%rdi)
26; X64-NEXT:    retq
27  %1 = tail call i64 @llvm.x86.rdtscp(ptr %A)
28  ret i64 %1
29}
30
31declare i64 @llvm.x86.rdtscp(ptr)
32