aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AMDGPU/machine-function-info-cwsr.ll
blob: cd428be729ae2e16c421fc77b5344b4292173385 (plain)
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
; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 -stop-after=prologepilog < %s | FileCheck -check-prefix=CHECK %s

; Make sure we use a stack pointer and allocate 112 * 4 bytes at the beginning of the stack.

define amdgpu_cs void @amdgpu_cs() #0 {
; CHECK-LABEL: {{^}}name: amdgpu_cs
; CHECK: scratchReservedForDynamicVGPRs: 448
  ret void
}

define amdgpu_kernel void @kernel() #0 {
; CHECK-LABEL: {{^}}name: kernel
; CHECK: scratchReservedForDynamicVGPRs: 448
  ret void
}

define amdgpu_cs void @with_local() #0 {
; CHECK-LABEL: {{^}}name: with_local
; CHECK: scratchReservedForDynamicVGPRs: 448
  %local = alloca i32, addrspace(5)
  store volatile i8 13, ptr addrspace(5) %local
  ret void
}

define amdgpu_cs void @with_calls() #0 {
; CHECK-LABEL: {{^}}name: with_calls
; CHECK: scratchReservedForDynamicVGPRs: 448
  %local = alloca i32, addrspace(5)
  store volatile i8 15, ptr addrspace(5) %local
  call amdgpu_gfx void @callee(i32 71)
  ret void
}

define amdgpu_cs void @realign_stack(<32 x i32> %x) #0 {
; CHECK-LABEL: {{^}}name: realign_stack
; CHECK: scratchReservedForDynamicVGPRs: 512
  %v = alloca <32 x i32>, align 128, addrspace(5)
  store <32 x i32> %x, ptr addrspace(5) %v
  call amdgpu_gfx void @callee(i32 71)
  ret void
}

; Non-entry functions and graphics shaders can't run on a compute queue,
; so they don't need to worry about CWSR.
define amdgpu_gs void @amdgpu_gs() #0 {
; CHECK-LABEL: {{^}}name: amdgpu_gs
; CHECK: scratchReservedForDynamicVGPRs: 0
  %local = alloca i32, addrspace(5)
  store volatile i8 15, ptr addrspace(5) %local
  call amdgpu_gfx void @callee(i32 71)
  ret void
}

define amdgpu_gfx void @amdgpu_gfx() #0 {
; CHECK-LABEL: {{^}}name: amdgpu_gfx
; CHECK: scratchReservedForDynamicVGPRs: 0
  %local = alloca i32, addrspace(5)
  store volatile i8 15, ptr addrspace(5) %local
  call amdgpu_gfx void @callee(i32 71)
  ret void
}

define void @default() #0 {
; CHECK-LABEL: {{^}}name: default
; CHECK: scratchReservedForDynamicVGPRs: 0
  ret void
}

declare amdgpu_gfx void @callee(i32) #0

attributes #0 = { nounwind "amdgpu-dynamic-vgpr-block-size" = "16" }