xref: /llvm-project/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.memtime.ll (revision 9e9907f1cfa424366fba58d9520f9305b537cec9)
1; RUN: llc -mtriple=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck --check-prefixes=SIVI,GCN %s
2; RUN: llc -mtriple=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefixes=SIVI,GCN %s
3; RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
4; RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
5
6declare i64 @llvm.amdgcn.s.memtime() #0
7
8; GCN-LABEL: {{^}}test_s_memtime:
9; GCN-DAG: s_memtime s{{\[[0-9]+:[0-9]+\]}}
10; GCN-DAG: s_load_dwordx2
11; GCN: lgkmcnt
12; GCN: {{buffer|global}}_store_dwordx2
13; SIVI-NOT: lgkmcnt
14; GCN: s_memtime s{{\[[0-9]+:[0-9]+\]}}
15; GCN: {{buffer|global}}_store_dwordx2
16define amdgpu_kernel void @test_s_memtime(ptr addrspace(1) %out) #0 {
17  %cycle0 = call i64 @llvm.amdgcn.s.memtime()
18  store volatile i64 %cycle0, ptr addrspace(1) %out
19
20  %cycle1 = call i64 @llvm.amdgcn.s.memtime()
21  store volatile i64 %cycle1, ptr addrspace(1) %out
22  ret void
23}
24
25attributes #0 = { nounwind }
26