ptx_parser/unparser/instruction/
sub.rs1#![allow(unused)]
24
25use crate::lexer::PtxToken;
26use crate::unparser::{PtxUnparser, common::*};
27
28pub mod section_0 {
29 use super::*;
30 use crate::r#type::instruction::sub::section_0::*;
31
32 impl PtxUnparser for SubType {
33 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
34 self.unparse_tokens_mode(tokens, false);
35 }
36 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
37 push_opcode(tokens, "sub");
38 match &self.type_ {
39 Type::U16 => {
40 push_directive(tokens, "u16");
41 }
42 Type::U32 => {
43 push_directive(tokens, "u32");
44 }
45 Type::U64 => {
46 push_directive(tokens, "u64");
47 }
48 Type::S16 => {
49 push_directive(tokens, "s16");
50 }
51 Type::S32 => {
52 push_directive(tokens, "s32");
53 }
54 Type::S64 => {
55 push_directive(tokens, "s64");
56 }
57 }
58 if spaced {
59 tokens.push(PtxToken::Space);
60 }
61 self.d.unparse_tokens_mode(tokens, spaced);
62 tokens.push(PtxToken::Comma);
63 if spaced {
64 tokens.push(PtxToken::Space);
65 }
66 self.a.unparse_tokens_mode(tokens, spaced);
67 tokens.push(PtxToken::Comma);
68 if spaced {
69 tokens.push(PtxToken::Space);
70 }
71 self.b.unparse_tokens_mode(tokens, spaced);
72 tokens.push(PtxToken::Semicolon);
73 if spaced {
74 tokens.push(PtxToken::Newline);
75 }
76 }
77 }
78
79 impl PtxUnparser for SubSatS32 {
80 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
81 self.unparse_tokens_mode(tokens, false);
82 }
83 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
84 push_opcode(tokens, "sub");
85 if self.sat {
86 push_directive(tokens, "sat");
87 }
88 push_directive(tokens, "s32");
89 if spaced {
90 tokens.push(PtxToken::Space);
91 }
92 self.d.unparse_tokens_mode(tokens, spaced);
93 tokens.push(PtxToken::Comma);
94 if spaced {
95 tokens.push(PtxToken::Space);
96 }
97 self.a.unparse_tokens_mode(tokens, spaced);
98 tokens.push(PtxToken::Comma);
99 if spaced {
100 tokens.push(PtxToken::Space);
101 }
102 self.b.unparse_tokens_mode(tokens, spaced);
103 tokens.push(PtxToken::Semicolon);
104 if spaced {
105 tokens.push(PtxToken::Newline);
106 }
107 }
108 }
109}
110
111pub mod section_1 {
112 use super::*;
113 use crate::r#type::instruction::sub::section_1::*;
114
115 impl PtxUnparser for SubRndFtzSatF32 {
116 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
117 self.unparse_tokens_mode(tokens, false);
118 }
119 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
120 push_opcode(tokens, "sub");
121 if let Some(rnd_0) = self.rnd.as_ref() {
122 match rnd_0 {
123 Rnd::Rn => {
124 push_directive(tokens, "rn");
125 }
126 Rnd::Rz => {
127 push_directive(tokens, "rz");
128 }
129 Rnd::Rm => {
130 push_directive(tokens, "rm");
131 }
132 Rnd::Rp => {
133 push_directive(tokens, "rp");
134 }
135 }
136 }
137 if self.ftz {
138 push_directive(tokens, "ftz");
139 }
140 if self.sat {
141 push_directive(tokens, "sat");
142 }
143 push_directive(tokens, "f32");
144 if spaced {
145 tokens.push(PtxToken::Space);
146 }
147 self.d.unparse_tokens_mode(tokens, spaced);
148 tokens.push(PtxToken::Comma);
149 if spaced {
150 tokens.push(PtxToken::Space);
151 }
152 self.a.unparse_tokens_mode(tokens, spaced);
153 tokens.push(PtxToken::Comma);
154 if spaced {
155 tokens.push(PtxToken::Space);
156 }
157 self.b.unparse_tokens_mode(tokens, spaced);
158 tokens.push(PtxToken::Semicolon);
159 if spaced {
160 tokens.push(PtxToken::Newline);
161 }
162 }
163 }
164
165 impl PtxUnparser for SubRndFtzF32x2 {
166 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
167 self.unparse_tokens_mode(tokens, false);
168 }
169 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
170 push_opcode(tokens, "sub");
171 if let Some(rnd_1) = self.rnd.as_ref() {
172 match rnd_1 {
173 Rnd::Rn => {
174 push_directive(tokens, "rn");
175 }
176 Rnd::Rz => {
177 push_directive(tokens, "rz");
178 }
179 Rnd::Rm => {
180 push_directive(tokens, "rm");
181 }
182 Rnd::Rp => {
183 push_directive(tokens, "rp");
184 }
185 }
186 }
187 if self.ftz {
188 push_directive(tokens, "ftz");
189 }
190 push_directive(tokens, "f32x2");
191 if spaced {
192 tokens.push(PtxToken::Space);
193 }
194 self.d.unparse_tokens_mode(tokens, spaced);
195 tokens.push(PtxToken::Comma);
196 if spaced {
197 tokens.push(PtxToken::Space);
198 }
199 self.a.unparse_tokens_mode(tokens, spaced);
200 tokens.push(PtxToken::Comma);
201 if spaced {
202 tokens.push(PtxToken::Space);
203 }
204 self.b.unparse_tokens_mode(tokens, spaced);
205 tokens.push(PtxToken::Semicolon);
206 if spaced {
207 tokens.push(PtxToken::Newline);
208 }
209 }
210 }
211
212 impl PtxUnparser for SubRndF64 {
213 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
214 self.unparse_tokens_mode(tokens, false);
215 }
216 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
217 push_opcode(tokens, "sub");
218 if let Some(rnd_2) = self.rnd.as_ref() {
219 match rnd_2 {
220 Rnd::Rn => {
221 push_directive(tokens, "rn");
222 }
223 Rnd::Rz => {
224 push_directive(tokens, "rz");
225 }
226 Rnd::Rm => {
227 push_directive(tokens, "rm");
228 }
229 Rnd::Rp => {
230 push_directive(tokens, "rp");
231 }
232 }
233 }
234 push_directive(tokens, "f64");
235 if spaced {
236 tokens.push(PtxToken::Space);
237 }
238 self.d.unparse_tokens_mode(tokens, spaced);
239 tokens.push(PtxToken::Comma);
240 if spaced {
241 tokens.push(PtxToken::Space);
242 }
243 self.a.unparse_tokens_mode(tokens, spaced);
244 tokens.push(PtxToken::Comma);
245 if spaced {
246 tokens.push(PtxToken::Space);
247 }
248 self.b.unparse_tokens_mode(tokens, spaced);
249 tokens.push(PtxToken::Semicolon);
250 if spaced {
251 tokens.push(PtxToken::Newline);
252 }
253 }
254 }
255}
256
257pub mod section_2 {
258 use super::*;
259 use crate::r#type::instruction::sub::section_2::*;
260
261 impl PtxUnparser for SubRndFtzSatF16 {
262 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
263 self.unparse_tokens_mode(tokens, false);
264 }
265 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
266 push_opcode(tokens, "sub");
267 if let Some(rnd_3) = self.rnd.as_ref() {
268 match rnd_3 {
269 Rnd::Rn => {
270 push_directive(tokens, "rn");
271 }
272 }
273 }
274 if self.ftz {
275 push_directive(tokens, "ftz");
276 }
277 if self.sat {
278 push_directive(tokens, "sat");
279 }
280 push_directive(tokens, "f16");
281 if spaced {
282 tokens.push(PtxToken::Space);
283 }
284 self.d.unparse_tokens_mode(tokens, spaced);
285 tokens.push(PtxToken::Comma);
286 if spaced {
287 tokens.push(PtxToken::Space);
288 }
289 self.a.unparse_tokens_mode(tokens, spaced);
290 tokens.push(PtxToken::Comma);
291 if spaced {
292 tokens.push(PtxToken::Space);
293 }
294 self.b.unparse_tokens_mode(tokens, spaced);
295 tokens.push(PtxToken::Semicolon);
296 if spaced {
297 tokens.push(PtxToken::Newline);
298 }
299 }
300 }
301
302 impl PtxUnparser for SubRndFtzSatF16x2 {
303 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
304 self.unparse_tokens_mode(tokens, false);
305 }
306 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
307 push_opcode(tokens, "sub");
308 if let Some(rnd_4) = self.rnd.as_ref() {
309 match rnd_4 {
310 Rnd::Rn => {
311 push_directive(tokens, "rn");
312 }
313 }
314 }
315 if self.ftz {
316 push_directive(tokens, "ftz");
317 }
318 if self.sat {
319 push_directive(tokens, "sat");
320 }
321 push_directive(tokens, "f16x2");
322 if spaced {
323 tokens.push(PtxToken::Space);
324 }
325 self.d.unparse_tokens_mode(tokens, spaced);
326 tokens.push(PtxToken::Comma);
327 if spaced {
328 tokens.push(PtxToken::Space);
329 }
330 self.a.unparse_tokens_mode(tokens, spaced);
331 tokens.push(PtxToken::Comma);
332 if spaced {
333 tokens.push(PtxToken::Space);
334 }
335 self.b.unparse_tokens_mode(tokens, spaced);
336 tokens.push(PtxToken::Semicolon);
337 if spaced {
338 tokens.push(PtxToken::Newline);
339 }
340 }
341 }
342
343 impl PtxUnparser for SubRndBf16 {
344 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
345 self.unparse_tokens_mode(tokens, false);
346 }
347 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
348 push_opcode(tokens, "sub");
349 if let Some(rnd_5) = self.rnd.as_ref() {
350 match rnd_5 {
351 Rnd::Rn => {
352 push_directive(tokens, "rn");
353 }
354 }
355 }
356 push_directive(tokens, "bf16");
357 if spaced {
358 tokens.push(PtxToken::Space);
359 }
360 self.d.unparse_tokens_mode(tokens, spaced);
361 tokens.push(PtxToken::Comma);
362 if spaced {
363 tokens.push(PtxToken::Space);
364 }
365 self.a.unparse_tokens_mode(tokens, spaced);
366 tokens.push(PtxToken::Comma);
367 if spaced {
368 tokens.push(PtxToken::Space);
369 }
370 self.b.unparse_tokens_mode(tokens, spaced);
371 tokens.push(PtxToken::Semicolon);
372 if spaced {
373 tokens.push(PtxToken::Newline);
374 }
375 }
376 }
377
378 impl PtxUnparser for SubRndBf16x2 {
379 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
380 self.unparse_tokens_mode(tokens, false);
381 }
382 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
383 push_opcode(tokens, "sub");
384 if let Some(rnd_6) = self.rnd.as_ref() {
385 match rnd_6 {
386 Rnd::Rn => {
387 push_directive(tokens, "rn");
388 }
389 }
390 }
391 push_directive(tokens, "bf16x2");
392 if spaced {
393 tokens.push(PtxToken::Space);
394 }
395 self.d.unparse_tokens_mode(tokens, spaced);
396 tokens.push(PtxToken::Comma);
397 if spaced {
398 tokens.push(PtxToken::Space);
399 }
400 self.a.unparse_tokens_mode(tokens, spaced);
401 tokens.push(PtxToken::Comma);
402 if spaced {
403 tokens.push(PtxToken::Space);
404 }
405 self.b.unparse_tokens_mode(tokens, spaced);
406 tokens.push(PtxToken::Semicolon);
407 if spaced {
408 tokens.push(PtxToken::Newline);
409 }
410 }
411 }
412}
413
414pub mod section_3 {
415 use super::*;
416 use crate::r#type::instruction::sub::section_3::*;
417
418 impl PtxUnparser for SubRndSatF32Atype {
419 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
420 self.unparse_tokens_mode(tokens, false);
421 }
422 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
423 push_opcode(tokens, "sub");
424 if let Some(rnd_7) = self.rnd.as_ref() {
425 match rnd_7 {
426 Rnd::Rn => {
427 push_directive(tokens, "rn");
428 }
429 Rnd::Rz => {
430 push_directive(tokens, "rz");
431 }
432 Rnd::Rm => {
433 push_directive(tokens, "rm");
434 }
435 Rnd::Rp => {
436 push_directive(tokens, "rp");
437 }
438 }
439 }
440 if self.sat {
441 push_directive(tokens, "sat");
442 }
443 push_directive(tokens, "f32");
444 match &self.atype {
445 Atype::Bf16 => {
446 push_directive(tokens, "bf16");
447 }
448 Atype::F16 => {
449 push_directive(tokens, "f16");
450 }
451 }
452 if spaced {
453 tokens.push(PtxToken::Space);
454 }
455 self.d.unparse_tokens_mode(tokens, spaced);
456 tokens.push(PtxToken::Comma);
457 if spaced {
458 tokens.push(PtxToken::Space);
459 }
460 self.a.unparse_tokens_mode(tokens, spaced);
461 tokens.push(PtxToken::Comma);
462 if spaced {
463 tokens.push(PtxToken::Space);
464 }
465 self.c.unparse_tokens_mode(tokens, spaced);
466 tokens.push(PtxToken::Semicolon);
467 if spaced {
468 tokens.push(PtxToken::Newline);
469 }
470 }
471 }
472}