ptx_parser/parser/instruction/
sin.rs

1//! Original PTX specification:
2//!
3//! sin.approx{.ftz}.f32  d, a;
4
5#![allow(unused)]
6
7use crate::lexer::PtxToken;
8use crate::parser::{PtxParseError, PtxParser, PtxTokenStream, Span};
9use crate::r#type::common::*;
10
11pub mod section_0 {
12    use super::*;
13    use crate::r#type::instruction::sin::section_0::*;
14
15    impl PtxParser for SinApproxFtzF32 {
16        fn parse(stream: &mut PtxTokenStream) -> Result<Self, PtxParseError> {
17            stream.expect_string("sin")?;
18            stream.expect_string(".approx")?;
19            let approx = ();
20            stream.expect_complete()?;
21            let saved_pos = stream.position();
22            let ftz = stream.expect_string(".ftz").is_ok();
23            if !ftz {
24                stream.set_position(saved_pos);
25            }
26            stream.expect_complete()?;
27            stream.expect_string(".f32")?;
28            let f32 = ();
29            stream.expect_complete()?;
30            let d = GeneralOperand::parse(stream)?;
31            stream.expect_complete()?;
32            stream.expect(&PtxToken::Comma)?;
33            let a = GeneralOperand::parse(stream)?;
34            stream.expect_complete()?;
35            stream.expect_complete()?;
36            stream.expect(&PtxToken::Semicolon)?;
37            Ok(SinApproxFtzF32 {
38                approx,
39                ftz,
40                f32,
41                d,
42                a,
43            })
44        }
45    }
46
47
48}
49