Skip to main content

ptx_parser/unparser/instruction/
mul24.rs

1//! Original PTX specification:
2//!
3//! mul24.mode.type  d, a, b;
4//! .mode = { .hi, .lo };
5//! .type = { .u32, .s32 };
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::mul24::section_0::*;
15
16    impl PtxUnparser for Mul24ModeType {
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, "mul24");
22            match &self.mode {
23                Mode::Hi => {
24                    push_directive(tokens, "hi");
25                }
26                Mode::Lo => {
27                    push_directive(tokens, "lo");
28                }
29            }
30            match &self.type_ {
31                Type::U32 => {
32                    push_directive(tokens, "u32");
33                }
34                Type::S32 => {
35                    push_directive(tokens, "s32");
36                }
37            }
38            if spaced {
39                tokens.push(PtxToken::Space);
40            }
41            self.d.unparse_tokens_mode(tokens, spaced);
42            tokens.push(PtxToken::Comma);
43            if spaced {
44                tokens.push(PtxToken::Space);
45            }
46            self.a.unparse_tokens_mode(tokens, spaced);
47            tokens.push(PtxToken::Comma);
48            if spaced {
49                tokens.push(PtxToken::Space);
50            }
51            self.b.unparse_tokens_mode(tokens, spaced);
52            tokens.push(PtxToken::Semicolon);
53            if spaced {
54                tokens.push(PtxToken::Newline);
55            }
56        }
57    }
58}