Skip to main content

ptx_parser/unparser/instruction/
cp_async_mbarrier_arrive.rs

1//! Original PTX specification:
2//!
3//! cp.async.mbarrier.arrive{.noinc}{.state}.b64 [addr];
4//! .state = { .shared, .shared::cta}
5
6#![allow(unused)]
7
8use crate::lexer::PtxToken;
9use crate::unparser::{PtxUnparser, common::*};
10
11pub mod section_0 {
12    use super::*;
13    use crate::r#type::instruction::cp_async_mbarrier_arrive::section_0::*;
14
15    impl PtxUnparser for CpAsyncMbarrierArriveNoincStateB64 {
16        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
17            self.unparse_tokens_mode(tokens, false);
18        }
19        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
20            push_opcode(tokens, "cp");
21            push_directive(tokens, "async");
22            push_directive(tokens, "mbarrier");
23            push_directive(tokens, "arrive");
24            if self.noinc {
25                push_directive(tokens, "noinc");
26            }
27            if let Some(state_0) = self.state.as_ref() {
28                match state_0 {
29                    State::SharedCta => {
30                        push_directive(tokens, "shared::cta");
31                    }
32                    State::Shared => {
33                        push_directive(tokens, "shared");
34                    }
35                }
36            }
37            push_directive(tokens, "b64");
38            if spaced {
39                tokens.push(PtxToken::Space);
40            }
41            self.addr.unparse_tokens_mode(tokens, spaced);
42            tokens.push(PtxToken::Semicolon);
43            if spaced {
44                tokens.push(PtxToken::Newline);
45            }
46        }
47    }
48}