annotate llvm/test/CodeGen/AMDGPU/bfe-patterns.ll @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=SI %s
anatofuz
parents:
diff changeset
2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN -check-prefix=VI %s
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 ; GCN-LABEL: {{^}}v_ubfe_sub_i32:
anatofuz
parents:
diff changeset
5 ; GCN: {{buffer|flat}}_load_dword [[SRC:v[0-9]+]]
anatofuz
parents:
diff changeset
6 ; GCN: {{buffer|flat}}_load_dword [[WIDTH:v[0-9]+]]
anatofuz
parents:
diff changeset
7 ; GCN: v_bfe_u32 v{{[0-9]+}}, [[SRC]], 0, [[WIDTH]]
anatofuz
parents:
diff changeset
8 define amdgpu_kernel void @v_ubfe_sub_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in0, i32 addrspace(1)* %in1) #1 {
anatofuz
parents:
diff changeset
9 %id.x = tail call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
10 %in0.gep = getelementptr i32, i32 addrspace(1)* %in0, i32 %id.x
anatofuz
parents:
diff changeset
11 %in1.gep = getelementptr i32, i32 addrspace(1)* %in1, i32 %id.x
anatofuz
parents:
diff changeset
12 %out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id.x
anatofuz
parents:
diff changeset
13 %src = load volatile i32, i32 addrspace(1)* %in0.gep
anatofuz
parents:
diff changeset
14 %width = load volatile i32, i32 addrspace(1)* %in0.gep
anatofuz
parents:
diff changeset
15 %sub = sub i32 32, %width
anatofuz
parents:
diff changeset
16 %shl = shl i32 %src, %sub
anatofuz
parents:
diff changeset
17 %bfe = lshr i32 %shl, %sub
anatofuz
parents:
diff changeset
18 store i32 %bfe, i32 addrspace(1)* %out.gep
anatofuz
parents:
diff changeset
19 ret void
anatofuz
parents:
diff changeset
20 }
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 ; GCN-LABEL: {{^}}v_ubfe_sub_multi_use_shl_i32:
anatofuz
parents:
diff changeset
23 ; GCN: {{buffer|flat}}_load_dword [[SRC:v[0-9]+]]
anatofuz
parents:
diff changeset
24 ; GCN: {{buffer|flat}}_load_dword [[WIDTH:v[0-9]+]]
anatofuz
parents:
diff changeset
25 ; GCN: v_sub_{{[iu]}}32_e32 [[SUB:v[0-9]+]], vcc, 32, [[WIDTH]]
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 ; SI-NEXT: v_lshl_b32_e32 [[SHL:v[0-9]+]], [[SRC]], [[SUB]]
anatofuz
parents:
diff changeset
28 ; SI-NEXT: v_lshr_b32_e32 [[BFE:v[0-9]+]], [[SHL]], [[SUB]]
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 ; VI-NEXT: v_lshlrev_b32_e32 [[SHL:v[0-9]+]], [[SUB]], [[SRC]]
anatofuz
parents:
diff changeset
31 ; VI-NEXT: v_lshrrev_b32_e32 [[BFE:v[0-9]+]], [[SUB]], [[SHL]]
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 ; GCN: [[BFE]]
anatofuz
parents:
diff changeset
34 ; GCN: [[SHL]]
anatofuz
parents:
diff changeset
35 define amdgpu_kernel void @v_ubfe_sub_multi_use_shl_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in0, i32 addrspace(1)* %in1) #1 {
anatofuz
parents:
diff changeset
36 %id.x = tail call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
37 %in0.gep = getelementptr i32, i32 addrspace(1)* %in0, i32 %id.x
anatofuz
parents:
diff changeset
38 %in1.gep = getelementptr i32, i32 addrspace(1)* %in1, i32 %id.x
anatofuz
parents:
diff changeset
39 %out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id.x
anatofuz
parents:
diff changeset
40 %src = load volatile i32, i32 addrspace(1)* %in0.gep
anatofuz
parents:
diff changeset
41 %width = load volatile i32, i32 addrspace(1)* %in0.gep
anatofuz
parents:
diff changeset
42 %sub = sub i32 32, %width
anatofuz
parents:
diff changeset
43 %shl = shl i32 %src, %sub
anatofuz
parents:
diff changeset
44 %bfe = lshr i32 %shl, %sub
anatofuz
parents:
diff changeset
45 store i32 %bfe, i32 addrspace(1)* %out.gep
anatofuz
parents:
diff changeset
46 store volatile i32 %shl, i32 addrspace(1)* undef
anatofuz
parents:
diff changeset
47 ret void
anatofuz
parents:
diff changeset
48 }
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 ; GCN-LABEL: {{^}}s_ubfe_sub_i32:
anatofuz
parents:
diff changeset
51 ; GCN: s_load_dwordx2 s{{\[}}[[SRC:[0-9]+]]:[[WIDTH:[0-9]+]]{{\]}}, s[0:1], {{0xb|0x2c}}
anatofuz
parents:
diff changeset
52 ; GCN: v_mov_b32_e32 [[VWIDTH:v[0-9]+]], s[[WIDTH]]
anatofuz
parents:
diff changeset
53 ; GCN: v_bfe_u32 v{{[0-9]+}}, s[[SRC]], 0, [[VWIDTH]]
anatofuz
parents:
diff changeset
54 define amdgpu_kernel void @s_ubfe_sub_i32(i32 addrspace(1)* %out, i32 %src, i32 %width) #1 {
anatofuz
parents:
diff changeset
55 %id.x = tail call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
56 %out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id.x
anatofuz
parents:
diff changeset
57 %sub = sub i32 32, %width
anatofuz
parents:
diff changeset
58 %shl = shl i32 %src, %sub
anatofuz
parents:
diff changeset
59 %bfe = lshr i32 %shl, %sub
anatofuz
parents:
diff changeset
60 store i32 %bfe, i32 addrspace(1)* %out.gep
anatofuz
parents:
diff changeset
61 ret void
anatofuz
parents:
diff changeset
62 }
anatofuz
parents:
diff changeset
63
anatofuz
parents:
diff changeset
64 ; GCN-LABEL: {{^}}s_ubfe_sub_multi_use_shl_i32:
anatofuz
parents:
diff changeset
65 ; GCN: s_load_dwordx2 s{{\[}}[[SRC:[0-9]+]]:[[WIDTH:[0-9]+]]{{\]}}, s[0:1], {{0xb|0x2c}}
anatofuz
parents:
diff changeset
66 ; GCN: s_sub_i32 [[SUB:s[0-9]+]], 32, s[[WIDTH]]
anatofuz
parents:
diff changeset
67 ; GCN: s_lshl_b32 [[SHL:s[0-9]+]], s[[SRC]], [[SUB]]
anatofuz
parents:
diff changeset
68 ; GCN: s_lshr_b32 s{{[0-9]+}}, [[SHL]], [[SUB]]
anatofuz
parents:
diff changeset
69 define amdgpu_kernel void @s_ubfe_sub_multi_use_shl_i32(i32 addrspace(1)* %out, i32 %src, i32 %width) #1 {
anatofuz
parents:
diff changeset
70 %id.x = tail call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
71 %out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id.x
anatofuz
parents:
diff changeset
72 %sub = sub i32 32, %width
anatofuz
parents:
diff changeset
73 %shl = shl i32 %src, %sub
anatofuz
parents:
diff changeset
74 %bfe = lshr i32 %shl, %sub
anatofuz
parents:
diff changeset
75 store i32 %bfe, i32 addrspace(1)* %out.gep
anatofuz
parents:
diff changeset
76 store volatile i32 %shl, i32 addrspace(1)* undef
anatofuz
parents:
diff changeset
77 ret void
anatofuz
parents:
diff changeset
78 }
anatofuz
parents:
diff changeset
79
anatofuz
parents:
diff changeset
80 ; GCN-LABEL: {{^}}v_sbfe_sub_i32:
anatofuz
parents:
diff changeset
81 ; GCN: {{buffer|flat}}_load_dword [[SRC:v[0-9]+]]
anatofuz
parents:
diff changeset
82 ; GCN: {{buffer|flat}}_load_dword [[WIDTH:v[0-9]+]]
anatofuz
parents:
diff changeset
83 ; GCN: v_bfe_i32 v{{[0-9]+}}, [[SRC]], 0, [[WIDTH]]
anatofuz
parents:
diff changeset
84 define amdgpu_kernel void @v_sbfe_sub_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in0, i32 addrspace(1)* %in1) #1 {
anatofuz
parents:
diff changeset
85 %id.x = tail call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
86 %in0.gep = getelementptr i32, i32 addrspace(1)* %in0, i32 %id.x
anatofuz
parents:
diff changeset
87 %in1.gep = getelementptr i32, i32 addrspace(1)* %in1, i32 %id.x
anatofuz
parents:
diff changeset
88 %out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id.x
anatofuz
parents:
diff changeset
89 %src = load volatile i32, i32 addrspace(1)* %in0.gep
anatofuz
parents:
diff changeset
90 %width = load volatile i32, i32 addrspace(1)* %in0.gep
anatofuz
parents:
diff changeset
91 %sub = sub i32 32, %width
anatofuz
parents:
diff changeset
92 %shl = shl i32 %src, %sub
anatofuz
parents:
diff changeset
93 %bfe = ashr i32 %shl, %sub
anatofuz
parents:
diff changeset
94 store i32 %bfe, i32 addrspace(1)* %out.gep
anatofuz
parents:
diff changeset
95 ret void
anatofuz
parents:
diff changeset
96 }
anatofuz
parents:
diff changeset
97
anatofuz
parents:
diff changeset
98 ; GCN-LABEL: {{^}}v_sbfe_sub_multi_use_shl_i32:
anatofuz
parents:
diff changeset
99 ; GCN: {{buffer|flat}}_load_dword [[SRC:v[0-9]+]]
anatofuz
parents:
diff changeset
100 ; GCN: {{buffer|flat}}_load_dword [[WIDTH:v[0-9]+]]
anatofuz
parents:
diff changeset
101 ; GCN: v_sub_{{[iu]}}32_e32 [[SUB:v[0-9]+]], vcc, 32, [[WIDTH]]
anatofuz
parents:
diff changeset
102
anatofuz
parents:
diff changeset
103 ; SI-NEXT: v_lshl_b32_e32 [[SHL:v[0-9]+]], [[SRC]], [[SUB]]
anatofuz
parents:
diff changeset
104 ; SI-NEXT: v_ashr_i32_e32 [[BFE:v[0-9]+]], [[SHL]], [[SUB]]
anatofuz
parents:
diff changeset
105
anatofuz
parents:
diff changeset
106 ; VI-NEXT: v_lshlrev_b32_e32 [[SHL:v[0-9]+]], [[SUB]], [[SRC]]
anatofuz
parents:
diff changeset
107 ; VI-NEXT: v_ashrrev_i32_e32 [[BFE:v[0-9]+]], [[SUB]], [[SHL]]
anatofuz
parents:
diff changeset
108
anatofuz
parents:
diff changeset
109 ; GCN: [[BFE]]
anatofuz
parents:
diff changeset
110 ; GCN: [[SHL]]
anatofuz
parents:
diff changeset
111 define amdgpu_kernel void @v_sbfe_sub_multi_use_shl_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in0, i32 addrspace(1)* %in1) #1 {
anatofuz
parents:
diff changeset
112 %id.x = tail call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
113 %in0.gep = getelementptr i32, i32 addrspace(1)* %in0, i32 %id.x
anatofuz
parents:
diff changeset
114 %in1.gep = getelementptr i32, i32 addrspace(1)* %in1, i32 %id.x
anatofuz
parents:
diff changeset
115 %out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id.x
anatofuz
parents:
diff changeset
116 %src = load volatile i32, i32 addrspace(1)* %in0.gep
anatofuz
parents:
diff changeset
117 %width = load volatile i32, i32 addrspace(1)* %in0.gep
anatofuz
parents:
diff changeset
118 %sub = sub i32 32, %width
anatofuz
parents:
diff changeset
119 %shl = shl i32 %src, %sub
anatofuz
parents:
diff changeset
120 %bfe = ashr i32 %shl, %sub
anatofuz
parents:
diff changeset
121 store i32 %bfe, i32 addrspace(1)* %out.gep
anatofuz
parents:
diff changeset
122 store volatile i32 %shl, i32 addrspace(1)* undef
anatofuz
parents:
diff changeset
123 ret void
anatofuz
parents:
diff changeset
124 }
anatofuz
parents:
diff changeset
125
anatofuz
parents:
diff changeset
126 ; GCN-LABEL: {{^}}s_sbfe_sub_i32:
anatofuz
parents:
diff changeset
127 ; GCN: s_load_dwordx2 s{{\[}}[[SRC:[0-9]+]]:[[WIDTH:[0-9]+]]{{\]}}, s[0:1], {{0xb|0x2c}}
anatofuz
parents:
diff changeset
128 ; GCN: v_mov_b32_e32 [[VWIDTH:v[0-9]+]], s[[WIDTH]]
anatofuz
parents:
diff changeset
129 ; GCN: v_bfe_i32 v{{[0-9]+}}, s[[SRC]], 0, [[VWIDTH]]
anatofuz
parents:
diff changeset
130 define amdgpu_kernel void @s_sbfe_sub_i32(i32 addrspace(1)* %out, i32 %src, i32 %width) #1 {
anatofuz
parents:
diff changeset
131 %id.x = tail call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
132 %out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id.x
anatofuz
parents:
diff changeset
133 %sub = sub i32 32, %width
anatofuz
parents:
diff changeset
134 %shl = shl i32 %src, %sub
anatofuz
parents:
diff changeset
135 %bfe = ashr i32 %shl, %sub
anatofuz
parents:
diff changeset
136 store i32 %bfe, i32 addrspace(1)* %out.gep
anatofuz
parents:
diff changeset
137 ret void
anatofuz
parents:
diff changeset
138 }
anatofuz
parents:
diff changeset
139
anatofuz
parents:
diff changeset
140 ; GCN-LABEL: {{^}}s_sbfe_sub_multi_use_shl_i32:
anatofuz
parents:
diff changeset
141 ; GCN: s_load_dwordx2 s{{\[}}[[SRC:[0-9]+]]:[[WIDTH:[0-9]+]]{{\]}}, s[0:1], {{0xb|0x2c}}
anatofuz
parents:
diff changeset
142 ; GCN: s_sub_i32 [[SUB:s[0-9]+]], 32, s[[WIDTH]]
anatofuz
parents:
diff changeset
143 ; GCN: s_lshl_b32 [[SHL:s[0-9]+]], s[[SRC]], [[SUB]]
anatofuz
parents:
diff changeset
144 ; GCN: s_ashr_i32 s{{[0-9]+}}, [[SHL]], [[SUB]]
anatofuz
parents:
diff changeset
145 define amdgpu_kernel void @s_sbfe_sub_multi_use_shl_i32(i32 addrspace(1)* %out, i32 %src, i32 %width) #1 {
anatofuz
parents:
diff changeset
146 %id.x = tail call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
147 %out.gep = getelementptr i32, i32 addrspace(1)* %out, i32 %id.x
anatofuz
parents:
diff changeset
148 %sub = sub i32 32, %width
anatofuz
parents:
diff changeset
149 %shl = shl i32 %src, %sub
anatofuz
parents:
diff changeset
150 %bfe = ashr i32 %shl, %sub
anatofuz
parents:
diff changeset
151 store i32 %bfe, i32 addrspace(1)* %out.gep
anatofuz
parents:
diff changeset
152 store volatile i32 %shl, i32 addrspace(1)* undef
anatofuz
parents:
diff changeset
153 ret void
anatofuz
parents:
diff changeset
154 }
anatofuz
parents:
diff changeset
155
anatofuz
parents:
diff changeset
156 declare i32 @llvm.amdgcn.workitem.id.x() #0
anatofuz
parents:
diff changeset
157
anatofuz
parents:
diff changeset
158 attributes #0 = { nounwind readnone }
anatofuz
parents:
diff changeset
159 attributes #1 = { nounwind }