Skip to main content

ptx_parser/type/instruction/
ex2.rs

1//! Original PTX specification:
2//!
3//! ex2.approx{.ftz}.f32  d, a;
4//!
5//! ex2.approx.atype     d, a;
6//! ex2.approx.ftz.btype d, a;
7//! .atype = { .f16,  .f16x2};
8//! .btype = { .bf16, .bf16x2};
9
10#![allow(unused)]
11use crate::r#type::common::*;
12
13pub mod section_0 {
14    use crate::Spanned;
15    use crate::parser::Span;
16    use crate::r#type::common::*;
17
18    use serde::Serialize;
19
20    #[derive(Debug, Clone, PartialEq, Serialize)]
21    pub enum Atype {
22        F16x2, // .f16x2
23        F16,   // .f16
24    }
25
26    #[derive(Debug, Clone, PartialEq, Serialize)]
27    pub enum Btype {
28        Bf16x2, // .bf16x2
29        Bf16,   // .bf16
30    }
31
32    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
33    pub struct Ex2ApproxFtzF32 {
34        pub approx: (),        // .approx
35        pub ftz: bool,         // {.ftz}
36        pub f32: (),           // .f32
37        pub d: GeneralOperand, // d
38        pub a: GeneralOperand, // a
39        pub span: Span,
40    }
41
42    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
43    pub struct Ex2ApproxAtype {
44        pub approx: (),        // .approx
45        pub atype: Atype,      // .atype
46        pub d: GeneralOperand, // d
47        pub a: GeneralOperand, // a
48        pub span: Span,
49    }
50
51    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
52    pub struct Ex2ApproxFtzBtype {
53        pub approx: (),        // .approx
54        pub ftz: (),           // .ftz
55        pub btype: Btype,      // .btype
56        pub d: GeneralOperand, // d
57        pub a: GeneralOperand, // a
58        pub span: Span,
59    }
60}
61
62// Re-export types with section suffixes to avoid naming conflicts
63// e.g., Type0 for section_0::Type, Type1 for section_1::Type
64pub use section_0::Atype as Atype0;
65pub use section_0::Btype as Btype0;
66pub use section_0::Ex2ApproxAtype;
67pub use section_0::Ex2ApproxFtzBtype;
68pub use section_0::Ex2ApproxFtzF32;