Skip to main content

ptx_parser/unparser/instruction/
rem.rs

1//! Original PTX specification:
2//!
3//! rem.type  d, a, b;
4//! .type = { .u16, .u32, .u64, .s16, .s32, .s64 };
5
6#![allow(unused)]
7
8use crate::lexer::PtxToken;
9use crate::unparser::{PtxUnparser, common::*};
10
11pub mod section_0 {
12    use super::*;
13    use crate::r#type::instruction::rem::section_0::*;
14
15    impl PtxUnparser for RemType {
16        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
17            self.unparse_tokens_mode(tokens, false);
18        }
19        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
20            push_opcode(tokens, "rem");
21            match &self.type_ {
22                Type::U16 => {
23                    push_directive(tokens, "u16");
24                }
25                Type::U32 => {
26                    push_directive(tokens, "u32");
27                }
28                Type::U64 => {
29                    push_directive(tokens, "u64");
30                }
31                Type::S16 => {
32                    push_directive(tokens, "s16");
33                }
34                Type::S32 => {
35                    push_directive(tokens, "s32");
36                }
37                Type::S64 => {
38                    push_directive(tokens, "s64");
39                }
40            }
41            if spaced {
42                tokens.push(PtxToken::Space);
43            }
44            self.d.unparse_tokens_mode(tokens, spaced);
45            tokens.push(PtxToken::Comma);
46            if spaced {
47                tokens.push(PtxToken::Space);
48            }
49            self.a.unparse_tokens_mode(tokens, spaced);
50            tokens.push(PtxToken::Comma);
51            if spaced {
52                tokens.push(PtxToken::Space);
53            }
54            self.b.unparse_tokens_mode(tokens, spaced);
55            tokens.push(PtxToken::Semicolon);
56            if spaced {
57                tokens.push(PtxToken::Newline);
58            }
59        }
60    }
61}