ptx_parser/unparser/instruction/
match_sync.rs

1//! Original PTX specification:
2//!
3//! match.any.sync.type  d, a, membermask;
4//! match.all.sync.type  d{|p}, a, membermask;
5//! .type = { .b32, .b64 };
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::match_sync::section_0::*;
15
16    impl PtxUnparser for MatchAnySyncType {
17        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
18            push_opcode(tokens, "match");
19                    push_directive(tokens, "any");
20                    push_directive(tokens, "sync");
21                    match &self.type_ {
22                            Type::B32 => {
23                                    push_directive(tokens, "b32");
24                            }
25                            Type::B64 => {
26                                    push_directive(tokens, "b64");
27                            }
28                    }
29                    self.d.unparse_tokens(tokens);
30            tokens.push(PtxToken::Comma);
31                    self.a.unparse_tokens(tokens);
32            tokens.push(PtxToken::Comma);
33                    self.membermask.unparse_tokens(tokens);
34            tokens.push(PtxToken::Semicolon);
35        }
36    }
37
38    impl PtxUnparser for MatchAllSyncType {
39        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
40            push_opcode(tokens, "match");
41                    push_directive(tokens, "all");
42                    push_directive(tokens, "sync");
43                    match &self.type_ {
44                            Type::B32 => {
45                                    push_directive(tokens, "b32");
46                            }
47                            Type::B64 => {
48                                    push_directive(tokens, "b64");
49                            }
50                    }
51                    self.d.unparse_tokens(tokens);
52                    if let Some(p_0) = self.p.as_ref() {
53                        tokens.push(PtxToken::Pipe);
54                        p_0.unparse_tokens(tokens);
55                    }
56            tokens.push(PtxToken::Comma);
57                    self.a.unparse_tokens(tokens);
58            tokens.push(PtxToken::Comma);
59                    self.membermask.unparse_tokens(tokens);
60            tokens.push(PtxToken::Semicolon);
61        }
62    }
63
64}
65