Skip to main content

ptx_parser/unparser/instruction/
bfi.rs

1//! Original PTX specification:
2//!
3//! bfi.type  f, a, b, c, d;
4//! .type = { .b32, .b64 };
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::bfi::section_0::*;
14
15    impl PtxUnparser for BfiType {
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, "bfi");
21            match &self.type_ {
22                Type::B32 => {
23                    push_directive(tokens, "b32");
24                }
25                Type::B64 => {
26                    push_directive(tokens, "b64");
27                }
28            }
29            if spaced {
30                tokens.push(PtxToken::Space);
31            }
32            self.f.unparse_tokens_mode(tokens, spaced);
33            tokens.push(PtxToken::Comma);
34            if spaced {
35                tokens.push(PtxToken::Space);
36            }
37            self.a.unparse_tokens_mode(tokens, spaced);
38            tokens.push(PtxToken::Comma);
39            if spaced {
40                tokens.push(PtxToken::Space);
41            }
42            self.b.unparse_tokens_mode(tokens, spaced);
43            tokens.push(PtxToken::Comma);
44            if spaced {
45                tokens.push(PtxToken::Space);
46            }
47            self.c.unparse_tokens_mode(tokens, spaced);
48            tokens.push(PtxToken::Comma);
49            if spaced {
50                tokens.push(PtxToken::Space);
51            }
52            self.d.unparse_tokens_mode(tokens, spaced);
53            tokens.push(PtxToken::Semicolon);
54            if spaced {
55                tokens.push(PtxToken::Newline);
56            }
57        }
58    }
59}