|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc -global-isel=0 -mtriple=amdgcn--amdpal -mcpu=gfx1200 < %s | FileCheck %s --check-prefix=DAGISEL |
| 3 | +; RUN: llc -global-isel=1 -mtriple=amdgcn--amdpal -mcpu=gfx1200 < %s | FileCheck %s --check-prefix=GISEL |
| 4 | + |
| 5 | +declare amdgpu_gfx_whole_wave i32 @good_callee(i1 %active, i32 %x, i32 %y, i32 inreg %c) |
| 6 | + |
| 7 | +define amdgpu_gfx void @basic_test(i32 %x, i32 inreg %c, ptr addrspace(1) %ptr) { |
| 8 | +; DAGISEL-LABEL: basic_test: |
| 9 | +; DAGISEL: ; %bb.0: |
| 10 | +; DAGISEL-NEXT: s_wait_loadcnt_dscnt 0x0 |
| 11 | +; DAGISEL-NEXT: s_wait_expcnt 0x0 |
| 12 | +; DAGISEL-NEXT: s_wait_samplecnt 0x0 |
| 13 | +; DAGISEL-NEXT: s_wait_bvhcnt 0x0 |
| 14 | +; DAGISEL-NEXT: s_wait_kmcnt 0x0 |
| 15 | +; DAGISEL-NEXT: s_mov_b32 s0, s33 |
| 16 | +; DAGISEL-NEXT: s_mov_b32 s33, s32 |
| 17 | +; DAGISEL-NEXT: s_or_saveexec_b32 s1, -1 |
| 18 | +; DAGISEL-NEXT: scratch_store_b32 off, v42, s33 offset:8 ; 4-byte Folded Spill |
| 19 | +; DAGISEL-NEXT: s_wait_alu 0xfffe |
| 20 | +; DAGISEL-NEXT: s_mov_b32 exec_lo, s1 |
| 21 | +; DAGISEL-NEXT: v_writelane_b32 v42, s0, 2 |
| 22 | +; DAGISEL-NEXT: s_clause 0x1 |
| 23 | +; DAGISEL-NEXT: scratch_store_b32 off, v40, s33 offset:4 |
| 24 | +; DAGISEL-NEXT: scratch_store_b32 off, v41, s33 |
| 25 | +; DAGISEL-NEXT: v_dual_mov_b32 v41, v2 :: v_dual_mov_b32 v40, v1 |
| 26 | +; DAGISEL-NEXT: v_add_nc_u32_e32 v1, 13, v0 |
| 27 | +; DAGISEL-NEXT: v_writelane_b32 v42, s30, 0 |
| 28 | +; DAGISEL-NEXT: s_mov_b32 s1, good_callee@abs32@hi |
| 29 | +; DAGISEL-NEXT: s_mov_b32 s0, good_callee@abs32@lo |
| 30 | +; DAGISEL-NEXT: s_add_co_i32 s32, s32, 16 |
| 31 | +; DAGISEL-NEXT: v_writelane_b32 v42, s31, 1 |
| 32 | +; DAGISEL-NEXT: s_wait_alu 0xfffe |
| 33 | +; DAGISEL-NEXT: s_swappc_b64 s[30:31], s[0:1] |
| 34 | +; DAGISEL-NEXT: global_store_b32 v[40:41], v0, off |
| 35 | +; DAGISEL-NEXT: s_clause 0x1 |
| 36 | +; DAGISEL-NEXT: scratch_load_b32 v41, off, s33 |
| 37 | +; DAGISEL-NEXT: scratch_load_b32 v40, off, s33 offset:4 |
| 38 | +; DAGISEL-NEXT: v_readlane_b32 s31, v42, 1 |
| 39 | +; DAGISEL-NEXT: v_readlane_b32 s30, v42, 0 |
| 40 | +; DAGISEL-NEXT: s_mov_b32 s32, s33 |
| 41 | +; DAGISEL-NEXT: v_readlane_b32 s0, v42, 2 |
| 42 | +; DAGISEL-NEXT: s_or_saveexec_b32 s1, -1 |
| 43 | +; DAGISEL-NEXT: scratch_load_b32 v42, off, s33 offset:8 ; 4-byte Folded Reload |
| 44 | +; DAGISEL-NEXT: s_wait_alu 0xfffe |
| 45 | +; DAGISEL-NEXT: s_mov_b32 exec_lo, s1 |
| 46 | +; DAGISEL-NEXT: s_mov_b32 s33, s0 |
| 47 | +; DAGISEL-NEXT: s_wait_loadcnt 0x0 |
| 48 | +; DAGISEL-NEXT: s_wait_alu 0xfffe |
| 49 | +; DAGISEL-NEXT: s_setpc_b64 s[30:31] |
| 50 | +; |
| 51 | +; GISEL-LABEL: basic_test: |
| 52 | +; GISEL: ; %bb.0: |
| 53 | +; GISEL-NEXT: s_wait_loadcnt_dscnt 0x0 |
| 54 | +; GISEL-NEXT: s_wait_expcnt 0x0 |
| 55 | +; GISEL-NEXT: s_wait_samplecnt 0x0 |
| 56 | +; GISEL-NEXT: s_wait_bvhcnt 0x0 |
| 57 | +; GISEL-NEXT: s_wait_kmcnt 0x0 |
| 58 | +; GISEL-NEXT: s_mov_b32 s0, s33 |
| 59 | +; GISEL-NEXT: s_mov_b32 s33, s32 |
| 60 | +; GISEL-NEXT: s_or_saveexec_b32 s1, -1 |
| 61 | +; GISEL-NEXT: scratch_store_b32 off, v42, s33 offset:8 ; 4-byte Folded Spill |
| 62 | +; GISEL-NEXT: s_wait_alu 0xfffe |
| 63 | +; GISEL-NEXT: s_mov_b32 exec_lo, s1 |
| 64 | +; GISEL-NEXT: v_writelane_b32 v42, s0, 2 |
| 65 | +; GISEL-NEXT: s_clause 0x1 |
| 66 | +; GISEL-NEXT: scratch_store_b32 off, v40, s33 offset:4 |
| 67 | +; GISEL-NEXT: scratch_store_b32 off, v41, s33 |
| 68 | +; GISEL-NEXT: v_dual_mov_b32 v40, v1 :: v_dual_mov_b32 v41, v2 |
| 69 | +; GISEL-NEXT: v_add_nc_u32_e32 v1, 13, v0 |
| 70 | +; GISEL-NEXT: v_writelane_b32 v42, s30, 0 |
| 71 | +; GISEL-NEXT: s_mov_b32 s0, good_callee@abs32@lo |
| 72 | +; GISEL-NEXT: s_mov_b32 s1, good_callee@abs32@hi |
| 73 | +; GISEL-NEXT: s_add_co_i32 s32, s32, 16 |
| 74 | +; GISEL-NEXT: v_writelane_b32 v42, s31, 1 |
| 75 | +; GISEL-NEXT: s_wait_alu 0xfffe |
| 76 | +; GISEL-NEXT: s_swappc_b64 s[30:31], s[0:1] |
| 77 | +; GISEL-NEXT: global_store_b32 v[40:41], v0, off |
| 78 | +; GISEL-NEXT: s_clause 0x1 |
| 79 | +; GISEL-NEXT: scratch_load_b32 v41, off, s33 |
| 80 | +; GISEL-NEXT: scratch_load_b32 v40, off, s33 offset:4 |
| 81 | +; GISEL-NEXT: v_readlane_b32 s31, v42, 1 |
| 82 | +; GISEL-NEXT: v_readlane_b32 s30, v42, 0 |
| 83 | +; GISEL-NEXT: s_mov_b32 s32, s33 |
| 84 | +; GISEL-NEXT: v_readlane_b32 s0, v42, 2 |
| 85 | +; GISEL-NEXT: s_or_saveexec_b32 s1, -1 |
| 86 | +; GISEL-NEXT: scratch_load_b32 v42, off, s33 offset:8 ; 4-byte Folded Reload |
| 87 | +; GISEL-NEXT: s_wait_alu 0xfffe |
| 88 | +; GISEL-NEXT: s_mov_b32 exec_lo, s1 |
| 89 | +; GISEL-NEXT: s_mov_b32 s33, s0 |
| 90 | +; GISEL-NEXT: s_wait_loadcnt 0x0 |
| 91 | +; GISEL-NEXT: s_wait_alu 0xfffe |
| 92 | +; GISEL-NEXT: s_setpc_b64 s[30:31] |
| 93 | + %y = add i32 %x, 13 |
| 94 | + %ret = call i32(ptr, ...) @llvm.amdgcn.call.whole.wave(ptr @good_callee, i32 %x, i32 %y, i32 inreg %c) |
| 95 | + store i32 %ret, ptr addrspace(1) %ptr |
| 96 | + ret void |
| 97 | +} |
| 98 | + |
| 99 | +declare amdgpu_gfx_whole_wave void @void_callee(i1 %active, i32 %x) |
| 100 | + |
| 101 | +define amdgpu_gfx void @ret_void(i32 %x) { |
| 102 | +; DAGISEL-LABEL: ret_void: |
| 103 | +; DAGISEL: ; %bb.0: |
| 104 | +; DAGISEL-NEXT: s_wait_loadcnt_dscnt 0x0 |
| 105 | +; DAGISEL-NEXT: s_wait_expcnt 0x0 |
| 106 | +; DAGISEL-NEXT: s_wait_samplecnt 0x0 |
| 107 | +; DAGISEL-NEXT: s_wait_bvhcnt 0x0 |
| 108 | +; DAGISEL-NEXT: s_wait_kmcnt 0x0 |
| 109 | +; DAGISEL-NEXT: s_mov_b32 s0, s33 |
| 110 | +; DAGISEL-NEXT: s_mov_b32 s33, s32 |
| 111 | +; DAGISEL-NEXT: s_or_saveexec_b32 s1, -1 |
| 112 | +; DAGISEL-NEXT: scratch_store_b32 off, v40, s33 ; 4-byte Folded Spill |
| 113 | +; DAGISEL-NEXT: s_wait_alu 0xfffe |
| 114 | +; DAGISEL-NEXT: s_mov_b32 exec_lo, s1 |
| 115 | +; DAGISEL-NEXT: v_writelane_b32 v40, s0, 2 |
| 116 | +; DAGISEL-NEXT: s_mov_b32 s1, void_callee@abs32@hi |
| 117 | +; DAGISEL-NEXT: s_mov_b32 s0, void_callee@abs32@lo |
| 118 | +; DAGISEL-NEXT: s_add_co_i32 s32, s32, 16 |
| 119 | +; DAGISEL-NEXT: v_writelane_b32 v40, s30, 0 |
| 120 | +; DAGISEL-NEXT: v_writelane_b32 v40, s31, 1 |
| 121 | +; DAGISEL-NEXT: s_wait_alu 0xfffe |
| 122 | +; DAGISEL-NEXT: s_swappc_b64 s[30:31], s[0:1] |
| 123 | +; DAGISEL-NEXT: s_delay_alu instid0(VALU_DEP_1) |
| 124 | +; DAGISEL-NEXT: v_readlane_b32 s31, v40, 1 |
| 125 | +; DAGISEL-NEXT: v_readlane_b32 s30, v40, 0 |
| 126 | +; DAGISEL-NEXT: s_mov_b32 s32, s33 |
| 127 | +; DAGISEL-NEXT: v_readlane_b32 s0, v40, 2 |
| 128 | +; DAGISEL-NEXT: s_or_saveexec_b32 s1, -1 |
| 129 | +; DAGISEL-NEXT: scratch_load_b32 v40, off, s33 ; 4-byte Folded Reload |
| 130 | +; DAGISEL-NEXT: s_wait_alu 0xfffe |
| 131 | +; DAGISEL-NEXT: s_mov_b32 exec_lo, s1 |
| 132 | +; DAGISEL-NEXT: s_mov_b32 s33, s0 |
| 133 | +; DAGISEL-NEXT: s_wait_loadcnt 0x0 |
| 134 | +; DAGISEL-NEXT: s_wait_alu 0xfffe |
| 135 | +; DAGISEL-NEXT: s_setpc_b64 s[30:31] |
| 136 | +; |
| 137 | +; GISEL-LABEL: ret_void: |
| 138 | +; GISEL: ; %bb.0: |
| 139 | +; GISEL-NEXT: s_wait_loadcnt_dscnt 0x0 |
| 140 | +; GISEL-NEXT: s_wait_expcnt 0x0 |
| 141 | +; GISEL-NEXT: s_wait_samplecnt 0x0 |
| 142 | +; GISEL-NEXT: s_wait_bvhcnt 0x0 |
| 143 | +; GISEL-NEXT: s_wait_kmcnt 0x0 |
| 144 | +; GISEL-NEXT: s_mov_b32 s0, s33 |
| 145 | +; GISEL-NEXT: s_mov_b32 s33, s32 |
| 146 | +; GISEL-NEXT: s_or_saveexec_b32 s1, -1 |
| 147 | +; GISEL-NEXT: scratch_store_b32 off, v40, s33 ; 4-byte Folded Spill |
| 148 | +; GISEL-NEXT: s_wait_alu 0xfffe |
| 149 | +; GISEL-NEXT: s_mov_b32 exec_lo, s1 |
| 150 | +; GISEL-NEXT: v_writelane_b32 v40, s0, 2 |
| 151 | +; GISEL-NEXT: s_mov_b32 s0, void_callee@abs32@lo |
| 152 | +; GISEL-NEXT: s_mov_b32 s1, void_callee@abs32@hi |
| 153 | +; GISEL-NEXT: s_add_co_i32 s32, s32, 16 |
| 154 | +; GISEL-NEXT: v_writelane_b32 v40, s30, 0 |
| 155 | +; GISEL-NEXT: v_writelane_b32 v40, s31, 1 |
| 156 | +; GISEL-NEXT: s_wait_alu 0xfffe |
| 157 | +; GISEL-NEXT: s_swappc_b64 s[30:31], s[0:1] |
| 158 | +; GISEL-NEXT: s_delay_alu instid0(VALU_DEP_1) |
| 159 | +; GISEL-NEXT: v_readlane_b32 s31, v40, 1 |
| 160 | +; GISEL-NEXT: v_readlane_b32 s30, v40, 0 |
| 161 | +; GISEL-NEXT: s_mov_b32 s32, s33 |
| 162 | +; GISEL-NEXT: v_readlane_b32 s0, v40, 2 |
| 163 | +; GISEL-NEXT: s_or_saveexec_b32 s1, -1 |
| 164 | +; GISEL-NEXT: scratch_load_b32 v40, off, s33 ; 4-byte Folded Reload |
| 165 | +; GISEL-NEXT: s_wait_alu 0xfffe |
| 166 | +; GISEL-NEXT: s_mov_b32 exec_lo, s1 |
| 167 | +; GISEL-NEXT: s_mov_b32 s33, s0 |
| 168 | +; GISEL-NEXT: s_wait_loadcnt 0x0 |
| 169 | +; GISEL-NEXT: s_wait_alu 0xfffe |
| 170 | +; GISEL-NEXT: s_setpc_b64 s[30:31] |
| 171 | + call void(ptr, ...) @llvm.amdgcn.call.whole.wave(ptr @void_callee, i32 %x) |
| 172 | + ret void |
| 173 | +} |
| 174 | + |
0 commit comments