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