Skip to main content

ptx_parser/unparser/instruction/
and.rs

1//! Original PTX specification:
2//!
3//! and.type d, a, b;
4//! .type = { .pred, .b16, .b32, .b64 };
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::and::section_0::*;
14
15    impl PtxUnparser for AndType {
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, "and");
21            match &self.type_ {
22                Type::Pred => {
23                    push_directive(tokens, "pred");
24                }
25                Type::B16 => {
26                    push_directive(tokens, "b16");
27                }
28                Type::B32 => {
29                    push_directive(tokens, "b32");
30                }
31                Type::B64 => {
32                    push_directive(tokens, "b64");
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::Comma);
45            if spaced {
46                tokens.push(PtxToken::Space);
47            }
48            self.b.unparse_tokens_mode(tokens, spaced);
49            tokens.push(PtxToken::Semicolon);
50            if spaced {
51                tokens.push(PtxToken::Newline);
52            }
53        }
54    }
55}