Skip to content

Commit 8d8be87

Browse files
committed
[AMDGPU][NFC] Generate llvm.amdgcn.set.inactive tests
This is a pre-commit for D95509.
1 parent dd7297e commit 8d8be87

File tree

2 files changed

+76
-12
lines changed

2 files changed

+76
-12
lines changed
Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
1-
; RUN: llc -global-isel -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %S/../llvm.amdgcn.set.inactive.ll | FileCheck -check-prefix=GCN %S/../llvm.amdgcn.set.inactive.ll
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -global-isel -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3+
4+
define amdgpu_kernel void @set_inactive(i32 addrspace(1)* %out, i32 %in) {
5+
; GCN-LABEL: set_inactive:
6+
; GCN: ; %bb.0:
7+
; GCN-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x24
8+
; GCN-NEXT: s_load_dword s0, s[0:1], 0x2c
9+
; GCN-NEXT: s_mov_b32 s6, -1
10+
; GCN-NEXT: s_waitcnt lgkmcnt(0)
11+
; GCN-NEXT: v_mov_b32_e32 v0, s0
12+
; GCN-NEXT: s_not_b64 exec, exec
13+
; GCN-NEXT: v_mov_b32_e32 v0, 42
14+
; GCN-NEXT: s_not_b64 exec, exec
15+
; GCN-NEXT: s_mov_b32 s7, 0xf000
16+
; GCN-NEXT: buffer_store_dword v0, off, s[4:7], 0
17+
; GCN-NEXT: s_endpgm
18+
%tmp = call i32 @llvm.amdgcn.set.inactive.i32(i32 %in, i32 42) #0
19+
store i32 %tmp, i32 addrspace(1)* %out
20+
ret void
21+
}
22+
23+
define amdgpu_kernel void @set_inactive_64(i64 addrspace(1)* %out, i64 %in) {
24+
; GCN-LABEL: set_inactive_64:
25+
; GCN: ; %bb.0:
26+
; GCN-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x24
27+
; GCN-NEXT: s_waitcnt lgkmcnt(0)
28+
; GCN-NEXT: v_mov_b32_e32 v0, s2
29+
; GCN-NEXT: v_mov_b32_e32 v1, s3
30+
; GCN-NEXT: s_not_b64 exec, exec
31+
; GCN-NEXT: v_mov_b32_e32 v0, 0
32+
; GCN-NEXT: v_mov_b32_e32 v1, 0
33+
; GCN-NEXT: s_not_b64 exec, exec
34+
; GCN-NEXT: v_mov_b32_e32 v3, s1
35+
; GCN-NEXT: v_mov_b32_e32 v2, s0
36+
; GCN-NEXT: flat_store_dwordx2 v[2:3], v[0:1]
37+
; GCN-NEXT: s_endpgm
38+
%tmp = call i64 @llvm.amdgcn.set.inactive.i64(i64 %in, i64 0) #0
39+
store i64 %tmp, i64 addrspace(1)* %out
40+
ret void
41+
}
42+
43+
declare i32 @llvm.amdgcn.set.inactive.i32(i32, i32) #0
44+
declare i64 @llvm.amdgcn.set.inactive.i64(i64, i64) #0
45+
46+
attributes #0 = { convergent readnone }

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.set.inactive.ll

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,42 @@
1-
; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
33

4-
5-
; GCN-LABEL: {{^}}set_inactive:
6-
; GCN: s_not_b64 exec, exec
7-
; GCN: v_mov_b32_e32 {{v[0-9]+}}, 42
8-
; GCN: s_not_b64 exec, exec
94
define amdgpu_kernel void @set_inactive(i32 addrspace(1)* %out, i32 %in) {
5+
; GCN-LABEL: set_inactive:
6+
; GCN: ; %bb.0:
7+
; GCN-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x24
8+
; GCN-NEXT: s_load_dword s0, s[0:1], 0x2c
9+
; GCN-NEXT: s_mov_b32 s7, 0xf000
10+
; GCN-NEXT: s_mov_b32 s6, -1
11+
; GCN-NEXT: s_waitcnt lgkmcnt(0)
12+
; GCN-NEXT: v_mov_b32_e32 v0, s0
13+
; GCN-NEXT: s_not_b64 exec, exec
14+
; GCN-NEXT: v_mov_b32_e32 v0, 42
15+
; GCN-NEXT: s_not_b64 exec, exec
16+
; GCN-NEXT: buffer_store_dword v0, off, s[4:7], 0
17+
; GCN-NEXT: s_endpgm
1018
%tmp = call i32 @llvm.amdgcn.set.inactive.i32(i32 %in, i32 42) #0
1119
store i32 %tmp, i32 addrspace(1)* %out
1220
ret void
1321
}
1422

15-
; GCN-LABEL: {{^}}set_inactive_64:
16-
; GCN: s_not_b64 exec, exec
17-
; GCN: v_mov_b32_e32 {{v[0-9]+}}, 0
18-
; GCN: v_mov_b32_e32 {{v[0-9]+}}, 0
19-
; GCN: s_not_b64 exec, exec
2023
define amdgpu_kernel void @set_inactive_64(i64 addrspace(1)* %out, i64 %in) {
24+
; GCN-LABEL: set_inactive_64:
25+
; GCN: ; %bb.0:
26+
; GCN-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x24
27+
; GCN-NEXT: s_mov_b32 s3, 0xf000
28+
; GCN-NEXT: s_mov_b32 s2, -1
29+
; GCN-NEXT: s_waitcnt lgkmcnt(0)
30+
; GCN-NEXT: s_mov_b32 s0, s4
31+
; GCN-NEXT: s_mov_b32 s1, s5
32+
; GCN-NEXT: v_mov_b32_e32 v0, s6
33+
; GCN-NEXT: v_mov_b32_e32 v1, s7
34+
; GCN-NEXT: s_not_b64 exec, exec
35+
; GCN-NEXT: v_mov_b32_e32 v0, 0
36+
; GCN-NEXT: v_mov_b32_e32 v1, 0
37+
; GCN-NEXT: s_not_b64 exec, exec
38+
; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0
39+
; GCN-NEXT: s_endpgm
2140
%tmp = call i64 @llvm.amdgcn.set.inactive.i64(i64 %in, i64 0) #0
2241
store i64 %tmp, i64 addrspace(1)* %out
2342
ret void

0 commit comments

Comments
 (0)