ptx_parser/unparser/instruction/
vote.rs

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