File: memory-legalizer-global-lastuse.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (94 lines) | stat: -rw-r--r-- 3,873 bytes parent folder | download | duplicates (2)
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1200 < %s | FileCheck --check-prefix=GFX12 %s
; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1200 -mattr=+cumode < %s | FileCheck --check-prefix=GFX12 %s

define amdgpu_kernel void @global_last_use_load_0(ptr addrspace(1) %in, ptr addrspace(1) %out) {
; GFX12-LABEL: global_last_use_load_0:
; GFX12:       ; %bb.0: ; %entry
; GFX12-NEXT:    s_load_b64 s[2:3], s[4:5], 0x0
; GFX12-NEXT:    s_load_b64 s[0:1], s[4:5], 0x8
; GFX12-NEXT:    v_mov_b32_e32 v0, 0
; GFX12-NEXT:    s_wait_kmcnt 0x0
; GFX12-NEXT:    s_load_b32 s2, s[2:3], 0x0
; GFX12-NEXT:    s_wait_kmcnt 0x0
; GFX12-NEXT:    v_mov_b32_e32 v1, s2
; GFX12-NEXT:    global_store_b32 v0, v1, s[0:1]
; GFX12-NEXT:    s_endpgm
entry:
  %val = load i32, ptr addrspace(1) %in, align 4, !amdgpu.last.use !{}
  store i32 %val, ptr addrspace(1) %out
  ret void
}

define amdgpu_kernel void @global_last_use_load_1(ptr addrspace(1) %in, ptr addrspace(1) %out) {
; GFX12-LABEL: global_last_use_load_1:
; GFX12:       ; %bb.0: ; %entry
; GFX12-NEXT:    v_mov_b32_e32 v1, v0
; GFX12-NEXT:    s_load_b64 s[2:3], s[4:5], 0x0
; GFX12-NEXT:    s_load_b64 s[0:1], s[4:5], 0x8
; GFX12-NEXT:    v_mov_b32_e32 v0, 0
; GFX12-NEXT:    s_mov_b32 s4, 0x3ff
; GFX12-NEXT:    s_wait_alu 0xfffe
; GFX12-NEXT:    v_and_b32_e64 v1, v1, s4
; GFX12-NEXT:    s_mov_b32 s4, 2
; GFX12-NEXT:    s_wait_alu 0xfffe
; GFX12-NEXT:    v_lshlrev_b32_e64 v1, s4, v1
; GFX12-NEXT:    s_wait_kmcnt 0x0
; GFX12-NEXT:    global_load_b32 v1, v1, s[2:3] th:TH_LOAD_LU
; GFX12-NEXT:    s_wait_loadcnt 0x0
; GFX12-NEXT:    global_store_b32 v0, v1, s[0:1]
; GFX12-NEXT:    s_endpgm
entry:
  %tid = call i32 @llvm.amdgcn.workitem.id.x()
  %val.gep = getelementptr inbounds i32, ptr addrspace(1) %in, i32 %tid
  %val = load i32, ptr addrspace(1) %val.gep, align 4, !amdgpu.last.use !{}
  store i32 %val, ptr addrspace(1) %out
  ret void
}

define amdgpu_kernel void @global_last_use_and_volatile_load(ptr addrspace(1) %in, ptr addrspace(1) %out) {
; GFX12-LABEL: global_last_use_and_volatile_load:
; GFX12:       ; %bb.0: ; %entry
; GFX12-NEXT:    v_mov_b32_e32 v0, 0
; GFX12-NEXT:    s_load_b64 s[2:3], s[4:5], 0x0
; GFX12-NEXT:    s_load_b64 s[0:1], s[4:5], 0x8
; GFX12-NEXT:    s_wait_kmcnt 0x0
; GFX12-NEXT:    global_load_b32 v1, v0, s[2:3] th:TH_LOAD_BYPASS scope:SCOPE_SYS
; GFX12-NEXT:    s_wait_bvhcnt 0x0
; GFX12-NEXT:    s_wait_samplecnt 0x0
; GFX12-NEXT:    s_wait_loadcnt 0x0
; GFX12-NEXT:    global_store_b32 v0, v1, s[0:1]
; GFX12-NEXT:    s_endpgm
entry:
  %val = load volatile i32, ptr addrspace(1) %in, align 4, !amdgpu.last.use !{}
  store i32 %val, ptr addrspace(1) %out
  ret void
}

define amdgpu_kernel void @global_last_use_and_nontemporal_load(ptr addrspace(1) %in, ptr addrspace(1) %out) {
; GFX12-LABEL: global_last_use_and_nontemporal_load:
; GFX12:       ; %bb.0: ; %entry
; GFX12-NEXT:    v_mov_b32_e32 v1, v0
; GFX12-NEXT:    s_load_b64 s[2:3], s[4:5], 0x0
; GFX12-NEXT:    s_load_b64 s[0:1], s[4:5], 0x8
; GFX12-NEXT:    v_mov_b32_e32 v0, 0
; GFX12-NEXT:    s_mov_b32 s4, 0x3ff
; GFX12-NEXT:    s_wait_alu 0xfffe
; GFX12-NEXT:    v_and_b32_e64 v1, v1, s4
; GFX12-NEXT:    s_mov_b32 s4, 2
; GFX12-NEXT:    s_wait_alu 0xfffe
; GFX12-NEXT:    v_lshlrev_b32_e64 v1, s4, v1
; GFX12-NEXT:    s_wait_kmcnt 0x0
; GFX12-NEXT:    global_load_b32 v1, v1, s[2:3] th:TH_LOAD_LU
; GFX12-NEXT:    s_wait_loadcnt 0x0
; GFX12-NEXT:    global_store_b32 v0, v1, s[0:1]
; GFX12-NEXT:    s_endpgm
entry:
  %tid = call i32 @llvm.amdgcn.workitem.id.x()
  %val.gep = getelementptr inbounds i32, ptr addrspace(1) %in, i32 %tid
  %val = load i32, ptr addrspace(1) %val.gep, align 4, !amdgpu.last.use !{}, !nontemporal !0
  store i32 %val, ptr addrspace(1) %out
  ret void
}
!0 = !{i32 1}
declare i32 @llvm.amdgcn.workitem.id.x()