Skip to main content

ptx_parser/type/instruction/
suld.rs

1//! Original PTX specification:
2//!
3//! suld.b.geom{.cop}.vec.dtype{.mode}  d, [a, b];  // unformatted
4//!
5//! .geom  = { .1d, .2d, .3d, .a1d, .a2d };
6//! .cop   = { .ca, .cg, .cs, .cv };               // cache operation
7//! .vec   = { none, .v2, .v4 };
8//! .dtype = { .b8 , .b16, .b32, .b64 };
9//! .mode = { .trap, .clamp, .zero };
10
11#![allow(unused)]
12use crate::r#type::common::*;
13
14pub mod section_0 {
15    use crate::Spanned;
16    use crate::parser::Span;
17    use crate::r#type::common::*;
18
19    use serde::Serialize;
20
21    #[derive(Debug, Clone, PartialEq, Serialize)]
22    pub enum Geom {
23        A1d, // .a1d
24        A2d, // .a2d
25        _1d, // .1d
26        _2d, // .2d
27        _3d, // .3d
28    }
29
30    #[derive(Debug, Clone, PartialEq, Serialize)]
31    pub enum Cop {
32        Ca, // .ca
33        Cg, // .cg
34        Cs, // .cs
35        Cv, // .cv
36    }
37
38    #[derive(Debug, Clone, PartialEq, Serialize)]
39    pub enum Vec {
40        None, // none
41        V2,   // .v2
42        V4,   // .v4
43    }
44
45    #[derive(Debug, Clone, PartialEq, Serialize)]
46    pub enum Dtype {
47        B16, // .b16
48        B32, // .b32
49        B64, // .b64
50        B8,  // .b8
51    }
52
53    #[derive(Debug, Clone, PartialEq, Serialize)]
54    pub enum Mode {
55        Clamp, // .clamp
56        Trap,  // .trap
57        Zero,  // .zero
58    }
59
60    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
61    pub struct SuldBGeomCopVecDtypeMode {
62        pub b: (),              // .b
63        pub geom: Geom,         // .geom
64        pub cop: Option<Cop>,   // {.cop}
65        pub vec: Vec,           // .vec
66        pub dtype: Dtype,       // .dtype
67        pub mode: Option<Mode>, // {.mode}
68        pub d: GeneralOperand,  // d
69        pub a: TexHandler2,     // [a, b]
70        pub span: Span,
71    }
72}
73
74// Re-export types with section suffixes to avoid naming conflicts
75// e.g., Type0 for section_0::Type, Type1 for section_1::Type
76pub use section_0::Cop as Cop0;
77pub use section_0::Dtype as Dtype0;
78pub use section_0::Geom as Geom0;
79pub use section_0::Mode as Mode0;
80pub use section_0::SuldBGeomCopVecDtypeMode;
81pub use section_0::Vec as Vec0;