Skip to main content

ptx_parser/unparser/instruction/
movmatrix.rs

1//! Original PTX specification:
2//!
3//! movmatrix.sync.aligned.shape.trans.type d, a;
4//! .shape  = {.m8n8};
5//! .type   = {.b16};
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::movmatrix::section_0::*;
15
16    impl PtxUnparser for MovmatrixSyncAlignedShapeTransType {
17        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
18            self.unparse_tokens_mode(tokens, false);
19        }
20        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
21            push_opcode(tokens, "movmatrix");
22            push_directive(tokens, "sync");
23            push_directive(tokens, "aligned");
24            match &self.shape {
25                Shape::M8n8 => {
26                    push_directive(tokens, "m8n8");
27                }
28            }
29            push_directive(tokens, "trans");
30            match &self.type_ {
31                Type::B16 => {
32                    push_directive(tokens, "b16");
33                }
34            }
35            if spaced {
36                tokens.push(PtxToken::Space);
37            }
38            self.d.unparse_tokens_mode(tokens, spaced);
39            tokens.push(PtxToken::Comma);
40            if spaced {
41                tokens.push(PtxToken::Space);
42            }
43            self.a.unparse_tokens_mode(tokens, spaced);
44            tokens.push(PtxToken::Semicolon);
45            if spaced {
46                tokens.push(PtxToken::Newline);
47            }
48        }
49    }
50}