ptx_parser/unparser/instruction/
ex2.rs1#![allow(unused)]
11
12use crate::lexer::PtxToken;
13use crate::unparser::{PtxUnparser, common::*};
14
15pub mod section_0 {
16 use super::*;
17 use crate::r#type::instruction::ex2::section_0::*;
18
19 impl PtxUnparser for Ex2ApproxFtzF32 {
20 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
21 self.unparse_tokens_mode(tokens, false);
22 }
23 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
24 push_opcode(tokens, "ex2");
25 push_directive(tokens, "approx");
26 if self.ftz {
27 push_directive(tokens, "ftz");
28 }
29 push_directive(tokens, "f32");
30 if spaced {
31 tokens.push(PtxToken::Space);
32 }
33 self.d.unparse_tokens_mode(tokens, spaced);
34 tokens.push(PtxToken::Comma);
35 if spaced {
36 tokens.push(PtxToken::Space);
37 }
38 self.a.unparse_tokens_mode(tokens, spaced);
39 tokens.push(PtxToken::Semicolon);
40 if spaced {
41 tokens.push(PtxToken::Newline);
42 }
43 }
44 }
45
46 impl PtxUnparser for Ex2ApproxAtype {
47 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
48 self.unparse_tokens_mode(tokens, false);
49 }
50 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
51 push_opcode(tokens, "ex2");
52 push_directive(tokens, "approx");
53 match &self.atype {
54 Atype::F16x2 => {
55 push_directive(tokens, "f16x2");
56 }
57 Atype::F16 => {
58 push_directive(tokens, "f16");
59 }
60 }
61 if spaced {
62 tokens.push(PtxToken::Space);
63 }
64 self.d.unparse_tokens_mode(tokens, spaced);
65 tokens.push(PtxToken::Comma);
66 if spaced {
67 tokens.push(PtxToken::Space);
68 }
69 self.a.unparse_tokens_mode(tokens, spaced);
70 tokens.push(PtxToken::Semicolon);
71 if spaced {
72 tokens.push(PtxToken::Newline);
73 }
74 }
75 }
76
77 impl PtxUnparser for Ex2ApproxFtzBtype {
78 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
79 self.unparse_tokens_mode(tokens, false);
80 }
81 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
82 push_opcode(tokens, "ex2");
83 push_directive(tokens, "approx");
84 push_directive(tokens, "ftz");
85 match &self.btype {
86 Btype::Bf16x2 => {
87 push_directive(tokens, "bf16x2");
88 }
89 Btype::Bf16 => {
90 push_directive(tokens, "bf16");
91 }
92 }
93 if spaced {
94 tokens.push(PtxToken::Space);
95 }
96 self.d.unparse_tokens_mode(tokens, spaced);
97 tokens.push(PtxToken::Comma);
98 if spaced {
99 tokens.push(PtxToken::Space);
100 }
101 self.a.unparse_tokens_mode(tokens, spaced);
102 tokens.push(PtxToken::Semicolon);
103 if spaced {
104 tokens.push(PtxToken::Newline);
105 }
106 }
107 }
108}