ptx_parser/unparser/instruction/
add.rs1#![allow(unused)]
25
26use crate::lexer::PtxToken;
27use crate::unparser::{PtxUnparser, common::*};
28
29pub mod section_0 {
30 use super::*;
31 use crate::r#type::instruction::add::section_0::*;
32
33 impl PtxUnparser for AddType {
34 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
35 push_opcode(tokens, "add");
36 match &self.type_ {
37 Type::U16x2 => {
38 push_directive(tokens, "u16x2");
39 }
40 Type::S16x2 => {
41 push_directive(tokens, "s16x2");
42 }
43 Type::U16 => {
44 push_directive(tokens, "u16");
45 }
46 Type::U32 => {
47 push_directive(tokens, "u32");
48 }
49 Type::U64 => {
50 push_directive(tokens, "u64");
51 }
52 Type::S16 => {
53 push_directive(tokens, "s16");
54 }
55 Type::S32 => {
56 push_directive(tokens, "s32");
57 }
58 Type::S64 => {
59 push_directive(tokens, "s64");
60 }
61 }
62 self.d.unparse_tokens(tokens);
63 tokens.push(PtxToken::Comma);
64 self.a.unparse_tokens(tokens);
65 tokens.push(PtxToken::Comma);
66 self.b.unparse_tokens(tokens);
67 tokens.push(PtxToken::Semicolon);
68 }
69 }
70
71 impl PtxUnparser for AddSatS32 {
72 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
73 push_opcode(tokens, "add");
74 if self.sat {
75 push_directive(tokens, "sat");
76 }
77 push_directive(tokens, "s32");
78 self.d.unparse_tokens(tokens);
79 tokens.push(PtxToken::Comma);
80 self.a.unparse_tokens(tokens);
81 tokens.push(PtxToken::Comma);
82 self.b.unparse_tokens(tokens);
83 tokens.push(PtxToken::Semicolon);
84 }
85 }
86
87}
88
89pub mod section_1 {
90 use super::*;
91 use crate::r#type::instruction::add::section_1::*;
92
93 impl PtxUnparser for AddRndFtzSatF32 {
94 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
95 push_opcode(tokens, "add");
96 if let Some(rnd_0) = self.rnd.as_ref() {
97 match rnd_0 {
98 Rnd::Rn => {
99 push_directive(tokens, "rn");
100 }
101 Rnd::Rz => {
102 push_directive(tokens, "rz");
103 }
104 Rnd::Rm => {
105 push_directive(tokens, "rm");
106 }
107 Rnd::Rp => {
108 push_directive(tokens, "rp");
109 }
110 }
111 }
112 if self.ftz {
113 push_directive(tokens, "ftz");
114 }
115 if self.sat {
116 push_directive(tokens, "sat");
117 }
118 push_directive(tokens, "f32");
119 self.d.unparse_tokens(tokens);
120 tokens.push(PtxToken::Comma);
121 self.a.unparse_tokens(tokens);
122 tokens.push(PtxToken::Comma);
123 self.b.unparse_tokens(tokens);
124 tokens.push(PtxToken::Semicolon);
125 }
126 }
127
128 impl PtxUnparser for AddRndFtzF32x2 {
129 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
130 push_opcode(tokens, "add");
131 if let Some(rnd_1) = self.rnd.as_ref() {
132 match rnd_1 {
133 Rnd::Rn => {
134 push_directive(tokens, "rn");
135 }
136 Rnd::Rz => {
137 push_directive(tokens, "rz");
138 }
139 Rnd::Rm => {
140 push_directive(tokens, "rm");
141 }
142 Rnd::Rp => {
143 push_directive(tokens, "rp");
144 }
145 }
146 }
147 if self.ftz {
148 push_directive(tokens, "ftz");
149 }
150 push_directive(tokens, "f32x2");
151 self.d.unparse_tokens(tokens);
152 tokens.push(PtxToken::Comma);
153 self.a.unparse_tokens(tokens);
154 tokens.push(PtxToken::Comma);
155 self.b.unparse_tokens(tokens);
156 tokens.push(PtxToken::Semicolon);
157 }
158 }
159
160 impl PtxUnparser for AddRndF64 {
161 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
162 push_opcode(tokens, "add");
163 if let Some(rnd_2) = self.rnd.as_ref() {
164 match rnd_2 {
165 Rnd::Rn => {
166 push_directive(tokens, "rn");
167 }
168 Rnd::Rz => {
169 push_directive(tokens, "rz");
170 }
171 Rnd::Rm => {
172 push_directive(tokens, "rm");
173 }
174 Rnd::Rp => {
175 push_directive(tokens, "rp");
176 }
177 }
178 }
179 push_directive(tokens, "f64");
180 self.d.unparse_tokens(tokens);
181 tokens.push(PtxToken::Comma);
182 self.a.unparse_tokens(tokens);
183 tokens.push(PtxToken::Comma);
184 self.b.unparse_tokens(tokens);
185 tokens.push(PtxToken::Semicolon);
186 }
187 }
188
189}
190
191pub mod section_2 {
192 use super::*;
193 use crate::r#type::instruction::add::section_2::*;
194
195 impl PtxUnparser for AddRndFtzSatF16 {
196 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
197 push_opcode(tokens, "add");
198 if let Some(rnd_3) = self.rnd.as_ref() {
199 match rnd_3 {
200 Rnd::Rn => {
201 push_directive(tokens, "rn");
202 }
203 }
204 }
205 if self.ftz {
206 push_directive(tokens, "ftz");
207 }
208 if self.sat {
209 push_directive(tokens, "sat");
210 }
211 push_directive(tokens, "f16");
212 self.d.unparse_tokens(tokens);
213 tokens.push(PtxToken::Comma);
214 self.a.unparse_tokens(tokens);
215 tokens.push(PtxToken::Comma);
216 self.b.unparse_tokens(tokens);
217 tokens.push(PtxToken::Semicolon);
218 }
219 }
220
221 impl PtxUnparser for AddRndFtzSatF16x2 {
222 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
223 push_opcode(tokens, "add");
224 if let Some(rnd_4) = self.rnd.as_ref() {
225 match rnd_4 {
226 Rnd::Rn => {
227 push_directive(tokens, "rn");
228 }
229 }
230 }
231 if self.ftz {
232 push_directive(tokens, "ftz");
233 }
234 if self.sat {
235 push_directive(tokens, "sat");
236 }
237 push_directive(tokens, "f16x2");
238 self.d.unparse_tokens(tokens);
239 tokens.push(PtxToken::Comma);
240 self.a.unparse_tokens(tokens);
241 tokens.push(PtxToken::Comma);
242 self.b.unparse_tokens(tokens);
243 tokens.push(PtxToken::Semicolon);
244 }
245 }
246
247 impl PtxUnparser for AddRndBf16 {
248 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
249 push_opcode(tokens, "add");
250 if let Some(rnd_5) = self.rnd.as_ref() {
251 match rnd_5 {
252 Rnd::Rn => {
253 push_directive(tokens, "rn");
254 }
255 }
256 }
257 push_directive(tokens, "bf16");
258 self.d.unparse_tokens(tokens);
259 tokens.push(PtxToken::Comma);
260 self.a.unparse_tokens(tokens);
261 tokens.push(PtxToken::Comma);
262 self.b.unparse_tokens(tokens);
263 tokens.push(PtxToken::Semicolon);
264 }
265 }
266
267 impl PtxUnparser for AddRndBf16x2 {
268 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
269 push_opcode(tokens, "add");
270 if let Some(rnd_6) = self.rnd.as_ref() {
271 match rnd_6 {
272 Rnd::Rn => {
273 push_directive(tokens, "rn");
274 }
275 }
276 }
277 push_directive(tokens, "bf16x2");
278 self.d.unparse_tokens(tokens);
279 tokens.push(PtxToken::Comma);
280 self.a.unparse_tokens(tokens);
281 tokens.push(PtxToken::Comma);
282 self.b.unparse_tokens(tokens);
283 tokens.push(PtxToken::Semicolon);
284 }
285 }
286
287}
288
289pub mod section_3 {
290 use super::*;
291 use crate::r#type::instruction::add::section_3::*;
292
293 impl PtxUnparser for AddRndSatF32Atype {
294 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
295 push_opcode(tokens, "add");
296 if let Some(rnd_7) = self.rnd.as_ref() {
297 match rnd_7 {
298 Rnd::Rn => {
299 push_directive(tokens, "rn");
300 }
301 Rnd::Rz => {
302 push_directive(tokens, "rz");
303 }
304 Rnd::Rm => {
305 push_directive(tokens, "rm");
306 }
307 Rnd::Rp => {
308 push_directive(tokens, "rp");
309 }
310 }
311 }
312 if self.sat {
313 push_directive(tokens, "sat");
314 }
315 push_directive(tokens, "f32");
316 match &self.atype {
317 Atype::Bf16 => {
318 push_directive(tokens, "bf16");
319 }
320 Atype::F16 => {
321 push_directive(tokens, "f16");
322 }
323 }
324 self.d.unparse_tokens(tokens);
325 tokens.push(PtxToken::Comma);
326 self.a.unparse_tokens(tokens);
327 tokens.push(PtxToken::Comma);
328 self.c.unparse_tokens(tokens);
329 tokens.push(PtxToken::Semicolon);
330 }
331 }
332
333}
334