ptx_parser/unparser/instruction/
shfl.rs

1//! Original PTX specification:
2//!
3//! shfl.mode.b32  d{|p}, a, b, c;
4//! .mode = { .up, .down, .bfly, .idx };
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::shfl::section_0::*;
14
15    impl PtxUnparser for ShflModeB32 {
16        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
17            push_opcode(tokens, "shfl");
18            match &self.mode {
19                Mode::Down => {
20                    push_directive(tokens, "down");
21                }
22                Mode::Bfly => {
23                    push_directive(tokens, "bfly");
24                }
25                Mode::Idx => {
26                    push_directive(tokens, "idx");
27                }
28                Mode::Up => {
29                    push_directive(tokens, "up");
30                }
31            }
32            push_directive(tokens, "b32");
33            self.d.unparse_tokens(tokens);
34            if let Some(p_0) = self.p.as_ref() {
35                tokens.push(PtxToken::Pipe);
36                p_0.unparse_tokens(tokens);
37            }
38            tokens.push(PtxToken::Comma);
39            self.a.unparse_tokens(tokens);
40            tokens.push(PtxToken::Comma);
41            self.b.unparse_tokens(tokens);
42            tokens.push(PtxToken::Comma);
43            self.c.unparse_tokens(tokens);
44            tokens.push(PtxToken::Semicolon);
45        }
46    }
47}