ptx_parser/unparser/instruction/
getctarank.rs

1//! Original PTX specification:
2//!
3//! getctarank{.space}.type d, a;
4//! // Get cta rank from source shared memory address in register a.
5//! getctarank.shared::cluster.type d, a;
6//! // // Get cta rank from shared memory variable.
7//! // getctarank.shared::cluster.type d, var;
8//! // // Get cta rank from shared memory variable+offset.
9//! // getctarank.shared::cluster.type d, var + imm;
10//! // Get cta rank from generic address of shared memory variable in register a.
11//! getctarank.type d, a;
12//! .space = { .shared::cluster };
13//! .type  = { .u32, .u64 };
14
15#![allow(unused)]
16
17use crate::lexer::PtxToken;
18use crate::unparser::{PtxUnparser, common::*};
19
20pub mod section_0 {
21    use super::*;
22    use crate::r#type::instruction::getctarank::section_0::*;
23
24    impl PtxUnparser for GetctarankSpaceType {
25        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
26            push_opcode(tokens, "getctarank");
27                    if let Some(space_0) = self.space.as_ref() {
28                            match space_0 {
29                                    Space::SharedCluster => {
30                                            push_directive(tokens, "shared::cluster");
31                                    }
32                            }
33                    }
34                    match &self.type_ {
35                            Type::U32 => {
36                                    push_directive(tokens, "u32");
37                            }
38                            Type::U64 => {
39                                    push_directive(tokens, "u64");
40                            }
41                    }
42                    self.d.unparse_tokens(tokens);
43            tokens.push(PtxToken::Comma);
44                    self.a.unparse_tokens(tokens);
45            tokens.push(PtxToken::Semicolon);
46        }
47    }
48
49    impl PtxUnparser for GetctarankSharedClusterType {
50        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
51            push_opcode(tokens, "getctarank");
52                    push_directive(tokens, "shared::cluster");
53                    match &self.type_ {
54                            Type::U32 => {
55                                    push_directive(tokens, "u32");
56                            }
57                            Type::U64 => {
58                                    push_directive(tokens, "u64");
59                            }
60                    }
61                    self.d.unparse_tokens(tokens);
62            tokens.push(PtxToken::Comma);
63                    self.a.unparse_tokens(tokens);
64            tokens.push(PtxToken::Semicolon);
65        }
66    }
67
68    impl PtxUnparser for GetctarankType {
69        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
70            push_opcode(tokens, "getctarank");
71                    match &self.type_ {
72                            Type::U32 => {
73                                    push_directive(tokens, "u32");
74                            }
75                            Type::U64 => {
76                                    push_directive(tokens, "u64");
77                            }
78                    }
79                    self.d.unparse_tokens(tokens);
80            tokens.push(PtxToken::Comma);
81                    self.a.unparse_tokens(tokens);
82            tokens.push(PtxToken::Semicolon);
83        }
84    }
85
86}
87