Skip to main content

ptx_parser/type/instruction/
slct.rs

1//! Original PTX specification:
2//!
3//! slct.dtype.s32        d, a, b, c;
4//! slct{.ftz}.dtype.f32  d, a, b, c;
5//! .dtype = { .b16, .b32, .b64,
6//! .u16, .u32, .u64,
7//! .s16, .s32, .s64,
8//! .f32, .f64 };
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 Dtype {
22        B16, // .b16
23        B32, // .b32
24        B64, // .b64
25        U16, // .u16
26        U32, // .u32
27        U64, // .u64
28        S16, // .s16
29        S32, // .s32
30        S64, // .s64
31        F32, // .f32
32        F64, // .f64
33    }
34
35    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
36    pub struct SlctDtypeS32 {
37        pub dtype: Dtype,      // .dtype
38        pub s32: (),           // .s32
39        pub d: GeneralOperand, // d
40        pub a: GeneralOperand, // a
41        pub b: GeneralOperand, // b
42        pub c: GeneralOperand, // c
43        pub span: Span,
44    }
45
46    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
47    pub struct SlctFtzDtypeF32 {
48        pub ftz: bool,         // {.ftz}
49        pub dtype: Dtype,      // .dtype
50        pub f32: (),           // .f32
51        pub d: GeneralOperand, // d
52        pub a: GeneralOperand, // a
53        pub b: GeneralOperand, // b
54        pub c: GeneralOperand, // c
55        pub span: Span,
56    }
57}
58
59// Re-export types with section suffixes to avoid naming conflicts
60// e.g., Type0 for section_0::Type, Type1 for section_1::Type
61pub use section_0::Dtype as Dtype0;
62pub use section_0::SlctDtypeS32;
63pub use section_0::SlctFtzDtypeF32;