|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s |
| 3 | + |
| 4 | +define amdgpu_kernel void @scalar_cmp(i32 noundef %value, ptr addrspace(8) nocapture writeonly %res, i32 noundef %v_offset, i32 noundef %0, i32 noundef %flag) { |
| 5 | +; GCN-LABEL: scalar_cmp: |
| 6 | +; GCN: ; %bb.0: ; %entry |
| 7 | +; GCN-NEXT: s_load_dword s0, s[2:3], 0x4c |
| 8 | +; GCN-NEXT: s_waitcnt lgkmcnt(0) |
| 9 | +; GCN-NEXT: s_cmp_lt_i32 s0, 1 |
| 10 | +; GCN-NEXT: s_cbranch_scc1 .LBB0_2 |
| 11 | +; GCN-NEXT: ; %bb.1: ; %if.then |
| 12 | +; GCN-NEXT: s_clause 0x2 |
| 13 | +; GCN-NEXT: s_load_dword s4, s[2:3], 0x24 |
| 14 | +; GCN-NEXT: s_load_dword s5, s[2:3], 0x44 |
| 15 | +; GCN-NEXT: s_load_dwordx4 s[0:3], s[2:3], 0x34 |
| 16 | +; GCN-NEXT: s_waitcnt lgkmcnt(0) |
| 17 | +; GCN-NEXT: v_mov_b32_e32 v0, s4 |
| 18 | +; GCN-NEXT: v_mov_b32_e32 v1, s5 |
| 19 | +; GCN-NEXT: buffer_store_dword v0, v1, s[0:3], 0 offen |
| 20 | +; GCN-NEXT: .LBB0_2: ; %if.end |
| 21 | +; GCN-NEXT: s_endpgm |
| 22 | +entry: |
| 23 | + %cmp = icmp sgt i32 %flag, 0 |
| 24 | + br i1 %cmp, label %if.then, label %if.end |
| 25 | + |
| 26 | +if.then: |
| 27 | + tail call void @llvm.amdgcn.raw.ptr.buffer.store.i32(i32 %value, ptr addrspace(8) %res, i32 %v_offset, i32 0, i32 0) |
| 28 | + br label %if.end |
| 29 | + |
| 30 | +if.end: |
| 31 | + ret void |
| 32 | +} |
| 33 | + |
| 34 | +define amdgpu_kernel void @vec_cmp(i32 noundef %value, ptr addrspace(8) nocapture writeonly %res, i32 noundef %v_offset, i32 noundef %0, i32 noundef %flag) { |
| 35 | +; GCN-LABEL: vec_cmp: |
| 36 | +; GCN: ; %bb.0: ; %entry |
| 37 | +; GCN-NEXT: s_load_dword s0, s[2:3], 0x4c |
| 38 | +; GCN-NEXT: s_waitcnt lgkmcnt(0) |
| 39 | +; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, s0, v0 |
| 40 | +; GCN-NEXT: s_and_saveexec_b32 s0, vcc_lo |
| 41 | +; GCN-NEXT: s_cbranch_execz .LBB1_2 |
| 42 | +; GCN-NEXT: ; %bb.1: ; %if.then |
| 43 | +; GCN-NEXT: s_clause 0x2 |
| 44 | +; GCN-NEXT: s_load_dword s4, s[2:3], 0x24 |
| 45 | +; GCN-NEXT: s_load_dword s5, s[2:3], 0x44 |
| 46 | +; GCN-NEXT: s_load_dwordx4 s[0:3], s[2:3], 0x34 |
| 47 | +; GCN-NEXT: s_waitcnt lgkmcnt(0) |
| 48 | +; GCN-NEXT: v_mov_b32_e32 v0, s4 |
| 49 | +; GCN-NEXT: v_mov_b32_e32 v1, s5 |
| 50 | +; GCN-NEXT: buffer_store_dword v0, v1, s[0:3], 0 offen |
| 51 | +; GCN-NEXT: .LBB1_2: ; %if.end |
| 52 | +; GCN-NEXT: s_endpgm |
| 53 | +entry: |
| 54 | + %1 = tail call noundef range(i32 0, 1024) i32 @llvm.amdgcn.workitem.id.x() |
| 55 | + %cmp = icmp ult i32 %1, %flag |
| 56 | + br i1 %cmp, label %if.then, label %if.end |
| 57 | + |
| 58 | +if.then: |
| 59 | + tail call void @llvm.amdgcn.raw.ptr.buffer.store.i32(i32 %value, ptr addrspace(8) %res, i32 %v_offset, i32 0, i32 0) |
| 60 | + br label %if.end |
| 61 | + |
| 62 | +if.end: |
| 63 | + ret void |
| 64 | +} |
| 65 | + |
| 66 | +declare void @llvm.amdgcn.raw.ptr.buffer.store.i32(i32, ptr addrspace(8) nocapture writeonly, i32, i32, i32 immarg) |
| 67 | +declare i32 @llvm.amdgcn.workitem.id.x() |
0 commit comments