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 {
35                tokens.push(PtxToken::Exclaim);
36            }
37            self.a.unparse_tokens(tokens);
38            tokens.push(PtxToken::Comma);
39            self.membermask.unparse_tokens(tokens);
40            tokens.push(PtxToken::Semicolon);
41        }
42    }
43
44    impl PtxUnparser for VoteSyncBallotB32 {
45        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
46            push_opcode(tokens, "vote");
47            push_directive(tokens, "sync");
48            push_directive(tokens, "ballot");
49            push_directive(tokens, "b32");
50            self.d.unparse_tokens(tokens);
51            tokens.push(PtxToken::Comma);
52            if self.a_op {
53                tokens.push(PtxToken::Exclaim);
54            }
55            self.a.unparse_tokens(tokens);
56            tokens.push(PtxToken::Comma);
57            self.membermask.unparse_tokens(tokens);
58            tokens.push(PtxToken::Semicolon);
59        }
60    }
61}