summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp146
1 files changed, 79 insertions, 67 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
index e228fa072..d4e519a2a 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
@@ -12,42 +12,46 @@ namespace Shader::Backend::GLASM {
12 12
13void EmitIAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 13void EmitIAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
14 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 14 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
15 throw NotImplementedException("GLASM instruction"); 15 ctx.Add("ADD {},{},{};", inst, a, b);
16} 16}
17 17
18void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 18void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
19 [[maybe_unused]] std::string_view b) { 19 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
20 throw NotImplementedException("GLASM instruction"); 20 throw NotImplementedException("GLASM instruction");
21} 21}
22 22
23void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 23void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
24 [[maybe_unused]] std::string_view b) { 24 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
25 throw NotImplementedException("GLASM instruction"); 25 ctx.Add("SUB {},{},{};", inst, a, b);
26} 26}
27 27
28void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 28void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
29 [[maybe_unused]] std::string_view b) { 29 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
30 throw NotImplementedException("GLASM instruction"); 30 throw NotImplementedException("GLASM instruction");
31} 31}
32 32
33void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 33void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
34 [[maybe_unused]] std::string_view b) { 34 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
35 throw NotImplementedException("GLASM instruction"); 35 throw NotImplementedException("GLASM instruction");
36} 36}
37 37
38void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 38void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
39 [[maybe_unused]] std::string_view value) {
39 throw NotImplementedException("GLASM instruction"); 40 throw NotImplementedException("GLASM instruction");
40} 41}
41 42
42void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 43void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
44 [[maybe_unused]] std::string_view value) {
43 throw NotImplementedException("GLASM instruction"); 45 throw NotImplementedException("GLASM instruction");
44} 46}
45 47
46void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 48void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
49 [[maybe_unused]] std::string_view value) {
47 throw NotImplementedException("GLASM instruction"); 50 throw NotImplementedException("GLASM instruction");
48} 51}
49 52
50void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 53void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
54 [[maybe_unused]] std::string_view value) {
51 throw NotImplementedException("GLASM instruction"); 55 throw NotImplementedException("GLASM instruction");
52} 56}
53 57
@@ -94,7 +98,7 @@ void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::In
94 98
95void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 99void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
96 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 100 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
97 throw NotImplementedException("GLASM instruction"); 101 ctx.Add("OR {},{},{};", inst, a, b);
98} 102}
99 103
100void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 104void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -102,64 +106,66 @@ void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::In
102 throw NotImplementedException("GLASM instruction"); 106 throw NotImplementedException("GLASM instruction");
103} 107}
104 108
105void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view base, 109void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base,
106 [[maybe_unused]] std::string_view insert, 110 std::string_view insert, std::string_view offset, std::string_view count) {
107 [[maybe_unused]] std::string_view offset, 111 ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset);
108 [[maybe_unused]] std::string_view count) { 112 ctx.Add("BFI.U {},RC,{},{};", inst, insert, base);
109 throw NotImplementedException("GLASM instruction");
110} 113}
111 114
112void EmitBitFieldSExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 115void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base,
113 [[maybe_unused]] std::string_view base, 116 std::string_view offset, std::string_view count) {
114 [[maybe_unused]] std::string_view offset, 117 ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset);
115 [[maybe_unused]] std::string_view count) { 118 ctx.Add("BFE.S {},RC,{};", inst, base);
116 throw NotImplementedException("GLASM instruction");
117} 119}
118 120
119void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 121void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base,
120 [[maybe_unused]] std::string_view base, 122 std::string_view offset, std::string_view count) {
121 [[maybe_unused]] std::string_view offset, 123 ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset);
122 [[maybe_unused]] std::string_view count) { 124 ctx.Add("BFE.U {},RC,{};", inst, base);
123 throw NotImplementedException("GLASM instruction");
124} 125}
125 126
126void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 127void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
127 throw NotImplementedException("GLASM instruction"); 128 [[maybe_unused]] std::string_view value) {
129 ctx.Add("BFR {},{};", inst, value);
128} 130}
129 131
130void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 132void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
133 [[maybe_unused]] std::string_view value) {
131 throw NotImplementedException("GLASM instruction"); 134 throw NotImplementedException("GLASM instruction");
132} 135}
133 136
134void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 137void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
138 [[maybe_unused]] std::string_view value) {
135 throw NotImplementedException("GLASM instruction"); 139 throw NotImplementedException("GLASM instruction");
136} 140}
137 141
138void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 142void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
143 [[maybe_unused]] std::string_view value) {
139 throw NotImplementedException("GLASM instruction"); 144 throw NotImplementedException("GLASM instruction");
140} 145}
141 146
142void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { 147void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
148 [[maybe_unused]] std::string_view value) {
143 throw NotImplementedException("GLASM instruction"); 149 throw NotImplementedException("GLASM instruction");
144} 150}
145 151
146void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 152void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
147 [[maybe_unused]] std::string_view b) { 153 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
148 throw NotImplementedException("GLASM instruction"); 154 throw NotImplementedException("GLASM instruction");
149} 155}
150 156
151void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 157void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
152 [[maybe_unused]] std::string_view b) { 158 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
153 throw NotImplementedException("GLASM instruction"); 159 throw NotImplementedException("GLASM instruction");
154} 160}
155 161
156void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 162void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
157 [[maybe_unused]] std::string_view b) { 163 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
158 throw NotImplementedException("GLASM instruction"); 164 throw NotImplementedException("GLASM instruction");
159} 165}
160 166
161void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, 167void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
162 [[maybe_unused]] std::string_view b) { 168 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
163 throw NotImplementedException("GLASM instruction"); 169 throw NotImplementedException("GLASM instruction");
164} 170}
165 171
@@ -175,54 +181,60 @@ void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst&
175 throw NotImplementedException("GLASM instruction"); 181 throw NotImplementedException("GLASM instruction");
176} 182}
177 183
178void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 184void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
179 [[maybe_unused]] std::string_view rhs) { 185 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
180 throw NotImplementedException("GLASM instruction"); 186 ctx.Add("SLT.S {},{},{};", inst, lhs, rhs);
181} 187}
182 188
183void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 189void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
184 [[maybe_unused]] std::string_view rhs) { 190 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
185 throw NotImplementedException("GLASM instruction"); 191 ctx.Add("SLT.U {},{},{};", inst, lhs, rhs);
186} 192}
187 193
188void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 194void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
189 [[maybe_unused]] std::string_view rhs) { 195 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
190 throw NotImplementedException("GLASM instruction"); 196 ctx.Add("SEQ {},{},{};", inst, lhs, rhs);
191} 197}
192 198
193void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 199void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
200 [[maybe_unused]] std::string_view lhs,
194 [[maybe_unused]] std::string_view rhs) { 201 [[maybe_unused]] std::string_view rhs) {
195 throw NotImplementedException("GLASM instruction"); 202 ctx.Add("SLE.S {},{},{};", inst, lhs, rhs);
196} 203}
197 204
198void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 205void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
206 [[maybe_unused]] std::string_view lhs,
199 [[maybe_unused]] std::string_view rhs) { 207 [[maybe_unused]] std::string_view rhs) {
200 throw NotImplementedException("GLASM instruction"); 208 ctx.Add("SLE.U {},{},{};", inst, lhs, rhs);
201} 209}
202 210
203void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 211void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
212 [[maybe_unused]] std::string_view lhs,
204 [[maybe_unused]] std::string_view rhs) { 213 [[maybe_unused]] std::string_view rhs) {
205 throw NotImplementedException("GLASM instruction"); 214 ctx.Add("SGT.S {},{},{};", inst, lhs, rhs);
206} 215}
207 216
208void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 217void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
218 [[maybe_unused]] std::string_view lhs,
209 [[maybe_unused]] std::string_view rhs) { 219 [[maybe_unused]] std::string_view rhs) {
210 throw NotImplementedException("GLASM instruction"); 220 ctx.Add("SGT.U {},{},{};", inst, lhs, rhs);
211} 221}
212 222
213void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 223void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
214 [[maybe_unused]] std::string_view rhs) { 224 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
215 throw NotImplementedException("GLASM instruction"); 225 throw NotImplementedException("GLASM instruction");
216} 226}
217 227
218void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 228void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
229 [[maybe_unused]] std::string_view lhs,
219 [[maybe_unused]] std::string_view rhs) { 230 [[maybe_unused]] std::string_view rhs) {
220 throw NotImplementedException("GLASM instruction"); 231 ctx.Add("SGE.S {},{},{};", inst, lhs, rhs);
221} 232}
222 233
223void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, 234void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
235 [[maybe_unused]] std::string_view lhs,
224 [[maybe_unused]] std::string_view rhs) { 236 [[maybe_unused]] std::string_view rhs) {
225 throw NotImplementedException("GLASM instruction"); 237 ctx.Add("SGE.U {},{},{};", inst, lhs, rhs);
226} 238}
227 239
228} // namespace Shader::Backend::GLASM 240} // namespace Shader::Backend::GLASM