ptx_parser/unparser/instruction/
tanh.rs

1//! Original PTX specification:
2//!
3//! tanh.approx.type d, a;
4//! .type = {.f16, .f32, .f16x2, .bf16, .bf16x2};
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::tanh::section_0::*;
14
15    impl PtxUnparser for TanhApproxType {
16        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
17            push_opcode(tokens, "tanh");
18                    push_directive(tokens, "approx");
19                    match &self.type_ {
20                            Type::Bf16x2 => {
21                                    push_directive(tokens, "bf16x2");
22                            }
23                            Type::F16x2 => {
24                                    push_directive(tokens, "f16x2");
25                            }
26                            Type::Bf16 => {
27                                    push_directive(tokens, "bf16");
28                            }
29                            Type::F16 => {
30                                    push_directive(tokens, "f16");
31                            }
32                            Type::F32 => {
33                                    push_directive(tokens, "f32");
34                            }
35                    }
36                    self.d.unparse_tokens(tokens);
37            tokens.push(PtxToken::Comma);
38                    self.a.unparse_tokens(tokens);
39            tokens.push(PtxToken::Semicolon);
40        }
41    }
42
43}
44