ptx_parser/unparser/instruction/
sad.rs

1//! Original PTX specification:
2//!
3//! sad.type  d, a, b, c;
4//! .type = { .u16, .u32, .u64, .s16, .s32, .s64 };
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::sad::section_0::*;
14
15    impl PtxUnparser for SadType {
16        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
17            push_opcode(tokens, "sad");
18            match &self.type_ {
19                Type::U16 => {
20                    push_directive(tokens, "u16");
21                }
22                Type::U32 => {
23                    push_directive(tokens, "u32");
24                }
25                Type::U64 => {
26                    push_directive(tokens, "u64");
27                }
28                Type::S16 => {
29                    push_directive(tokens, "s16");
30                }
31                Type::S32 => {
32                    push_directive(tokens, "s32");
33                }
34                Type::S64 => {
35                    push_directive(tokens, "s64");
36                }
37            }
38            self.d.unparse_tokens(tokens);
39            tokens.push(PtxToken::Comma);
40            self.a.unparse_tokens(tokens);
41            tokens.push(PtxToken::Comma);
42            self.b.unparse_tokens(tokens);
43            tokens.push(PtxToken::Comma);
44            self.c.unparse_tokens(tokens);
45            tokens.push(PtxToken::Semicolon);
46        }
47    }
48}