ptx_parser/unparser/instruction/
vote_sync.rs

1//! Original PTX specification:
2//!
3//! vote.sync.mode.pred  d, {!}a, membermask;
4//! vote.sync.ballot.b32 d, {!}a, membermask;  // 'ballot' form, returns bitmask
5//! .mode = { .all, .any, .uni };
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::vote_sync::section_0::*;
15
16    impl PtxUnparser for VoteSyncModePred {
17        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
18            push_opcode(tokens, "vote");
19                    push_directive(tokens, "sync");
20                    match &self.mode {
21                            Mode::All => {
22                                    push_directive(tokens, "all");
23                            }
24                            Mode::Any => {
25                                    push_directive(tokens, "any");
26                            }
27                            Mode::Uni => {
28                                    push_directive(tokens, "uni");
29                            }
30                    }
31                    push_directive(tokens, "pred");
32                    self.d.unparse_tokens(tokens);
33            tokens.push(PtxToken::Comma);
34            if self.a_op { tokens.push(PtxToken::Exclaim); }
35                    self.a.unparse_tokens(tokens);
36            tokens.push(PtxToken::Comma);
37                    self.membermask.unparse_tokens(tokens);
38            tokens.push(PtxToken::Semicolon);
39        }
40    }
41
42    impl PtxUnparser for VoteSyncBallotB32 {
43        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
44            push_opcode(tokens, "vote");
45                    push_directive(tokens, "sync");
46                    push_directive(tokens, "ballot");
47                    push_directive(tokens, "b32");
48                    self.d.unparse_tokens(tokens);
49            tokens.push(PtxToken::Comma);
50            if self.a_op { tokens.push(PtxToken::Exclaim); }
51                    self.a.unparse_tokens(tokens);
52            tokens.push(PtxToken::Comma);
53                    self.membermask.unparse_tokens(tokens);
54            tokens.push(PtxToken::Semicolon);
55        }
56    }
57
58}
59