1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -amdgpu-enable-vopd=0 < %s | FileCheck -check-prefix=GCN %s
define amdgpu_ps void @test_export_zeroes_f32() #0 {
; GCN-LABEL: test_export_zeroes_f32:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: v_mov_b32_e32 v0, 0
; GCN-NEXT: exp mrt0 off, off, off, off
; GCN-NEXT: exp mrt0 off, off, off, off done
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_endpgm
call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 false, i1 false)
call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 true, i1 false)
ret void
}
define amdgpu_ps void @test_export_en_src0_f32() #0 {
; GCN-LABEL: test_export_en_src0_f32:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: v_mov_b32_e32 v0, 4.0
; GCN-NEXT: v_mov_b32_e32 v1, 0.5
; GCN-NEXT: v_mov_b32_e32 v2, 2.0
; GCN-NEXT: v_mov_b32_e32 v3, 1.0
; GCN-NEXT: exp mrt0 v3, off, off, off done
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_endpgm
call void @llvm.amdgcn.exp.f32(i32 0, i32 1, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)
ret void
}
define amdgpu_gs void @test_export_gs() #0 {
; GCN-LABEL: test_export_gs:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: v_mov_b32_e32 v0, 4.0
; GCN-NEXT: v_mov_b32_e32 v1, 0.5
; GCN-NEXT: v_mov_b32_e32 v2, 2.0
; GCN-NEXT: v_mov_b32_e32 v3, 1.0
; GCN-NEXT: exp mrt0 off, v2, off, off done
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_endpgm
call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)
ret void
}
define amdgpu_hs void @test_export_hs() #0 {
; GCN-LABEL: test_export_hs:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: v_mov_b32_e32 v0, 4.0
; GCN-NEXT: v_mov_b32_e32 v1, 0.5
; GCN-NEXT: v_mov_b32_e32 v2, 2.0
; GCN-NEXT: v_mov_b32_e32 v3, 1.0
; GCN-NEXT: exp mrt0 off, v2, off, off done
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_endpgm
call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)
ret void
}
define amdgpu_gfx void @test_export_gfx(float %v) #0 {
; GCN-LABEL: test_export_gfx:
; GCN: ; %bb.0:
; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GCN-NEXT: v_mov_b32_e32 v1, 4.0
; GCN-NEXT: v_mov_b32_e32 v2, 0.5
; GCN-NEXT: v_mov_b32_e32 v3, 2.0
; GCN-NEXT: exp mrt0 off, v3, off, off done
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_waitcnt_expcnt null, 0x0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_waitcnt expcnt(0)
; GCN-NEXT: s_setpc_b64 s[30:31]
call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float %v, float 2.0, float 0.5, float 4.0, i1 true, i1 false)
ret void
}
define amdgpu_cs void @test_export_cs() #0 {
; GCN-LABEL: test_export_cs:
; GCN: ; %bb.0:
; GCN-NEXT: v_mov_b32_e32 v0, 4.0
; GCN-NEXT: v_mov_b32_e32 v1, 0.5
; GCN-NEXT: v_mov_b32_e32 v2, 2.0
; GCN-NEXT: v_mov_b32_e32 v3, 1.0
; GCN-NEXT: exp mrt0 off, v2, off, off done
; GCN-NEXT: s_endpgm
call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)
ret void
}
define amdgpu_kernel void @test_export_kernel() #0 {
; GCN-LABEL: test_export_kernel:
; GCN: ; %bb.0:
; GCN-NEXT: v_mov_b32_e32 v0, 4.0
; GCN-NEXT: v_mov_b32_e32 v1, 0.5
; GCN-NEXT: v_mov_b32_e32 v2, 2.0
; GCN-NEXT: v_mov_b32_e32 v3, 1.0
; GCN-NEXT: exp mrt0 off, v2, off, off done
; GCN-NEXT: s_endpgm
call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false)
ret void
}
define amdgpu_gfx void @test_no_export_gfx(float %v) #0 {
; GCN-LABEL: test_no_export_gfx:
; GCN: ; %bb.0:
; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GCN-NEXT: s_setpc_b64 s[30:31]
ret void
}
define amdgpu_ps void @test_no_export_ps(float %v) #0 {
; GCN-LABEL: test_no_export_ps:
; GCN: ; %bb.0:
; GCN-NEXT: s_endpgm
ret void
}
define amdgpu_ps void @test_if_export_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 {
; GCN-LABEL: test_if_export_f32:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_mov_b32 s0, exec_lo
; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0
; GCN-NEXT: s_cbranch_execz .LBB9_2
; GCN-NEXT: ; %bb.1: ; %exp
; GCN-NEXT: exp mrt0 v1, v2, v3, v4
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_waitcnt_expcnt null, 0x0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_setprio 2
; GCN-NEXT: .LBB9_2: ; %end
; GCN-NEXT: s_endpgm
%cc = icmp eq i32 %flag, 0
br i1 %cc, label %end, label %exp
exp:
call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 false, i1 false)
br label %end
end:
ret void
}
define amdgpu_ps void @test_if_export_vm_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 {
; GCN-LABEL: test_if_export_vm_f32:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_mov_b32 s0, exec_lo
; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0
; GCN-NEXT: s_cbranch_execz .LBB10_2
; GCN-NEXT: ; %bb.1: ; %exp
; GCN-NEXT: exp mrt0 v1, v2, v3, v4
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_waitcnt_expcnt null, 0x0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_setprio 2
; GCN-NEXT: .LBB10_2: ; %end
; GCN-NEXT: s_endpgm
%cc = icmp eq i32 %flag, 0
br i1 %cc, label %end, label %exp
exp:
call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 false, i1 true)
br label %end
end:
ret void
}
define amdgpu_ps void @test_if_export_done_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 {
; GCN-LABEL: test_if_export_done_f32:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_mov_b32 s0, exec_lo
; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0
; GCN-NEXT: s_cbranch_execz .LBB11_2
; GCN-NEXT: ; %bb.1: ; %exp
; GCN-NEXT: exp mrt0 v1, v2, v3, v4 done
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_waitcnt_expcnt null, 0x0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_setprio 2
; GCN-NEXT: .LBB11_2: ; %end
; GCN-NEXT: s_endpgm
%cc = icmp eq i32 %flag, 0
br i1 %cc, label %end, label %exp
exp:
call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 true, i1 false)
br label %end
end:
ret void
}
define amdgpu_ps void @test_if_export_vm_done_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 {
; GCN-LABEL: test_if_export_vm_done_f32:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_mov_b32 s0, exec_lo
; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0
; GCN-NEXT: s_cbranch_execz .LBB12_2
; GCN-NEXT: ; %bb.1: ; %exp
; GCN-NEXT: exp mrt0 v1, v2, v3, v4 done
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_waitcnt_expcnt null, 0x0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_setprio 2
; GCN-NEXT: .LBB12_2: ; %end
; GCN-NEXT: s_endpgm
%cc = icmp eq i32 %flag, 0
br i1 %cc, label %end, label %exp
exp:
call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 true, i1 true)
br label %end
end:
ret void
}
define amdgpu_ps void @test_export_pos_before_param_across_load(i32 %idx) #0 {
; GCN-LABEL: test_export_pos_before_param_across_load:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: buffer_load_b32 v0, v0, s[0:3], 0 offen
; GCN-NEXT: v_mov_b32_e32 v1, 0
; GCN-NEXT: v_mov_b32_e32 v2, 1.0
; GCN-NEXT: v_mov_b32_e32 v3, 0.5
; GCN-NEXT: s_waitcnt vmcnt(0)
; GCN-NEXT: exp pos0 v1, v1, v1, v0 done
; GCN-NEXT: exp invalid_target_32 v2, v2, v2, v2
; GCN-NEXT: exp invalid_target_33 v2, v2, v2, v3
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_endpgm
call void @llvm.amdgcn.exp.f32(i32 32, i32 15, float 1.0, float 1.0, float 1.0, float 1.0, i1 false, i1 false)
call void @llvm.amdgcn.exp.f32(i32 33, i32 15, float 1.0, float 1.0, float 1.0, float 0.5, i1 false, i1 false)
%load = call float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8) undef, i32 %idx, i32 0, i32 0)
call void @llvm.amdgcn.exp.f32(i32 12, i32 15, float 0.0, float 0.0, float 0.0, float %load, i1 true, i1 false)
ret void
}
define amdgpu_ps void @test_export_across_store_load(i32 %idx, float %v) #0 {
; GCN-LABEL: test_export_across_store_load:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: v_mov_b32_e32 v2, 16
; GCN-NEXT: v_cmp_eq_u32_e32 vcc_lo, 1, v0
; GCN-NEXT: s_delay_alu instid0(VALU_DEP_2)
; GCN-NEXT: v_cndmask_b32_e64 v0, v2, 0, vcc_lo
; GCN-NEXT: v_mov_b32_e32 v2, 0
; GCN-NEXT: scratch_store_b32 v0, v1, off
; GCN-NEXT: scratch_load_b32 v0, off, off
; GCN-NEXT: v_mov_b32_e32 v1, 1.0
; GCN-NEXT: exp pos0 v2, v2, v2, v1 done
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_waitcnt_expcnt null, 0x0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_waitcnt vmcnt(0)
; GCN-NEXT: exp invalid_target_32 v0, v2, v1, v2
; GCN-NEXT: exp invalid_target_33 v0, v2, v1, v2
; GCN-NEXT: s_setprio 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_endpgm
%data0 = alloca <4 x float>, align 8, addrspace(5)
%data1 = alloca <4 x float>, align 8, addrspace(5)
%cmp = icmp eq i32 %idx, 1
%data = select i1 %cmp, ptr addrspace(5) %data0, ptr addrspace(5) %data1
store float %v, ptr addrspace(5) %data, align 8
call void @llvm.amdgcn.exp.f32(i32 12, i32 15, float 0.0, float 0.0, float 0.0, float 1.0, i1 true, i1 false)
%load0 = load float, ptr addrspace(5) %data0, align 8
call void @llvm.amdgcn.exp.f32(i32 32, i32 15, float %load0, float 0.0, float 1.0, float 0.0, i1 false, i1 false)
call void @llvm.amdgcn.exp.f32(i32 33, i32 15, float %load0, float 0.0, float 1.0, float 0.0, i1 false, i1 false)
ret void
}
define amdgpu_ps void @test_export_in_callee(float %v) #0 {
; GCN-LABEL: test_export_in_callee:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_getpc_b64 s[0:1]
; GCN-NEXT: s_add_u32 s0, s0, test_export_gfx@gotpcrel32@lo+4
; GCN-NEXT: s_addc_u32 s1, s1, test_export_gfx@gotpcrel32@hi+12
; GCN-NEXT: v_add_f32_e32 v0, 1.0, v0
; GCN-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
; GCN-NEXT: s_mov_b32 s32, 0
; GCN-NEXT: s_waitcnt lgkmcnt(0)
; GCN-NEXT: s_swappc_b64 s[30:31], s[0:1]
; GCN-NEXT: s_endpgm
%x = fadd float %v, 1.0
call void @test_export_gfx(float %x)
ret void
}
define amdgpu_ps void @test_export_in_callee_prio(float %v) #0 {
; GCN-LABEL: test_export_in_callee_prio:
; GCN: ; %bb.0:
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_mov_b32 s32, 0
; GCN-NEXT: v_add_f32_e32 v0, 1.0, v0
; GCN-NEXT: s_setprio 2
; GCN-NEXT: s_getpc_b64 s[0:1]
; GCN-NEXT: s_add_u32 s0, s0, test_export_gfx@gotpcrel32@lo+4
; GCN-NEXT: s_addc_u32 s1, s1, test_export_gfx@gotpcrel32@hi+12
; GCN-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
; GCN-NEXT: s_waitcnt lgkmcnt(0)
; GCN-NEXT: s_swappc_b64 s[30:31], s[0:1]
; GCN-NEXT: s_endpgm
%x = fadd float %v, 1.0
call void @llvm.amdgcn.s.setprio(i16 0)
call void @test_export_gfx(float %x)
ret void
}
declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1
declare void @llvm.amdgcn.exp.i32(i32, i32, i32, i32, i32, i32, i1, i1) #1
declare float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8), i32, i32, i32) #2
declare void @llvm.amdgcn.s.setprio(i16)
attributes #0 = { nounwind }
attributes #1 = { nounwind inaccessiblememonly }
attributes #2 = { nounwind readnone }
|