Skip to main content

ptx_parser/type/instruction/
rcp.rs

1//! Original PTX specification:
2//!
3//! rcp.approx{.ftz}.f32  d, a;  // fast, approximate reciprocal
4//! rcp.rnd{.ftz}.f32     d, a;  // IEEE 754 compliant rounding
5//! rcp.rnd.f64           d, a;  // IEEE 754 compliant rounding
6//! .rnd = { .rn, .rz, .rm, .rp };
7
8#![allow(unused)]
9use crate::r#type::common::*;
10
11pub mod section_0 {
12    use crate::Spanned;
13    use crate::parser::Span;
14    use crate::r#type::common::*;
15
16    use serde::Serialize;
17
18    #[derive(Debug, Clone, PartialEq, Serialize)]
19    pub enum Rnd {
20        Rn, // .rn
21        Rz, // .rz
22        Rm, // .rm
23        Rp, // .rp
24    }
25
26    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
27    pub struct RcpApproxFtzF32 {
28        pub approx: (),        // .approx
29        pub ftz: bool,         // {.ftz}
30        pub f32: (),           // .f32
31        pub d: GeneralOperand, // d
32        pub a: GeneralOperand, // a
33        pub span: Span,
34    }
35
36    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
37    pub struct RcpRndFtzF32 {
38        pub rnd: Rnd,          // .rnd
39        pub ftz: bool,         // {.ftz}
40        pub f32: (),           // .f32
41        pub d: GeneralOperand, // d
42        pub a: GeneralOperand, // a
43        pub span: Span,
44    }
45
46    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
47    pub struct RcpRndF64 {
48        pub rnd: Rnd,          // .rnd
49        pub f64: (),           // .f64
50        pub d: GeneralOperand, // d
51        pub a: GeneralOperand, // a
52        pub span: Span,
53    }
54}
55
56// Re-export types with section suffixes to avoid naming conflicts
57// e.g., Type0 for section_0::Type, Type1 for section_1::Type
58pub use section_0::RcpApproxFtzF32;
59pub use section_0::RcpRndF64;
60pub use section_0::RcpRndFtzF32;
61pub use section_0::Rnd as Rnd0;