annotate llvm/test/CodeGen/AMDGPU/amdpal.ll @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 79ff65ed7e25
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; RUN: llc < %s -mtriple=amdgcn--amdpal -mcpu=tahiti | FileCheck --check-prefixes=PAL,CI --enable-var-scope %s
anatofuz
parents:
diff changeset
2 ; RUN: llc < %s -mtriple=amdgcn--amdpal -mcpu=tonga | FileCheck --check-prefixes=PAL,VI --enable-var-scope %s
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 ; PAL-NOT: .AMDGPU.config
anatofuz
parents:
diff changeset
5 ; PAL-LABEL: {{^}}simple:
anatofuz
parents:
diff changeset
6 define amdgpu_kernel void @simple(i32 addrspace(1)* %out) {
anatofuz
parents:
diff changeset
7 entry:
anatofuz
parents:
diff changeset
8 store i32 0, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
9 ret void
anatofuz
parents:
diff changeset
10 }
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 ; Check code sequence for amdpal use of scratch for alloca. This is the case
anatofuz
parents:
diff changeset
13 ; where the high half of the address comes from s_getpc.
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 ; PAL-LABEL: {{^}}scratch:
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
16 ; PAL: s_getpc_b64 s[[[GITPTR:[0-9]+]]:
150
anatofuz
parents:
diff changeset
17 ; PAL: s_mov_b32 s[[GITPTR]], s0
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
18 ; PAL: s_load_dwordx4 s[[[SCRATCHDESC:[0-9]+]]:{{[0-9]+]}}, s[[[GITPTR]]:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
19 ; PAL: buffer_store{{.*}}, s[[[SCRATCHDESC]]:
150
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 define amdgpu_kernel void @scratch(<2 x i32> %in, i32 %idx, i32 addrspace(5)* %out) {
anatofuz
parents:
diff changeset
22 entry:
anatofuz
parents:
diff changeset
23 %v = alloca [2 x i32], addrspace(5)
anatofuz
parents:
diff changeset
24 %vv = bitcast [2 x i32] addrspace(5)* %v to <2 x i32> addrspace(5)*
anatofuz
parents:
diff changeset
25 store <2 x i32> %in, <2 x i32> addrspace(5)* %vv
anatofuz
parents:
diff changeset
26 %e = getelementptr [2 x i32], [2 x i32] addrspace(5)* %v, i32 0, i32 %idx
anatofuz
parents:
diff changeset
27 %x = load i32, i32 addrspace(5)* %e
anatofuz
parents:
diff changeset
28 store i32 %x, i32 addrspace(5)* %out
anatofuz
parents:
diff changeset
29 ret void
anatofuz
parents:
diff changeset
30 }
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 ; Check code sequence for amdpal use of scratch for alloca. This is the case
anatofuz
parents:
diff changeset
33 ; where the amdgpu-git-ptr-high function attribute gives the high half of the
anatofuz
parents:
diff changeset
34 ; address to use.
anatofuz
parents:
diff changeset
35 ; Looks like you can't do arithmetic on a filecheck variable, so we can't test
anatofuz
parents:
diff changeset
36 ; that the s_movk_i32 is into a reg that is one more than the following
anatofuz
parents:
diff changeset
37 ; s_mov_b32.
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 ; PAL-LABEL: {{^}}scratch2:
anatofuz
parents:
diff changeset
40 ; PAL: s_movk_i32 s{{[0-9]+}}, 0x1234
anatofuz
parents:
diff changeset
41 ; PAL: s_mov_b32 s[[GITPTR:[0-9]+]], s0
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
42 ; PAL: s_load_dwordx4 s[[[SCRATCHDESC:[0-9]+]]:{{[0-9]+]}}, s[[[GITPTR]]:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
43 ; PAL: buffer_store{{.*}}, s[[[SCRATCHDESC]]:
150
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 define amdgpu_kernel void @scratch2(<2 x i32> %in, i32 %idx, i32 addrspace(5)* %out) #0 {
anatofuz
parents:
diff changeset
46 entry:
anatofuz
parents:
diff changeset
47 %v = alloca [2 x i32], addrspace(5)
anatofuz
parents:
diff changeset
48 %vv = bitcast [2 x i32] addrspace(5)* %v to <2 x i32> addrspace(5)*
anatofuz
parents:
diff changeset
49 store <2 x i32> %in, <2 x i32> addrspace(5)* %vv
anatofuz
parents:
diff changeset
50 %e = getelementptr [2 x i32], [2 x i32] addrspace(5)* %v, i32 0, i32 %idx
anatofuz
parents:
diff changeset
51 %x = load i32, i32 addrspace(5)* %e
anatofuz
parents:
diff changeset
52 store i32 %x, i32 addrspace(5)* %out
anatofuz
parents:
diff changeset
53 ret void
anatofuz
parents:
diff changeset
54 }
anatofuz
parents:
diff changeset
55
anatofuz
parents:
diff changeset
56 ; Check code sequence for amdpal use of scratch for alloca in a compute shader.
anatofuz
parents:
diff changeset
57 ; The scratch descriptor is loaded from offset 0x10 of the GIT, rather than offset
anatofuz
parents:
diff changeset
58 ; 0 in a graphics shader.
anatofuz
parents:
diff changeset
59 ; Prior to GCN3 s_load_dword offsets are dwords, so the offset will be 0x4.
anatofuz
parents:
diff changeset
60
anatofuz
parents:
diff changeset
61 ; PAL-LABEL: {{^}}scratch2_cs:
anatofuz
parents:
diff changeset
62 ; PAL: s_movk_i32 s{{[0-9]+}}, 0x1234
anatofuz
parents:
diff changeset
63 ; PAL: s_mov_b32 s[[GITPTR:[0-9]+]], s0
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
64 ; CI: s_load_dwordx4 s[[[SCRATCHDESC:[0-9]+]]:{{[0-9]+]}}, s[[[GITPTR]]:{{[0-9]+\]}}, 0x4
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
65 ; VI: s_load_dwordx4 s[[[SCRATCHDESC:[0-9]+]]:{{[0-9]+]}}, s[[[GITPTR]]:{{[0-9]+\]}}, 0x10
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
66 ; PAL: buffer_store{{.*}}, s[[[SCRATCHDESC]]:
150
anatofuz
parents:
diff changeset
67
anatofuz
parents:
diff changeset
68 define amdgpu_cs void @scratch2_cs(i32 inreg, i32 inreg, i32 inreg, <3 x i32> inreg, i32 inreg, <3 x i32> %coord, <2 x i32> %in, i32 %extra, i32 %idx) #0 {
anatofuz
parents:
diff changeset
69 entry:
anatofuz
parents:
diff changeset
70 %v = alloca [3 x i32], addrspace(5)
anatofuz
parents:
diff changeset
71 %v0 = getelementptr [3 x i32], [3 x i32] addrspace(5)* %v, i32 0, i32 0
anatofuz
parents:
diff changeset
72 %v1 = getelementptr [3 x i32], [3 x i32] addrspace(5)* %v, i32 0, i32 1
anatofuz
parents:
diff changeset
73 store i32 %extra, i32 addrspace(5)* %v0
anatofuz
parents:
diff changeset
74 %v1a = bitcast i32 addrspace(5)* %v1 to [2 x i32] addrspace(5)*
anatofuz
parents:
diff changeset
75 %vv = bitcast [2 x i32] addrspace(5)* %v1a to <2 x i32> addrspace(5)*
anatofuz
parents:
diff changeset
76 store <2 x i32> %in, <2 x i32> addrspace(5)* %vv
anatofuz
parents:
diff changeset
77 %e = getelementptr [2 x i32], [2 x i32] addrspace(5)* %v1a, i32 0, i32 %idx
anatofuz
parents:
diff changeset
78 %x = load i32, i32 addrspace(5)* %e
anatofuz
parents:
diff changeset
79 %xf = bitcast i32 %x to float
anatofuz
parents:
diff changeset
80 call void @llvm.amdgcn.raw.buffer.store.f32(float %xf, <4 x i32> undef, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
81 ret void
anatofuz
parents:
diff changeset
82 }
anatofuz
parents:
diff changeset
83
anatofuz
parents:
diff changeset
84 attributes #0 = { nounwind "amdgpu-git-ptr-high"="0x1234" }
anatofuz
parents:
diff changeset
85
anatofuz
parents:
diff changeset
86 declare void @llvm.amdgcn.raw.buffer.store.f32(float, <4 x i32>, i32, i32, i32 immarg)
anatofuz
parents:
diff changeset
87
anatofuz
parents:
diff changeset
88
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
89 ; PAL: .amdgpu_pal_metadata
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
90 ; PAL-NEXT: ---
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
91 ; PAL-NEXT: amdpal.pipelines:
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
92 ; PAL-NEXT: - .hardware_stages:
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
93 ; PAL-NEXT: .cs:
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
94 ; PAL-NEXT: .entry_point: scratch2_cs
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
95 ; PAL-NEXT: .scratch_memory_size: 0x10
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
96 ; PAL-NEXT: .sgpr_count: 0x
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
97 ; PAL-NEXT: .vgpr_count: 0x