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