Skip to main content

ptx_parser/unparser/instruction/
tcgen05_st.rs

1//! Original PTX specification:
2//!
3//! tcgen05.st.sync.aligned.shape1.num{.unpack}.b32    [taddr], r;
4//! tcgen05.st.sync.aligned.shape2.num{.unpack}.b32    [taddr], immHalfSplitoff, r;
5//! .shape1 = { .16x64b, .16x128b, .16x256b, .32x32b };
6//! .shape2 = { .16x32bx2 };
7//! .num    = { .x1, .x2, .x4, .x8, .x16, .x32, .x64, .x128 };
8//! .unpack = { .unpack::16b };
9
10#![allow(unused)]
11
12use crate::lexer::PtxToken;
13use crate::unparser::{PtxUnparser, common::*};
14
15pub mod section_0 {
16    use super::*;
17    use crate::r#type::instruction::tcgen05_st::section_0::*;
18
19    impl PtxUnparser for Tcgen05StSyncAlignedShape1NumUnpackB32 {
20        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
21            self.unparse_tokens_mode(tokens, false);
22        }
23        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
24            push_opcode(tokens, "tcgen05");
25            push_directive(tokens, "st");
26            push_directive(tokens, "sync");
27            push_directive(tokens, "aligned");
28            match &self.shape1 {
29                Shape1::_16x128b => {
30                    push_directive(tokens, "16x128b");
31                }
32                Shape1::_16x256b => {
33                    push_directive(tokens, "16x256b");
34                }
35                Shape1::_16x64b => {
36                    push_directive(tokens, "16x64b");
37                }
38                Shape1::_32x32b => {
39                    push_directive(tokens, "32x32b");
40                }
41            }
42            match &self.num {
43                Num::X128 => {
44                    push_directive(tokens, "x128");
45                }
46                Num::X16 => {
47                    push_directive(tokens, "x16");
48                }
49                Num::X32 => {
50                    push_directive(tokens, "x32");
51                }
52                Num::X64 => {
53                    push_directive(tokens, "x64");
54                }
55                Num::X1 => {
56                    push_directive(tokens, "x1");
57                }
58                Num::X2 => {
59                    push_directive(tokens, "x2");
60                }
61                Num::X4 => {
62                    push_directive(tokens, "x4");
63                }
64                Num::X8 => {
65                    push_directive(tokens, "x8");
66                }
67            }
68            if let Some(unpack_0) = self.unpack.as_ref() {
69                match unpack_0 {
70                    Unpack::Unpack16b => {
71                        push_directive(tokens, "unpack::16b");
72                    }
73                }
74            }
75            push_directive(tokens, "b32");
76            if spaced {
77                tokens.push(PtxToken::Space);
78            }
79            self.taddr.unparse_tokens_mode(tokens, spaced);
80            tokens.push(PtxToken::Comma);
81            if spaced {
82                tokens.push(PtxToken::Space);
83            }
84            self.r.unparse_tokens_mode(tokens, spaced);
85            tokens.push(PtxToken::Semicolon);
86            if spaced {
87                tokens.push(PtxToken::Newline);
88            }
89        }
90    }
91
92    impl PtxUnparser for Tcgen05StSyncAlignedShape2NumUnpackB32 {
93        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
94            self.unparse_tokens_mode(tokens, false);
95        }
96        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
97            push_opcode(tokens, "tcgen05");
98            push_directive(tokens, "st");
99            push_directive(tokens, "sync");
100            push_directive(tokens, "aligned");
101            match &self.shape2 {
102                Shape2::_16x32bx2 => {
103                    push_directive(tokens, "16x32bx2");
104                }
105            }
106            match &self.num {
107                Num::X128 => {
108                    push_directive(tokens, "x128");
109                }
110                Num::X16 => {
111                    push_directive(tokens, "x16");
112                }
113                Num::X32 => {
114                    push_directive(tokens, "x32");
115                }
116                Num::X64 => {
117                    push_directive(tokens, "x64");
118                }
119                Num::X1 => {
120                    push_directive(tokens, "x1");
121                }
122                Num::X2 => {
123                    push_directive(tokens, "x2");
124                }
125                Num::X4 => {
126                    push_directive(tokens, "x4");
127                }
128                Num::X8 => {
129                    push_directive(tokens, "x8");
130                }
131            }
132            if let Some(unpack_1) = self.unpack.as_ref() {
133                match unpack_1 {
134                    Unpack::Unpack16b => {
135                        push_directive(tokens, "unpack::16b");
136                    }
137                }
138            }
139            push_directive(tokens, "b32");
140            if spaced {
141                tokens.push(PtxToken::Space);
142            }
143            self.taddr.unparse_tokens_mode(tokens, spaced);
144            tokens.push(PtxToken::Comma);
145            if spaced {
146                tokens.push(PtxToken::Space);
147            }
148            self.immhalfsplitoff.unparse_tokens_mode(tokens, spaced);
149            tokens.push(PtxToken::Comma);
150            if spaced {
151                tokens.push(PtxToken::Space);
152            }
153            self.r.unparse_tokens_mode(tokens, spaced);
154            tokens.push(PtxToken::Semicolon);
155            if spaced {
156                tokens.push(PtxToken::Newline);
157            }
158        }
159    }
160}