ptx_parser/unparser/instruction/
barrier_cluster.rs

1//! Original PTX specification:
2//!
3//! barrier.cluster.arrive{.sem}{.aligned};
4//! barrier.cluster.wait{.acquire}{.aligned};
5//! .sem = {.release, .relaxed};
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::barrier_cluster::section_0::*;
15
16    impl PtxUnparser for BarrierClusterArriveSemAligned {
17        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
18            push_opcode(tokens, "barrier");
19                    push_directive(tokens, "cluster");
20                    push_directive(tokens, "arrive");
21                    if let Some(sem_0) = self.sem.as_ref() {
22                            match sem_0 {
23                                    Sem::Release => {
24                                            push_directive(tokens, "release");
25                                    }
26                                    Sem::Relaxed => {
27                                            push_directive(tokens, "relaxed");
28                                    }
29                            }
30                    }
31                    if self.aligned {
32                            push_directive(tokens, "aligned");
33                    }
34            tokens.push(PtxToken::Semicolon);
35        }
36    }
37
38    impl PtxUnparser for BarrierClusterWaitAcquireAligned {
39        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
40            push_opcode(tokens, "barrier");
41                    push_directive(tokens, "cluster");
42                    push_directive(tokens, "wait");
43                    if self.acquire {
44                            push_directive(tokens, "acquire");
45                    }
46                    if self.aligned {
47                            push_directive(tokens, "aligned");
48                    }
49            tokens.push(PtxToken::Semicolon);
50        }
51    }
52
53}
54