ptx_parser/unparser/instruction/
szext.rs

1//! Original PTX specification:
2//!
3//! szext.mode.type  d, a, b;
4//! .mode = { .clamp, .wrap };
5//! .type = { .u32, .s32 };
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::szext::section_0::*;
15
16    impl PtxUnparser for SzextModeType {
17        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
18            push_opcode(tokens, "szext");
19                    match &self.mode {
20                            Mode::Clamp => {
21                                    push_directive(tokens, "clamp");
22                            }
23                            Mode::Wrap => {
24                                    push_directive(tokens, "wrap");
25                            }
26                    }
27                    match &self.type_ {
28                            Type::U32 => {
29                                    push_directive(tokens, "u32");
30                            }
31                            Type::S32 => {
32                                    push_directive(tokens, "s32");
33                            }
34                    }
35                    self.d.unparse_tokens(tokens);
36            tokens.push(PtxToken::Comma);
37                    self.a.unparse_tokens(tokens);
38            tokens.push(PtxToken::Comma);
39                    self.b.unparse_tokens(tokens);
40            tokens.push(PtxToken::Semicolon);
41        }
42    }
43
44}
45