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