Skip to main content

ptx_parser/unparser/instruction/
suq.rs

1//! Original PTX specification:
2//!
3//! suq.query.b32   d, [a];
4//! .query = { .width, .height, .depth,
5//! .channel_data_type, .channel_order,
6//! .array_size, .memory_layout };
7
8#![allow(unused)]
9
10use crate::lexer::PtxToken;
11use crate::unparser::{PtxUnparser, common::*};
12
13pub mod section_0 {
14    use super::*;
15    use crate::r#type::instruction::suq::section_0::*;
16
17    impl PtxUnparser for SuqQueryB32 {
18        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
19            self.unparse_tokens_mode(tokens, false);
20        }
21        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
22            push_opcode(tokens, "suq");
23            match &self.query {
24                Query::ChannelDataType => {
25                    push_directive(tokens, "channel_data_type");
26                }
27                Query::ChannelOrder => {
28                    push_directive(tokens, "channel_order");
29                }
30                Query::MemoryLayout => {
31                    push_directive(tokens, "memory_layout");
32                }
33                Query::ArraySize => {
34                    push_directive(tokens, "array_size");
35                }
36                Query::Height => {
37                    push_directive(tokens, "height");
38                }
39                Query::Width => {
40                    push_directive(tokens, "width");
41                }
42                Query::Depth => {
43                    push_directive(tokens, "depth");
44                }
45            }
46            push_directive(tokens, "b32");
47            if spaced {
48                tokens.push(PtxToken::Space);
49            }
50            self.d.unparse_tokens_mode(tokens, spaced);
51            tokens.push(PtxToken::Comma);
52            if spaced {
53                tokens.push(PtxToken::Space);
54            }
55            self.a.unparse_tokens_mode(tokens, spaced);
56            tokens.push(PtxToken::Semicolon);
57            if spaced {
58                tokens.push(PtxToken::Newline);
59            }
60        }
61    }
62}