|
| 1 | +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 -mattr=+dynamic-vgpr -stop-after=prologepilog < %s | FileCheck -check-prefix=CHECK %s |
| 2 | + |
| 3 | +; Make sure we use a stack pointer and allocate 112 * 4 bytes at the beginning of the stack. |
| 4 | + |
| 5 | +define amdgpu_cs void @amdgpu_cs() #0 { |
| 6 | +; CHECK-LABEL: {{^}}name: amdgpu_cs |
| 7 | +; CHECK: scratchReservedForDynamicVGPRs: 448 |
| 8 | + ret void |
| 9 | +} |
| 10 | + |
| 11 | +define amdgpu_kernel void @kernel() #0 { |
| 12 | +; CHECK-LABEL: {{^}}name: kernel |
| 13 | +; CHECK: scratchReservedForDynamicVGPRs: 448 |
| 14 | + ret void |
| 15 | +} |
| 16 | + |
| 17 | +define amdgpu_cs void @with_local() #0 { |
| 18 | +; CHECK-LABEL: {{^}}name: with_local |
| 19 | +; CHECK: scratchReservedForDynamicVGPRs: 448 |
| 20 | + %local = alloca i32, addrspace(5) |
| 21 | + store volatile i8 13, ptr addrspace(5) %local |
| 22 | + ret void |
| 23 | +} |
| 24 | + |
| 25 | +define amdgpu_cs void @with_calls() #0 { |
| 26 | +; CHECK-LABEL: {{^}}name: with_calls |
| 27 | +; CHECK: scratchReservedForDynamicVGPRs: 448 |
| 28 | + %local = alloca i32, addrspace(5) |
| 29 | + store volatile i8 15, ptr addrspace(5) %local |
| 30 | + call amdgpu_gfx void @callee(i32 71) |
| 31 | + ret void |
| 32 | +} |
| 33 | + |
| 34 | +define amdgpu_cs void @realign_stack(<32 x i32> %x) #0 { |
| 35 | +; CHECK-LABEL: {{^}}name: realign_stack |
| 36 | +; CHECK: scratchReservedForDynamicVGPRs: 512 |
| 37 | + %v = alloca <32 x i32>, align 128, addrspace(5) |
| 38 | + store <32 x i32> %x, ptr addrspace(5) %v |
| 39 | + call amdgpu_gfx void @callee(i32 71) |
| 40 | + ret void |
| 41 | +} |
| 42 | + |
| 43 | +; Non-entry functions and graphics shaders can't run on a compute queue, |
| 44 | +; so they don't need to worry about CWSR. |
| 45 | +define amdgpu_gs void @amdgpu_gs() #0 { |
| 46 | +; CHECK-LABEL: {{^}}name: amdgpu_gs |
| 47 | +; CHECK: scratchReservedForDynamicVGPRs: 0 |
| 48 | + %local = alloca i32, addrspace(5) |
| 49 | + store volatile i8 15, ptr addrspace(5) %local |
| 50 | + call amdgpu_gfx void @callee(i32 71) |
| 51 | + ret void |
| 52 | +} |
| 53 | + |
| 54 | +define amdgpu_gfx void @amdgpu_gfx() #0 { |
| 55 | +; CHECK-LABEL: {{^}}name: amdgpu_gfx |
| 56 | +; CHECK: scratchReservedForDynamicVGPRs: 0 |
| 57 | + %local = alloca i32, addrspace(5) |
| 58 | + store volatile i8 15, ptr addrspace(5) %local |
| 59 | + call amdgpu_gfx void @callee(i32 71) |
| 60 | + ret void |
| 61 | +} |
| 62 | + |
| 63 | +define void @default() #0 { |
| 64 | +; CHECK-LABEL: {{^}}name: default |
| 65 | +; CHECK: scratchReservedForDynamicVGPRs: 0 |
| 66 | + ret void |
| 67 | +} |
| 68 | + |
| 69 | +declare amdgpu_gfx void @callee(i32) #0 |
| 70 | + |
| 71 | +attributes #0 = { nounwind } |
| 72 | + |
0 commit comments