ptx_parser/unparser/instruction/
mul.rs1#![allow(unused)]
20
21use crate::lexer::PtxToken;
22use crate::unparser::{PtxUnparser, common::*};
23
24pub mod section_0 {
25 use super::*;
26 use crate::r#type::instruction::mul::section_0::*;
27
28 impl PtxUnparser for MulModeType {
29 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
30 push_opcode(tokens, "mul");
31 match &self.mode {
32 Mode::Wide => {
33 push_directive(tokens, "wide");
34 }
35 Mode::Hi => {
36 push_directive(tokens, "hi");
37 }
38 Mode::Lo => {
39 push_directive(tokens, "lo");
40 }
41 }
42 match &self.type_ {
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}
72
73pub mod section_1 {
74 use super::*;
75 use crate::r#type::instruction::mul::section_1::*;
76
77 impl PtxUnparser for MulRndFtzSatF32 {
78 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
79 push_opcode(tokens, "mul");
80 if let Some(rnd_0) = self.rnd.as_ref() {
81 match rnd_0 {
82 Rnd::Rn => {
83 push_directive(tokens, "rn");
84 }
85 Rnd::Rz => {
86 push_directive(tokens, "rz");
87 }
88 Rnd::Rm => {
89 push_directive(tokens, "rm");
90 }
91 Rnd::Rp => {
92 push_directive(tokens, "rp");
93 }
94 }
95 }
96 if self.ftz {
97 push_directive(tokens, "ftz");
98 }
99 if self.sat {
100 push_directive(tokens, "sat");
101 }
102 push_directive(tokens, "f32");
103 self.d.unparse_tokens(tokens);
104 tokens.push(PtxToken::Comma);
105 self.a.unparse_tokens(tokens);
106 tokens.push(PtxToken::Comma);
107 self.b.unparse_tokens(tokens);
108 tokens.push(PtxToken::Semicolon);
109 }
110 }
111
112 impl PtxUnparser for MulRndFtzF32x2 {
113 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
114 push_opcode(tokens, "mul");
115 if let Some(rnd_1) = self.rnd.as_ref() {
116 match rnd_1 {
117 Rnd::Rn => {
118 push_directive(tokens, "rn");
119 }
120 Rnd::Rz => {
121 push_directive(tokens, "rz");
122 }
123 Rnd::Rm => {
124 push_directive(tokens, "rm");
125 }
126 Rnd::Rp => {
127 push_directive(tokens, "rp");
128 }
129 }
130 }
131 if self.ftz {
132 push_directive(tokens, "ftz");
133 }
134 push_directive(tokens, "f32x2");
135 self.d.unparse_tokens(tokens);
136 tokens.push(PtxToken::Comma);
137 self.a.unparse_tokens(tokens);
138 tokens.push(PtxToken::Comma);
139 self.b.unparse_tokens(tokens);
140 tokens.push(PtxToken::Semicolon);
141 }
142 }
143
144 impl PtxUnparser for MulRndF64 {
145 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
146 push_opcode(tokens, "mul");
147 if let Some(rnd_2) = self.rnd.as_ref() {
148 match rnd_2 {
149 Rnd::Rn => {
150 push_directive(tokens, "rn");
151 }
152 Rnd::Rz => {
153 push_directive(tokens, "rz");
154 }
155 Rnd::Rm => {
156 push_directive(tokens, "rm");
157 }
158 Rnd::Rp => {
159 push_directive(tokens, "rp");
160 }
161 }
162 }
163 push_directive(tokens, "f64");
164 self.d.unparse_tokens(tokens);
165 tokens.push(PtxToken::Comma);
166 self.a.unparse_tokens(tokens);
167 tokens.push(PtxToken::Comma);
168 self.b.unparse_tokens(tokens);
169 tokens.push(PtxToken::Semicolon);
170 }
171 }
172
173}
174
175pub mod section_2 {
176 use super::*;
177 use crate::r#type::instruction::mul::section_2::*;
178
179 impl PtxUnparser for MulRndFtzSatF16 {
180 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
181 push_opcode(tokens, "mul");
182 if let Some(rnd_3) = self.rnd.as_ref() {
183 match rnd_3 {
184 Rnd::Rn => {
185 push_directive(tokens, "rn");
186 }
187 }
188 }
189 if self.ftz {
190 push_directive(tokens, "ftz");
191 }
192 if self.sat {
193 push_directive(tokens, "sat");
194 }
195 push_directive(tokens, "f16");
196 self.d.unparse_tokens(tokens);
197 tokens.push(PtxToken::Comma);
198 self.a.unparse_tokens(tokens);
199 tokens.push(PtxToken::Comma);
200 self.b.unparse_tokens(tokens);
201 tokens.push(PtxToken::Semicolon);
202 }
203 }
204
205 impl PtxUnparser for MulRndFtzSatF16x2 {
206 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
207 push_opcode(tokens, "mul");
208 if let Some(rnd_4) = self.rnd.as_ref() {
209 match rnd_4 {
210 Rnd::Rn => {
211 push_directive(tokens, "rn");
212 }
213 }
214 }
215 if self.ftz {
216 push_directive(tokens, "ftz");
217 }
218 if self.sat {
219 push_directive(tokens, "sat");
220 }
221 push_directive(tokens, "f16x2");
222 self.d.unparse_tokens(tokens);
223 tokens.push(PtxToken::Comma);
224 self.a.unparse_tokens(tokens);
225 tokens.push(PtxToken::Comma);
226 self.b.unparse_tokens(tokens);
227 tokens.push(PtxToken::Semicolon);
228 }
229 }
230
231 impl PtxUnparser for MulRndBf16 {
232 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
233 push_opcode(tokens, "mul");
234 if let Some(rnd_5) = self.rnd.as_ref() {
235 match rnd_5 {
236 Rnd::Rn => {
237 push_directive(tokens, "rn");
238 }
239 }
240 }
241 push_directive(tokens, "bf16");
242 self.d.unparse_tokens(tokens);
243 tokens.push(PtxToken::Comma);
244 self.a.unparse_tokens(tokens);
245 tokens.push(PtxToken::Comma);
246 self.b.unparse_tokens(tokens);
247 tokens.push(PtxToken::Semicolon);
248 }
249 }
250
251 impl PtxUnparser for MulRndBf16x2 {
252 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
253 push_opcode(tokens, "mul");
254 if let Some(rnd_6) = self.rnd.as_ref() {
255 match rnd_6 {
256 Rnd::Rn => {
257 push_directive(tokens, "rn");
258 }
259 }
260 }
261 push_directive(tokens, "bf16x2");
262 self.d.unparse_tokens(tokens);
263 tokens.push(PtxToken::Comma);
264 self.a.unparse_tokens(tokens);
265 tokens.push(PtxToken::Comma);
266 self.b.unparse_tokens(tokens);
267 tokens.push(PtxToken::Semicolon);
268 }
269 }
270
271}
272