Skip to main content

ptx_parser/type/instruction/
ldu.rs

1//! Original PTX specification:
2//!
3//! ldu{.ss}.type      d, [a];       // load from address
4//! ldu{.ss}.vec.type  d, [a];       // vec load from address
5//! .ss   = { .global };             // state space
6//! .vec  = { .v2, .v4 };
7//! .type = { .b8, .b16, .b32, .b64, .b128,
8//! .u8, .u16, .u32, .u64,
9//! .s8, .s16, .s32, .s64,
10//! .f32, .f64 };
11
12#![allow(unused)]
13use crate::r#type::common::*;
14
15pub mod section_0 {
16    use crate::Spanned;
17    use crate::parser::Span;
18    use crate::r#type::common::*;
19
20    use serde::Serialize;
21
22    #[derive(Debug, Clone, PartialEq, Serialize)]
23    pub enum Ss {
24        Global, // .global
25    }
26
27    #[derive(Debug, Clone, PartialEq, Serialize)]
28    pub enum Type {
29        B128, // .b128
30        B16,  // .b16
31        B32,  // .b32
32        B64,  // .b64
33        U16,  // .u16
34        U32,  // .u32
35        U64,  // .u64
36        S16,  // .s16
37        S32,  // .s32
38        S64,  // .s64
39        F32,  // .f32
40        F64,  // .f64
41        B8,   // .b8
42        U8,   // .u8
43        S8,   // .s8
44    }
45
46    #[derive(Debug, Clone, PartialEq, Serialize)]
47    pub enum Vec {
48        V2, // .v2
49        V4, // .v4
50    }
51
52    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
53    pub struct LduSsType {
54        pub ss: Option<Ss>,    // {.ss}
55        pub type_: Type,       // .type
56        pub d: GeneralOperand, // d
57        pub a: AddressOperand, // [a]
58        pub span: Span,
59    }
60
61    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
62    pub struct LduSsVecType {
63        pub ss: Option<Ss>,    // {.ss}
64        pub vec: Vec,          // .vec
65        pub type_: Type,       // .type
66        pub d: GeneralOperand, // d
67        pub a: AddressOperand, // [a]
68        pub span: Span,
69    }
70}
71
72// Re-export types with section suffixes to avoid naming conflicts
73// e.g., Type0 for section_0::Type, Type1 for section_1::Type
74pub use section_0::LduSsType;
75pub use section_0::LduSsVecType;
76pub use section_0::Ss as Ss0;
77pub use section_0::Type as Type0;
78pub use section_0::Vec as Vec0;