ptx_parser/unparser/instruction/st.rs
1//! Original PTX specification:
2//!
3//! st{.weak}{.ss}{.cop}{.level::cache_hint}{.vec}.type [a], b{, cache-policy};
4//! st{.weak}{.ss}{.level1::eviction_priority}{.level2::eviction_priority}{.level::cache_hint}{.vec}.type [a], b{, cache-policy};
5//! st.volatile{.ss}{.vec}.type [a], b;
6//! st.relaxed.scope{.ss}{.level1::eviction_priority}{.level2::eviction_priority}{.level::cache_hint}{.vec}.type [a], b{, cache-policy};
7//! st.release.scope{.ss}{.level1::eviction_priority}{.level2::eviction_priority}{.level::cache_hint}{.vec}.type [a], b{, cache-policy};
8//! st.mmio.relaxed.sys{.global}.type [a], b;
9//! .ss = { .global, .local, .param, .param::func, .shared, .shared::cta, .shared::cluster};
10//! .level1::eviction_priority = { .L1::evict_normal, .L1::evict_unchanged,
11//! .L1::evict_first, .L1::evict_last, .L1::no_allocate };
12//! .level2::eviction_priority = { .L2::evict_normal, .L2::evict_first, .L2::evict_last };
13//! .level::cache_hint = { .L2::cache_hint };
14//! .cop = { .wb, .cg, .cs, .wt };
15//! .sem = { .relaxed, .release };
16//! .scope = { .cta, .cluster, .gpu, .sys };
17//! .vec = { .v2, .v4, .v8 };
18//! .type = { .b8, .b16, .b32, .b64, .b128,
19//! .u8, .u16, .u32, .u64,
20//! .s8, .s16, .s32, .s64,
21//! .f32, .f64 };
22
23#![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::st::section_0::*;
31
32 impl PtxUnparser for StWeakSsCopLevelCacheHintVecType {
33 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
34 push_opcode(tokens, "st");
35 if self.weak {
36 push_directive(tokens, "weak");
37 }
38 if let Some(ss_0) = self.ss.as_ref() {
39 match ss_0 {
40 Ss::SharedCluster => {
41 push_directive(tokens, "shared::cluster");
42 }
43 Ss::ParamFunc => {
44 push_directive(tokens, "param::func");
45 }
46 Ss::SharedCta => {
47 push_directive(tokens, "shared::cta");
48 }
49 Ss::Global => {
50 push_directive(tokens, "global");
51 }
52 Ss::Shared => {
53 push_directive(tokens, "shared");
54 }
55 Ss::Local => {
56 push_directive(tokens, "local");
57 }
58 Ss::Param => {
59 push_directive(tokens, "param");
60 }
61 }
62 }
63 if let Some(cop_1) = self.cop.as_ref() {
64 match cop_1 {
65 Cop::Wb => {
66 push_directive(tokens, "wb");
67 }
68 Cop::Cg => {
69 push_directive(tokens, "cg");
70 }
71 Cop::Cs => {
72 push_directive(tokens, "cs");
73 }
74 Cop::Wt => {
75 push_directive(tokens, "wt");
76 }
77 }
78 }
79 if let Some(level_cache_hint_2) = self.level_cache_hint.as_ref() {
80 match level_cache_hint_2 {
81 LevelCacheHint::L2CacheHint => {
82 push_directive(tokens, "L2::cache_hint");
83 }
84 }
85 }
86 if let Some(vec_3) = self.vec.as_ref() {
87 match vec_3 {
88 Vec::V2 => {
89 push_directive(tokens, "v2");
90 }
91 Vec::V4 => {
92 push_directive(tokens, "v4");
93 }
94 Vec::V8 => {
95 push_directive(tokens, "v8");
96 }
97 }
98 }
99 match &self.type_ {
100 Type::B128 => {
101 push_directive(tokens, "b128");
102 }
103 Type::B16 => {
104 push_directive(tokens, "b16");
105 }
106 Type::B32 => {
107 push_directive(tokens, "b32");
108 }
109 Type::B64 => {
110 push_directive(tokens, "b64");
111 }
112 Type::U16 => {
113 push_directive(tokens, "u16");
114 }
115 Type::U32 => {
116 push_directive(tokens, "u32");
117 }
118 Type::U64 => {
119 push_directive(tokens, "u64");
120 }
121 Type::S16 => {
122 push_directive(tokens, "s16");
123 }
124 Type::S32 => {
125 push_directive(tokens, "s32");
126 }
127 Type::S64 => {
128 push_directive(tokens, "s64");
129 }
130 Type::F32 => {
131 push_directive(tokens, "f32");
132 }
133 Type::F64 => {
134 push_directive(tokens, "f64");
135 }
136 Type::B8 => {
137 push_directive(tokens, "b8");
138 }
139 Type::U8 => {
140 push_directive(tokens, "u8");
141 }
142 Type::S8 => {
143 push_directive(tokens, "s8");
144 }
145 }
146 self.a.unparse_tokens(tokens);
147 tokens.push(PtxToken::Comma);
148 self.b.unparse_tokens(tokens);
149 if self.cache_policy.is_some() { tokens.push(PtxToken::Comma); }
150 if let Some(opt_4) = self.cache_policy.as_ref() {
151 opt_4.unparse_tokens(tokens);
152 }
153 tokens.push(PtxToken::Semicolon);
154 }
155 }
156
157 impl PtxUnparser for StWeakSsLevel1EvictionPriorityLevel2EvictionPriorityLevelCacheHintVecType {
158 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
159 push_opcode(tokens, "st");
160 if self.weak {
161 push_directive(tokens, "weak");
162 }
163 if let Some(ss_5) = self.ss.as_ref() {
164 match ss_5 {
165 Ss::SharedCluster => {
166 push_directive(tokens, "shared::cluster");
167 }
168 Ss::ParamFunc => {
169 push_directive(tokens, "param::func");
170 }
171 Ss::SharedCta => {
172 push_directive(tokens, "shared::cta");
173 }
174 Ss::Global => {
175 push_directive(tokens, "global");
176 }
177 Ss::Shared => {
178 push_directive(tokens, "shared");
179 }
180 Ss::Local => {
181 push_directive(tokens, "local");
182 }
183 Ss::Param => {
184 push_directive(tokens, "param");
185 }
186 }
187 }
188 if let Some(level1_eviction_priority_6) = self.level1_eviction_priority.as_ref() {
189 match level1_eviction_priority_6 {
190 Level1EvictionPriority::L1EvictUnchanged => {
191 push_directive(tokens, "L1::evict_unchanged");
192 }
193 Level1EvictionPriority::L1EvictNormal => {
194 push_directive(tokens, "L1::evict_normal");
195 }
196 Level1EvictionPriority::L1EvictFirst => {
197 push_directive(tokens, "L1::evict_first");
198 }
199 Level1EvictionPriority::L1NoAllocate => {
200 push_directive(tokens, "L1::no_allocate");
201 }
202 Level1EvictionPriority::L1EvictLast => {
203 push_directive(tokens, "L1::evict_last");
204 }
205 }
206 }
207 if let Some(level2_eviction_priority_7) = self.level2_eviction_priority.as_ref() {
208 match level2_eviction_priority_7 {
209 Level2EvictionPriority::L2EvictNormal => {
210 push_directive(tokens, "L2::evict_normal");
211 }
212 Level2EvictionPriority::L2EvictFirst => {
213 push_directive(tokens, "L2::evict_first");
214 }
215 Level2EvictionPriority::L2EvictLast => {
216 push_directive(tokens, "L2::evict_last");
217 }
218 }
219 }
220 if let Some(level_cache_hint_8) = self.level_cache_hint.as_ref() {
221 match level_cache_hint_8 {
222 LevelCacheHint::L2CacheHint => {
223 push_directive(tokens, "L2::cache_hint");
224 }
225 }
226 }
227 if let Some(vec_9) = self.vec.as_ref() {
228 match vec_9 {
229 Vec::V2 => {
230 push_directive(tokens, "v2");
231 }
232 Vec::V4 => {
233 push_directive(tokens, "v4");
234 }
235 Vec::V8 => {
236 push_directive(tokens, "v8");
237 }
238 }
239 }
240 match &self.type_ {
241 Type::B128 => {
242 push_directive(tokens, "b128");
243 }
244 Type::B16 => {
245 push_directive(tokens, "b16");
246 }
247 Type::B32 => {
248 push_directive(tokens, "b32");
249 }
250 Type::B64 => {
251 push_directive(tokens, "b64");
252 }
253 Type::U16 => {
254 push_directive(tokens, "u16");
255 }
256 Type::U32 => {
257 push_directive(tokens, "u32");
258 }
259 Type::U64 => {
260 push_directive(tokens, "u64");
261 }
262 Type::S16 => {
263 push_directive(tokens, "s16");
264 }
265 Type::S32 => {
266 push_directive(tokens, "s32");
267 }
268 Type::S64 => {
269 push_directive(tokens, "s64");
270 }
271 Type::F32 => {
272 push_directive(tokens, "f32");
273 }
274 Type::F64 => {
275 push_directive(tokens, "f64");
276 }
277 Type::B8 => {
278 push_directive(tokens, "b8");
279 }
280 Type::U8 => {
281 push_directive(tokens, "u8");
282 }
283 Type::S8 => {
284 push_directive(tokens, "s8");
285 }
286 }
287 self.a.unparse_tokens(tokens);
288 tokens.push(PtxToken::Comma);
289 self.b.unparse_tokens(tokens);
290 if self.cache_policy.is_some() { tokens.push(PtxToken::Comma); }
291 if let Some(opt_10) = self.cache_policy.as_ref() {
292 opt_10.unparse_tokens(tokens);
293 }
294 tokens.push(PtxToken::Semicolon);
295 }
296 }
297
298 impl PtxUnparser for StVolatileSsVecType {
299 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
300 push_opcode(tokens, "st");
301 push_directive(tokens, "volatile");
302 if let Some(ss_11) = self.ss.as_ref() {
303 match ss_11 {
304 Ss::SharedCluster => {
305 push_directive(tokens, "shared::cluster");
306 }
307 Ss::ParamFunc => {
308 push_directive(tokens, "param::func");
309 }
310 Ss::SharedCta => {
311 push_directive(tokens, "shared::cta");
312 }
313 Ss::Global => {
314 push_directive(tokens, "global");
315 }
316 Ss::Shared => {
317 push_directive(tokens, "shared");
318 }
319 Ss::Local => {
320 push_directive(tokens, "local");
321 }
322 Ss::Param => {
323 push_directive(tokens, "param");
324 }
325 }
326 }
327 if let Some(vec_12) = self.vec.as_ref() {
328 match vec_12 {
329 Vec::V2 => {
330 push_directive(tokens, "v2");
331 }
332 Vec::V4 => {
333 push_directive(tokens, "v4");
334 }
335 Vec::V8 => {
336 push_directive(tokens, "v8");
337 }
338 }
339 }
340 match &self.type_ {
341 Type::B128 => {
342 push_directive(tokens, "b128");
343 }
344 Type::B16 => {
345 push_directive(tokens, "b16");
346 }
347 Type::B32 => {
348 push_directive(tokens, "b32");
349 }
350 Type::B64 => {
351 push_directive(tokens, "b64");
352 }
353 Type::U16 => {
354 push_directive(tokens, "u16");
355 }
356 Type::U32 => {
357 push_directive(tokens, "u32");
358 }
359 Type::U64 => {
360 push_directive(tokens, "u64");
361 }
362 Type::S16 => {
363 push_directive(tokens, "s16");
364 }
365 Type::S32 => {
366 push_directive(tokens, "s32");
367 }
368 Type::S64 => {
369 push_directive(tokens, "s64");
370 }
371 Type::F32 => {
372 push_directive(tokens, "f32");
373 }
374 Type::F64 => {
375 push_directive(tokens, "f64");
376 }
377 Type::B8 => {
378 push_directive(tokens, "b8");
379 }
380 Type::U8 => {
381 push_directive(tokens, "u8");
382 }
383 Type::S8 => {
384 push_directive(tokens, "s8");
385 }
386 }
387 self.a.unparse_tokens(tokens);
388 tokens.push(PtxToken::Comma);
389 self.b.unparse_tokens(tokens);
390 tokens.push(PtxToken::Semicolon);
391 }
392 }
393
394 impl PtxUnparser for StRelaxedScopeSsLevel1EvictionPriorityLevel2EvictionPriorityLevelCacheHintVecType {
395 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
396 push_opcode(tokens, "st");
397 push_directive(tokens, "relaxed");
398 match &self.scope {
399 Scope::Cluster => {
400 push_directive(tokens, "cluster");
401 }
402 Scope::Cta => {
403 push_directive(tokens, "cta");
404 }
405 Scope::Gpu => {
406 push_directive(tokens, "gpu");
407 }
408 Scope::Sys => {
409 push_directive(tokens, "sys");
410 }
411 }
412 if let Some(ss_13) = self.ss.as_ref() {
413 match ss_13 {
414 Ss::SharedCluster => {
415 push_directive(tokens, "shared::cluster");
416 }
417 Ss::ParamFunc => {
418 push_directive(tokens, "param::func");
419 }
420 Ss::SharedCta => {
421 push_directive(tokens, "shared::cta");
422 }
423 Ss::Global => {
424 push_directive(tokens, "global");
425 }
426 Ss::Shared => {
427 push_directive(tokens, "shared");
428 }
429 Ss::Local => {
430 push_directive(tokens, "local");
431 }
432 Ss::Param => {
433 push_directive(tokens, "param");
434 }
435 }
436 }
437 if let Some(level1_eviction_priority_14) = self.level1_eviction_priority.as_ref() {
438 match level1_eviction_priority_14 {
439 Level1EvictionPriority::L1EvictUnchanged => {
440 push_directive(tokens, "L1::evict_unchanged");
441 }
442 Level1EvictionPriority::L1EvictNormal => {
443 push_directive(tokens, "L1::evict_normal");
444 }
445 Level1EvictionPriority::L1EvictFirst => {
446 push_directive(tokens, "L1::evict_first");
447 }
448 Level1EvictionPriority::L1NoAllocate => {
449 push_directive(tokens, "L1::no_allocate");
450 }
451 Level1EvictionPriority::L1EvictLast => {
452 push_directive(tokens, "L1::evict_last");
453 }
454 }
455 }
456 if let Some(level2_eviction_priority_15) = self.level2_eviction_priority.as_ref() {
457 match level2_eviction_priority_15 {
458 Level2EvictionPriority::L2EvictNormal => {
459 push_directive(tokens, "L2::evict_normal");
460 }
461 Level2EvictionPriority::L2EvictFirst => {
462 push_directive(tokens, "L2::evict_first");
463 }
464 Level2EvictionPriority::L2EvictLast => {
465 push_directive(tokens, "L2::evict_last");
466 }
467 }
468 }
469 if let Some(level_cache_hint_16) = self.level_cache_hint.as_ref() {
470 match level_cache_hint_16 {
471 LevelCacheHint::L2CacheHint => {
472 push_directive(tokens, "L2::cache_hint");
473 }
474 }
475 }
476 if let Some(vec_17) = self.vec.as_ref() {
477 match vec_17 {
478 Vec::V2 => {
479 push_directive(tokens, "v2");
480 }
481 Vec::V4 => {
482 push_directive(tokens, "v4");
483 }
484 Vec::V8 => {
485 push_directive(tokens, "v8");
486 }
487 }
488 }
489 match &self.type_ {
490 Type::B128 => {
491 push_directive(tokens, "b128");
492 }
493 Type::B16 => {
494 push_directive(tokens, "b16");
495 }
496 Type::B32 => {
497 push_directive(tokens, "b32");
498 }
499 Type::B64 => {
500 push_directive(tokens, "b64");
501 }
502 Type::U16 => {
503 push_directive(tokens, "u16");
504 }
505 Type::U32 => {
506 push_directive(tokens, "u32");
507 }
508 Type::U64 => {
509 push_directive(tokens, "u64");
510 }
511 Type::S16 => {
512 push_directive(tokens, "s16");
513 }
514 Type::S32 => {
515 push_directive(tokens, "s32");
516 }
517 Type::S64 => {
518 push_directive(tokens, "s64");
519 }
520 Type::F32 => {
521 push_directive(tokens, "f32");
522 }
523 Type::F64 => {
524 push_directive(tokens, "f64");
525 }
526 Type::B8 => {
527 push_directive(tokens, "b8");
528 }
529 Type::U8 => {
530 push_directive(tokens, "u8");
531 }
532 Type::S8 => {
533 push_directive(tokens, "s8");
534 }
535 }
536 self.a.unparse_tokens(tokens);
537 tokens.push(PtxToken::Comma);
538 self.b.unparse_tokens(tokens);
539 if self.cache_policy.is_some() { tokens.push(PtxToken::Comma); }
540 if let Some(opt_18) = self.cache_policy.as_ref() {
541 opt_18.unparse_tokens(tokens);
542 }
543 tokens.push(PtxToken::Semicolon);
544 }
545 }
546
547 impl PtxUnparser for StReleaseScopeSsLevel1EvictionPriorityLevel2EvictionPriorityLevelCacheHintVecType {
548 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
549 push_opcode(tokens, "st");
550 push_directive(tokens, "release");
551 match &self.scope {
552 Scope::Cluster => {
553 push_directive(tokens, "cluster");
554 }
555 Scope::Cta => {
556 push_directive(tokens, "cta");
557 }
558 Scope::Gpu => {
559 push_directive(tokens, "gpu");
560 }
561 Scope::Sys => {
562 push_directive(tokens, "sys");
563 }
564 }
565 if let Some(ss_19) = self.ss.as_ref() {
566 match ss_19 {
567 Ss::SharedCluster => {
568 push_directive(tokens, "shared::cluster");
569 }
570 Ss::ParamFunc => {
571 push_directive(tokens, "param::func");
572 }
573 Ss::SharedCta => {
574 push_directive(tokens, "shared::cta");
575 }
576 Ss::Global => {
577 push_directive(tokens, "global");
578 }
579 Ss::Shared => {
580 push_directive(tokens, "shared");
581 }
582 Ss::Local => {
583 push_directive(tokens, "local");
584 }
585 Ss::Param => {
586 push_directive(tokens, "param");
587 }
588 }
589 }
590 if let Some(level1_eviction_priority_20) = self.level1_eviction_priority.as_ref() {
591 match level1_eviction_priority_20 {
592 Level1EvictionPriority::L1EvictUnchanged => {
593 push_directive(tokens, "L1::evict_unchanged");
594 }
595 Level1EvictionPriority::L1EvictNormal => {
596 push_directive(tokens, "L1::evict_normal");
597 }
598 Level1EvictionPriority::L1EvictFirst => {
599 push_directive(tokens, "L1::evict_first");
600 }
601 Level1EvictionPriority::L1NoAllocate => {
602 push_directive(tokens, "L1::no_allocate");
603 }
604 Level1EvictionPriority::L1EvictLast => {
605 push_directive(tokens, "L1::evict_last");
606 }
607 }
608 }
609 if let Some(level2_eviction_priority_21) = self.level2_eviction_priority.as_ref() {
610 match level2_eviction_priority_21 {
611 Level2EvictionPriority::L2EvictNormal => {
612 push_directive(tokens, "L2::evict_normal");
613 }
614 Level2EvictionPriority::L2EvictFirst => {
615 push_directive(tokens, "L2::evict_first");
616 }
617 Level2EvictionPriority::L2EvictLast => {
618 push_directive(tokens, "L2::evict_last");
619 }
620 }
621 }
622 if let Some(level_cache_hint_22) = self.level_cache_hint.as_ref() {
623 match level_cache_hint_22 {
624 LevelCacheHint::L2CacheHint => {
625 push_directive(tokens, "L2::cache_hint");
626 }
627 }
628 }
629 if let Some(vec_23) = self.vec.as_ref() {
630 match vec_23 {
631 Vec::V2 => {
632 push_directive(tokens, "v2");
633 }
634 Vec::V4 => {
635 push_directive(tokens, "v4");
636 }
637 Vec::V8 => {
638 push_directive(tokens, "v8");
639 }
640 }
641 }
642 match &self.type_ {
643 Type::B128 => {
644 push_directive(tokens, "b128");
645 }
646 Type::B16 => {
647 push_directive(tokens, "b16");
648 }
649 Type::B32 => {
650 push_directive(tokens, "b32");
651 }
652 Type::B64 => {
653 push_directive(tokens, "b64");
654 }
655 Type::U16 => {
656 push_directive(tokens, "u16");
657 }
658 Type::U32 => {
659 push_directive(tokens, "u32");
660 }
661 Type::U64 => {
662 push_directive(tokens, "u64");
663 }
664 Type::S16 => {
665 push_directive(tokens, "s16");
666 }
667 Type::S32 => {
668 push_directive(tokens, "s32");
669 }
670 Type::S64 => {
671 push_directive(tokens, "s64");
672 }
673 Type::F32 => {
674 push_directive(tokens, "f32");
675 }
676 Type::F64 => {
677 push_directive(tokens, "f64");
678 }
679 Type::B8 => {
680 push_directive(tokens, "b8");
681 }
682 Type::U8 => {
683 push_directive(tokens, "u8");
684 }
685 Type::S8 => {
686 push_directive(tokens, "s8");
687 }
688 }
689 self.a.unparse_tokens(tokens);
690 tokens.push(PtxToken::Comma);
691 self.b.unparse_tokens(tokens);
692 if self.cache_policy.is_some() { tokens.push(PtxToken::Comma); }
693 if let Some(opt_24) = self.cache_policy.as_ref() {
694 opt_24.unparse_tokens(tokens);
695 }
696 tokens.push(PtxToken::Semicolon);
697 }
698 }
699
700 impl PtxUnparser for StMmioRelaxedSysGlobalType {
701 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
702 push_opcode(tokens, "st");
703 push_directive(tokens, "mmio");
704 push_directive(tokens, "relaxed");
705 push_directive(tokens, "sys");
706 if self.global {
707 push_directive(tokens, "global");
708 }
709 match &self.type_ {
710 Type::B128 => {
711 push_directive(tokens, "b128");
712 }
713 Type::B16 => {
714 push_directive(tokens, "b16");
715 }
716 Type::B32 => {
717 push_directive(tokens, "b32");
718 }
719 Type::B64 => {
720 push_directive(tokens, "b64");
721 }
722 Type::U16 => {
723 push_directive(tokens, "u16");
724 }
725 Type::U32 => {
726 push_directive(tokens, "u32");
727 }
728 Type::U64 => {
729 push_directive(tokens, "u64");
730 }
731 Type::S16 => {
732 push_directive(tokens, "s16");
733 }
734 Type::S32 => {
735 push_directive(tokens, "s32");
736 }
737 Type::S64 => {
738 push_directive(tokens, "s64");
739 }
740 Type::F32 => {
741 push_directive(tokens, "f32");
742 }
743 Type::F64 => {
744 push_directive(tokens, "f64");
745 }
746 Type::B8 => {
747 push_directive(tokens, "b8");
748 }
749 Type::U8 => {
750 push_directive(tokens, "u8");
751 }
752 Type::S8 => {
753 push_directive(tokens, "s8");
754 }
755 }
756 self.a.unparse_tokens(tokens);
757 tokens.push(PtxToken::Comma);
758 self.b.unparse_tokens(tokens);
759 tokens.push(PtxToken::Semicolon);
760 }
761 }
762
763}
764