|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 |
| 2 | +; RUN: llc -verify-machineinstrs -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 %s -o - | FileCheck -check-prefix=GFX9 %s |
| 3 | +; RUN: llc -verify-machineinstrs -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 %s -o - | FileCheck -check-prefix=GFX10 %s |
| 4 | +; RUN: llc -verify-machineinstrs -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 %s -o - | FileCheck -check-prefix=GFX11 %s |
| 5 | + |
| 6 | +define amdgpu_kernel void @test(ptr addrspace(1) %src, ptr addrspace(1) %dst) { |
| 7 | +; GFX9-LABEL: test: |
| 8 | +; GFX9: ; %bb.0: ; %entry |
| 9 | +; GFX9-NEXT: s_load_dword s7, s[4:5], 0x1c |
| 10 | +; GFX9-NEXT: s_load_dword s8, s[4:5], 0x38 |
| 11 | +; GFX9-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0 |
| 12 | +; GFX9-NEXT: s_waitcnt lgkmcnt(0) |
| 13 | +; GFX9-NEXT: s_and_b32 s4, s7, 0xffff |
| 14 | +; GFX9-NEXT: s_mul_i32 s6, s6, s4 |
| 15 | +; GFX9-NEXT: s_add_i32 s8, s8, s6 |
| 16 | +; GFX9-NEXT: v_add_u32_e32 v0, s8, v0 |
| 17 | +; GFX9-NEXT: v_ashrrev_i32_e32 v1, 31, v0 |
| 18 | +; GFX9-NEXT: v_lshlrev_b64 v[4:5], 4, v[0:1] |
| 19 | +; GFX9-NEXT: v_mov_b32_e32 v1, s1 |
| 20 | +; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, s0, v4 |
| 21 | +; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v1, v5, vcc |
| 22 | +; GFX9-NEXT: global_load_dwordx4 v[0:3], v[0:1], off |
| 23 | +; GFX9-NEXT: v_mov_b32_e32 v6, s3 |
| 24 | +; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, s2, v4 |
| 25 | +; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, v6, v5, vcc |
| 26 | +; GFX9-NEXT: s_waitcnt vmcnt(0) |
| 27 | +; GFX9-NEXT: v_not_b32_e32 v3, v3 |
| 28 | +; GFX9-NEXT: v_not_b32_e32 v2, v2 |
| 29 | +; GFX9-NEXT: v_not_b32_e32 v1, v1 |
| 30 | +; GFX9-NEXT: v_not_b32_e32 v0, v0 |
| 31 | +; GFX9-NEXT: global_store_dwordx4 v[4:5], v[0:3], off |
| 32 | +; GFX9-NEXT: s_endpgm |
| 33 | +; |
| 34 | +; GFX10-LABEL: test: |
| 35 | +; GFX10: ; %bb.0: ; %entry |
| 36 | +; GFX10-NEXT: s_clause 0x2 |
| 37 | +; GFX10-NEXT: s_load_dword s7, s[4:5], 0x1c |
| 38 | +; GFX10-NEXT: s_load_dword s8, s[4:5], 0x38 |
| 39 | +; GFX10-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0 |
| 40 | +; GFX10-NEXT: s_waitcnt lgkmcnt(0) |
| 41 | +; GFX10-NEXT: s_and_b32 s4, s7, 0xffff |
| 42 | +; GFX10-NEXT: s_mul_i32 s6, s6, s4 |
| 43 | +; GFX10-NEXT: v_add3_u32 v0, s8, s6, v0 |
| 44 | +; GFX10-NEXT: v_ashrrev_i32_e32 v1, 31, v0 |
| 45 | +; GFX10-NEXT: v_lshlrev_b64 v[4:5], 4, v[0:1] |
| 46 | +; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, s0, v4 |
| 47 | +; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, s1, v5, vcc_lo |
| 48 | +; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, s2, v4 |
| 49 | +; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, s3, v5, vcc_lo |
| 50 | +; GFX10-NEXT: global_load_dwordx4 v[0:3], v[0:1], off |
| 51 | +; GFX10-NEXT: s_waitcnt vmcnt(0) |
| 52 | +; GFX10-NEXT: v_not_b32_e32 v3, v3 |
| 53 | +; GFX10-NEXT: v_not_b32_e32 v2, v2 |
| 54 | +; GFX10-NEXT: v_not_b32_e32 v1, v1 |
| 55 | +; GFX10-NEXT: v_not_b32_e32 v0, v0 |
| 56 | +; GFX10-NEXT: global_store_dwordx4 v[4:5], v[0:3], off |
| 57 | +; GFX10-NEXT: s_endpgm |
| 58 | +; |
| 59 | +; GFX11-LABEL: test: |
| 60 | +; GFX11: ; %bb.0: ; %entry |
| 61 | +; GFX11-NEXT: s_clause 0x2 |
| 62 | +; GFX11-NEXT: s_load_b32 s4, s[0:1], 0x1c |
| 63 | +; GFX11-NEXT: s_load_b32 s5, s[0:1], 0x38 |
| 64 | +; GFX11-NEXT: s_load_b128 s[0:3], s[0:1], 0x0 |
| 65 | +; GFX11-NEXT: s_waitcnt lgkmcnt(0) |
| 66 | +; GFX11-NEXT: s_and_b32 s4, s4, 0xffff |
| 67 | +; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) |
| 68 | +; GFX11-NEXT: s_mul_i32 s15, s15, s4 |
| 69 | +; GFX11-NEXT: v_add3_u32 v0, s5, s15, v0 |
| 70 | +; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) |
| 71 | +; GFX11-NEXT: v_ashrrev_i32_e32 v1, 31, v0 |
| 72 | +; GFX11-NEXT: v_lshlrev_b64 v[4:5], 4, v[0:1] |
| 73 | +; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2) |
| 74 | +; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, s0, v4 |
| 75 | +; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, s1, v5, vcc_lo |
| 76 | +; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, s2, v4 |
| 77 | +; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, s3, v5, vcc_lo |
| 78 | +; GFX11-NEXT: global_load_b128 v[0:3], v[0:1], off |
| 79 | +; GFX11-NEXT: s_waitcnt vmcnt(0) |
| 80 | +; GFX11-NEXT: v_not_b32_e32 v3, v3 |
| 81 | +; GFX11-NEXT: v_not_b32_e32 v2, v2 |
| 82 | +; GFX11-NEXT: v_not_b32_e32 v1, v1 |
| 83 | +; GFX11-NEXT: v_not_b32_e32 v0, v0 |
| 84 | +; GFX11-NEXT: global_store_b128 v[4:5], v[0:3], off |
| 85 | +; GFX11-NEXT: s_nop 0 |
| 86 | +; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) |
| 87 | +; GFX11-NEXT: s_endpgm |
| 88 | +entry: |
| 89 | + %implicitarg.ptr = tail call ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr() |
| 90 | + %arg.1.ptr = getelementptr inbounds i8, ptr addrspace(4) %implicitarg.ptr, i64 40 |
| 91 | + %arg.1 = load i64, ptr addrspace(4) %arg.1.ptr, align 8 |
| 92 | + %workgroup.id.x = tail call i32 @llvm.amdgcn.workgroup.id.x() |
| 93 | + %arg.2.ptr = getelementptr inbounds i8, ptr addrspace(4) %implicitarg.ptr, i64 12 |
| 94 | + %arg.2 = load i16, ptr addrspace(4) %arg.2.ptr, align 4 |
| 95 | + %arg.2.ext = zext i16 %arg.2 to i32 |
| 96 | + %mul = mul i32 %workgroup.id.x, %arg.2.ext |
| 97 | + %workitem.id.x = tail call i32 @llvm.amdgcn.workitem.id.x() |
| 98 | + %add = add i32 %mul, %workitem.id.x |
| 99 | + %add.ext = zext i32 %add to i64 |
| 100 | + %add.1 = add i64 %arg.1, %add.ext |
| 101 | + %sext = shl i64 %add.1, 32 |
| 102 | + %idxprom = ashr exact i64 %sext, 32 |
| 103 | + %arrayidx = getelementptr inbounds <16 x i8>, ptr addrspace(1) %src, i64 %idxprom |
| 104 | + %arrayval = load <16 x i8>, ptr addrspace(1) %arrayidx, align 16 |
| 105 | + %not = xor <16 x i8> %arrayval, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> |
| 106 | + %arrayidx2 = getelementptr inbounds <16 x i8>, ptr addrspace(1) %dst, i64 %idxprom |
| 107 | + store <16 x i8> %not, ptr addrspace(1) %arrayidx2, align 16 |
| 108 | + ret void |
| 109 | +} |
0 commit comments