ptx_parser/unparser/instruction/
dp2a.rs

1//! Original PTX specification:
2//!
3//! dp2a.mode.atype.btype  d, a, b, c;
4//! .atype = .btype = { .u32, .s32 };
5//! .mode = { .lo, .hi };
6
7#![allow(unused)]
8
9use crate::lexer::PtxToken;
10use crate::unparser::{PtxUnparser, common::*};
11
12pub mod section_0 {
13    use super::*;
14    use crate::r#type::instruction::dp2a::section_0::*;
15
16    impl PtxUnparser for Dp2aModeAtypeBtype {
17        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
18            push_opcode(tokens, "dp2a");
19            match &self.mode {
20                Mode::Lo => {
21                    push_directive(tokens, "lo");
22                }
23                Mode::Hi => {
24                    push_directive(tokens, "hi");
25                }
26            }
27            match &self.atype {
28                Atype::U32 => {
29                    push_directive(tokens, "u32");
30                }
31                Atype::S32 => {
32                    push_directive(tokens, "s32");
33                }
34            }
35            match &self.btype {
36                Btype::U32 => {
37                    push_directive(tokens, "u32");
38                }
39                Btype::S32 => {
40                    push_directive(tokens, "s32");
41                }
42            }
43            self.d.unparse_tokens(tokens);
44            tokens.push(PtxToken::Comma);
45            self.a.unparse_tokens(tokens);
46            tokens.push(PtxToken::Comma);
47            self.b.unparse_tokens(tokens);
48            tokens.push(PtxToken::Comma);
49            self.c.unparse_tokens(tokens);
50            tokens.push(PtxToken::Semicolon);
51        }
52    }
53}