ptx_parser/unparser/instruction/
bfind.rs

1//! Original PTX specification:
2//!
3//! bfind.type           d, a;
4//! bfind.shiftamt.type  d, a;
5//! .type = { .u32, .u64, .s32, .s64 };
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::bfind::section_0::*;
15
16    impl PtxUnparser for BfindType {
17        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
18            push_opcode(tokens, "bfind");
19            match &self.type_ {
20                Type::U32 => {
21                    push_directive(tokens, "u32");
22                }
23                Type::U64 => {
24                    push_directive(tokens, "u64");
25                }
26                Type::S32 => {
27                    push_directive(tokens, "s32");
28                }
29                Type::S64 => {
30                    push_directive(tokens, "s64");
31                }
32            }
33            self.d.unparse_tokens(tokens);
34            tokens.push(PtxToken::Comma);
35            self.a.unparse_tokens(tokens);
36            tokens.push(PtxToken::Semicolon);
37        }
38    }
39
40    impl PtxUnparser for BfindShiftamtType {
41        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
42            push_opcode(tokens, "bfind");
43            push_directive(tokens, "shiftamt");
44            match &self.type_ {
45                Type::U32 => {
46                    push_directive(tokens, "u32");
47                }
48                Type::U64 => {
49                    push_directive(tokens, "u64");
50                }
51                Type::S32 => {
52                    push_directive(tokens, "s32");
53                }
54                Type::S64 => {
55                    push_directive(tokens, "s64");
56                }
57            }
58            self.d.unparse_tokens(tokens);
59            tokens.push(PtxToken::Comma);
60            self.a.unparse_tokens(tokens);
61            tokens.push(PtxToken::Semicolon);
62        }
63    }
64}