1 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -early-cse-memssa -earlycse-debug-hash < %s | FileCheck %s
2 target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
4 ; CHECK-LABEL: @memrealtime(
5 ; CHECK: call i64 @llvm.amdgcn.s.memrealtime()
6 ; CHECK: call i64 @llvm.amdgcn.s.memrealtime()
7 define amdgpu_kernel void @memrealtime(i64 %cycles) #0 {
9 %0 = tail call i64 @llvm.amdgcn.s.memrealtime()
10 %cmp3 = icmp sgt i64 %cycles, 0
11 br i1 %cmp3, label %while.body, label %while.end
14 %1 = tail call i64 @llvm.amdgcn.s.memrealtime()
15 %sub = sub nsw i64 %1, %0
16 %cmp = icmp slt i64 %sub, %cycles
17 br i1 %cmp, label %while.body, label %while.end
23 ; CHECK-LABEL: @memtime(
24 ; CHECK: call i64 @llvm.amdgcn.s.memtime()
25 ; CHECK: call i64 @llvm.amdgcn.s.memtime()
26 define amdgpu_kernel void @memtime(i64 %cycles) #0 {
28 %0 = tail call i64 @llvm.amdgcn.s.memtime()
29 %cmp3 = icmp sgt i64 %cycles, 0
30 br i1 %cmp3, label %while.body, label %while.end
33 %1 = tail call i64 @llvm.amdgcn.s.memtime()
34 %sub = sub nsw i64 %1, %0
35 %cmp = icmp slt i64 %sub, %cycles
36 br i1 %cmp, label %while.body, label %while.end
42 declare i64 @llvm.amdgcn.s.memrealtime()
43 declare i64 @llvm.amdgcn.s.memtime()