| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| ; RUN: opt -S -mtriple=amdgpu8.02-- -amdgpu-codegenprepare %s | FileCheck %s |
| |
| define amdgpu_kernel void @divrem24_assume(ptr addrspace(1) %arg, i32 %arg1) { |
| ; CHECK-LABEL: @divrem24_assume( |
| ; CHECK-NEXT: bb: |
| ; CHECK-NEXT: [[TMP:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x(), !range [[RNG0:![0-9]+]] |
| ; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i32 [[ARG1:%.*]], 42 |
| ; CHECK-NEXT: tail call void @llvm.assume(i1 [[TMP2]]) |
| ; CHECK-NEXT: [[TMP0:%.*]] = uitofp fast i32 [[TMP]] to float |
| ; CHECK-NEXT: [[TMP1:%.*]] = uitofp fast i32 [[ARG1]] to float |
| ; CHECK-NEXT: [[TMP2:%.*]] = call fast float @llvm.amdgcn.rcp.f32(float [[TMP1]]) |
| ; CHECK-NEXT: [[TMP6:%.*]] = bitcast float [[TMP0]] to i32 |
| ; CHECK-NEXT: [[TMP8:%.*]] = add i32 [[TMP6]], 1 |
| ; CHECK-NEXT: [[TMP5:%.*]] = bitcast i32 [[TMP8]] to float |
| ; CHECK-NEXT: [[TMP3:%.*]] = fmul fast float [[TMP5]], [[TMP2]] |
| ; CHECK-NEXT: [[TMP4:%.*]] = call fast float @llvm.trunc.f32(float [[TMP3]]) |
| ; CHECK-NEXT: [[TMP7:%.*]] = fptoui float [[TMP4]] to i32 |
| ; CHECK-NEXT: [[TMP8:%.*]] = zext i32 [[TMP7]] to i64 |
| ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr addrspace(1) [[ARG:%.*]], i64 [[TMP8]] |
| ; CHECK-NEXT: store i32 0, ptr addrspace(1) [[TMP5]], align 4 |
| ; CHECK-NEXT: ret void |
| ; |
| bb: |
| %tmp = tail call i32 @llvm.amdgcn.workitem.id.x(), !range !0 |
| %tmp2 = icmp ult i32 %arg1, 42 |
| tail call void @llvm.assume(i1 %tmp2) |
| %tmp3 = udiv i32 %tmp, %arg1 |
| %tmp4 = zext i32 %tmp3 to i64 |
| %tmp5 = getelementptr inbounds i32, ptr addrspace(1) %arg, i64 %tmp4 |
| store i32 0, ptr addrspace(1) %tmp5, align 4 |
| ret void |
| } |
| |
| declare void @llvm.assume(i1) |
| declare i32 @llvm.amdgcn.workitem.id.x() |
| |
| !0 = !{i32 0, i32 1024} |