Skip to main content

ptx_parser/unparser/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::unparser::{PtxUnparser, common::*};
9
10pub mod section_0 {
11    use super::*;
12    use crate::r#type::instruction::sin::section_0::*;
13
14    impl PtxUnparser for SinApproxFtzF32 {
15        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
16            self.unparse_tokens_mode(tokens, false);
17        }
18        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
19            push_opcode(tokens, "sin");
20            push_directive(tokens, "approx");
21            if self.ftz {
22                push_directive(tokens, "ftz");
23            }
24            push_directive(tokens, "f32");
25            if spaced {
26                tokens.push(PtxToken::Space);
27            }
28            self.d.unparse_tokens_mode(tokens, spaced);
29            tokens.push(PtxToken::Comma);
30            if spaced {
31                tokens.push(PtxToken::Space);
32            }
33            self.a.unparse_tokens_mode(tokens, spaced);
34            tokens.push(PtxToken::Semicolon);
35            if spaced {
36                tokens.push(PtxToken::Newline);
37            }
38        }
39    }
40}