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