ptx_parser/unparser/instruction/
madc.rs

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