xref: /llvm-project/llvm/test/CodeGen/MIR/AMDGPU/custom-pseudo-source-values.ll (revision ab379378122ffaf2ab4c26d8683d96cf5fc5f3b8)
18214982bSSebastian Neubauer; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -stop-after finalize-isel -o %t.mir %s
28214982bSSebastian Neubauer; RUN: llc -run-pass=none -verify-machineinstrs %t.mir -o - | FileCheck %s
38214982bSSebastian Neubauer
48214982bSSebastian Neubauer; Test that custom pseudo source values can be round trip serialized through MIR.
58214982bSSebastian Neubauer
68214982bSSebastian Neubauer; CHECK-LABEL: {{^}}name: shader
7*ab379378SKrzysztof Drewniak; CHECK: %[[#]]:vgpr_32 = BUFFER_LOAD_DWORD_OFFSET killed %[[#]], %[[#]], 4, 0, 0, implicit $exec :: (dereferenceable load (s32) from %ir.arg3, align 1, addrspace 8)
8f0415f2aSKrzysztof Drewniak; CHECK: IMAGE_STORE_V4_V3_nsa_gfx10 killed %[[#]], %[[#]], %[[#]], %[[#]], killed %[[#]], 15, 2, -1, 0, 0, 0, 0, 0, 0, implicit $exec :: (dereferenceable store (s128), addrspace 8)
9fae05692SMatt Arsenault; CHECK: DS_GWS_BARRIER %[[#]], 63, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource")
10faa2c678SKrzysztof Drewniakdefine amdgpu_cs void @shader(i32 %arg0, i32 %arg1, <8 x i32> inreg %arg2, ptr addrspace(8) inreg %arg3) {
11faa2c678SKrzysztof Drewniak  %bload0 = call i32 @llvm.amdgcn.raw.ptr.buffer.load.i32(ptr addrspace(8) %arg3, i32 4, i32 0, i32 0)
12faa2c678SKrzysztof Drewniak  %bload1 = call i32 @llvm.amdgcn.raw.ptr.buffer.load.i32(ptr addrspace(8) %arg3, i32 8, i32 0, i32 0)
13faa2c678SKrzysztof Drewniak  %bload2 = call i32 @llvm.amdgcn.raw.ptr.buffer.load.i32(ptr addrspace(8) %arg3, i32 12, i32 0, i32 0)
14faa2c678SKrzysztof Drewniak  %bload3 = call i32 @llvm.amdgcn.raw.ptr.buffer.load.i32(ptr addrspace(8) %arg3, i32 16, i32 0, i32 0)
158214982bSSebastian Neubauer  %bload0.f = bitcast i32 %bload0 to float
168214982bSSebastian Neubauer  %bload1.f = bitcast i32 %bload1 to float
178214982bSSebastian Neubauer  %bload2.f = bitcast i32 %bload2 to float
188214982bSSebastian Neubauer  %bload3.f = bitcast i32 %bload3 to float
198214982bSSebastian Neubauer  %istore0 = insertelement <4 x float> undef, float %bload0.f, i32 0
208214982bSSebastian Neubauer  %istore1 = insertelement <4 x float> %istore0, float %bload0.f, i32 1
218214982bSSebastian Neubauer  %istore2 = insertelement <4 x float> %istore1, float %bload0.f, i32 2
228214982bSSebastian Neubauer  %istore3 = insertelement <4 x float> %istore2, float %bload0.f, i32 3
238214982bSSebastian Neubauer  call void @llvm.amdgcn.image.store.3d.v4f32.i32(<4 x float> %istore3, i32 15, i32 %arg0, i32 %arg1, i32 0, <8 x i32> %arg2, i32 0, i32 0)
248214982bSSebastian Neubauer  call void @llvm.amdgcn.ds.gws.barrier(i32 %bload0, i32 63)
258214982bSSebastian Neubauer  ret void
268214982bSSebastian Neubauer}
278214982bSSebastian Neubauer
288214982bSSebastian Neubauerdeclare void @llvm.amdgcn.image.store.3d.v4f32.i32(<4 x float>, i32 immarg, i32, i32, i32, <8 x i32>, i32 immarg, i32 immarg) #0
29faa2c678SKrzysztof Drewniakdeclare i32 @llvm.amdgcn.raw.ptr.buffer.load.i32(ptr addrspace(8), i32, i32, i32 immarg) #1
308214982bSSebastian Neubauerdeclare void @llvm.amdgcn.ds.gws.barrier(i32, i32) #2
318214982bSSebastian Neubauer
328214982bSSebastian Neubauerattributes #0 = { nounwind willreturn writeonly }
33faa2c678SKrzysztof Drewniakattributes #1 = { nounwind memory(argmem: read) willreturn }
348214982bSSebastian Neubauerattributes #2 = { convergent inaccessiblememonly nounwind }
35