ptx_parser/unparser/instruction/
abs.rs1#![allow(unused)]
15
16use crate::lexer::PtxToken;
17use crate::unparser::{PtxUnparser, common::*};
18
19pub mod section_0 {
20 use super::*;
21 use crate::r#type::instruction::abs::section_0::*;
22
23 impl PtxUnparser for AbsType {
24 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
25 self.unparse_tokens_mode(tokens, false);
26 }
27 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
28 push_opcode(tokens, "abs");
29 match &self.type_ {
30 Type::S16 => {
31 push_directive(tokens, "s16");
32 }
33 Type::S32 => {
34 push_directive(tokens, "s32");
35 }
36 Type::S64 => {
37 push_directive(tokens, "s64");
38 }
39 }
40 if spaced {
41 tokens.push(PtxToken::Space);
42 }
43 self.d.unparse_tokens_mode(tokens, spaced);
44 tokens.push(PtxToken::Comma);
45 if spaced {
46 tokens.push(PtxToken::Space);
47 }
48 self.a.unparse_tokens_mode(tokens, spaced);
49 tokens.push(PtxToken::Semicolon);
50 if spaced {
51 tokens.push(PtxToken::Newline);
52 }
53 }
54 }
55
56 impl PtxUnparser for AbsFtzF32 {
57 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
58 self.unparse_tokens_mode(tokens, false);
59 }
60 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
61 push_opcode(tokens, "abs");
62 if self.ftz {
63 push_directive(tokens, "ftz");
64 }
65 push_directive(tokens, "f32");
66 if spaced {
67 tokens.push(PtxToken::Space);
68 }
69 self.d.unparse_tokens_mode(tokens, spaced);
70 tokens.push(PtxToken::Comma);
71 if spaced {
72 tokens.push(PtxToken::Space);
73 }
74 self.a.unparse_tokens_mode(tokens, spaced);
75 tokens.push(PtxToken::Semicolon);
76 if spaced {
77 tokens.push(PtxToken::Newline);
78 }
79 }
80 }
81
82 impl PtxUnparser for AbsF64 {
83 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
84 self.unparse_tokens_mode(tokens, false);
85 }
86 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
87 push_opcode(tokens, "abs");
88 push_directive(tokens, "f64");
89 if spaced {
90 tokens.push(PtxToken::Space);
91 }
92 self.d.unparse_tokens_mode(tokens, spaced);
93 tokens.push(PtxToken::Comma);
94 if spaced {
95 tokens.push(PtxToken::Space);
96 }
97 self.a.unparse_tokens_mode(tokens, spaced);
98 tokens.push(PtxToken::Semicolon);
99 if spaced {
100 tokens.push(PtxToken::Newline);
101 }
102 }
103 }
104
105 impl PtxUnparser for AbsFtzF16 {
106 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
107 self.unparse_tokens_mode(tokens, false);
108 }
109 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
110 push_opcode(tokens, "abs");
111 if self.ftz {
112 push_directive(tokens, "ftz");
113 }
114 push_directive(tokens, "f16");
115 if spaced {
116 tokens.push(PtxToken::Space);
117 }
118 self.d.unparse_tokens_mode(tokens, spaced);
119 tokens.push(PtxToken::Comma);
120 if spaced {
121 tokens.push(PtxToken::Space);
122 }
123 self.a.unparse_tokens_mode(tokens, spaced);
124 tokens.push(PtxToken::Semicolon);
125 if spaced {
126 tokens.push(PtxToken::Newline);
127 }
128 }
129 }
130
131 impl PtxUnparser for AbsFtzF16x2 {
132 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
133 self.unparse_tokens_mode(tokens, false);
134 }
135 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
136 push_opcode(tokens, "abs");
137 if self.ftz {
138 push_directive(tokens, "ftz");
139 }
140 push_directive(tokens, "f16x2");
141 if spaced {
142 tokens.push(PtxToken::Space);
143 }
144 self.d.unparse_tokens_mode(tokens, spaced);
145 tokens.push(PtxToken::Comma);
146 if spaced {
147 tokens.push(PtxToken::Space);
148 }
149 self.a.unparse_tokens_mode(tokens, spaced);
150 tokens.push(PtxToken::Semicolon);
151 if spaced {
152 tokens.push(PtxToken::Newline);
153 }
154 }
155 }
156
157 impl PtxUnparser for AbsBf16 {
158 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
159 self.unparse_tokens_mode(tokens, false);
160 }
161 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
162 push_opcode(tokens, "abs");
163 push_directive(tokens, "bf16");
164 if spaced {
165 tokens.push(PtxToken::Space);
166 }
167 self.d.unparse_tokens_mode(tokens, spaced);
168 tokens.push(PtxToken::Comma);
169 if spaced {
170 tokens.push(PtxToken::Space);
171 }
172 self.a.unparse_tokens_mode(tokens, spaced);
173 tokens.push(PtxToken::Semicolon);
174 if spaced {
175 tokens.push(PtxToken::Newline);
176 }
177 }
178 }
179
180 impl PtxUnparser for AbsBf16x2 {
181 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
182 self.unparse_tokens_mode(tokens, false);
183 }
184 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
185 push_opcode(tokens, "abs");
186 push_directive(tokens, "bf16x2");
187 if spaced {
188 tokens.push(PtxToken::Space);
189 }
190 self.d.unparse_tokens_mode(tokens, spaced);
191 tokens.push(PtxToken::Comma);
192 if spaced {
193 tokens.push(PtxToken::Space);
194 }
195 self.a.unparse_tokens_mode(tokens, spaced);
196 tokens.push(PtxToken::Semicolon);
197 if spaced {
198 tokens.push(PtxToken::Newline);
199 }
200 }
201 }
202}