ptx_parser/unparser/instruction/
mad_cc.rs

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