ptx_parser/parser/instruction/
tanh.rs1#![allow(unused)]
7
8use crate::parser::{
9 PtxParseError, PtxParser, PtxTokenStream, Span,
10 util::{
11 between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
12 pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
13 },
14};
15use crate::r#type::common::*;
16use crate::{alt, ok, seq_n};
17
18pub mod section_0 {
19 use super::*;
20 use crate::r#type::instruction::tanh::section_0::*;
21
22 impl PtxParser for Type {
27 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
28 alt!(
29 map(string_p(".bf16x2"), |_, _span| Type::Bf16x2),
30 map(string_p(".f16x2"), |_, _span| Type::F16x2),
31 map(string_p(".bf16"), |_, _span| Type::Bf16),
32 map(string_p(".f16"), |_, _span| Type::F16),
33 map(string_p(".f32"), |_, _span| Type::F32)
34 )
35 }
36 }
37
38 impl PtxParser for TanhApproxType {
39 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
40 try_map(
41 seq_n!(
42 string_p("tanh"),
43 string_p(".approx"),
44 Type::parse(),
45 GeneralOperand::parse(),
46 comma_p(),
47 GeneralOperand::parse(),
48 semicolon_p()
49 ),
50 |(_, approx, type_, d, _, a, _), span| {
51 ok!(TanhApproxType {
52 approx = approx,
53 type_ = type_,
54 d = d,
55 a = a,
56
57 })
58 },
59 )
60 }
61 }
62}