Skip to main content

ptx_parser/type/instruction/
min.rs

1//! Original PTX specification:
2//!
3//! min.atype         d, a, b;
4//! min{.relu}.btype  d, a, b;
5//! .atype = { .u16, .u32, .u64, .u16x2, .s16, .s64 };
6//! .btype = { .s16x2, .s32 };
7//!
8//! min{.ftz}{.NaN}{.xorsign.abs}.f32  d, a, b;
9//! min{.ftz}{.NaN}{.abs}.f32          d, a, b, c;
10//! min.f64                            d, a, b;
11//!
12//! min{.ftz}{.NaN}{.xorsign.abs}.f16      d, a, b;
13//! min{.ftz}{.NaN}{.xorsign.abs}.f16x2    d, a, b;
14//! min{.NaN}{.xorsign.abs}.bf16           d, a, b;
15//! min{.NaN}{.xorsign.abs}.bf16x2         d, a, b;
16
17#![allow(unused)]
18use crate::r#type::common::*;
19
20pub mod section_0 {
21    use crate::Spanned;
22    use crate::parser::Span;
23    use crate::r#type::common::*;
24
25    use serde::Serialize;
26
27    #[derive(Debug, Clone, PartialEq, Serialize)]
28    pub enum Atype {
29        U16x2, // .u16x2
30        U16,   // .u16
31        U32,   // .u32
32        U64,   // .u64
33        S16,   // .s16
34        S64,   // .s64
35    }
36
37    #[derive(Debug, Clone, PartialEq, Serialize)]
38    pub enum Btype {
39        S16x2, // .s16x2
40        S32,   // .s32
41    }
42
43    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
44    pub struct MinAtype {
45        pub atype: Atype,      // .atype
46        pub d: GeneralOperand, // d
47        pub a: GeneralOperand, // a
48        pub b: GeneralOperand, // b
49        pub span: Span,
50    }
51
52    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
53    pub struct MinReluBtype {
54        pub relu: bool,        // {.relu}
55        pub btype: Btype,      // .btype
56        pub d: GeneralOperand, // d
57        pub a: GeneralOperand, // a
58        pub b: GeneralOperand, // b
59        pub span: Span,
60    }
61
62    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
63    pub struct MinFtzNanXorsignAbsF32 {
64        pub ftz: bool,         // {.ftz}
65        pub nan: bool,         // {.NaN}
66        pub xorsign_abs: bool, // {.xorsign.abs}
67        pub f32: (),           // .f32
68        pub d: GeneralOperand, // d
69        pub a: GeneralOperand, // a
70        pub b: GeneralOperand, // b
71        pub span: Span,
72    }
73
74    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
75    pub struct MinFtzNanAbsF32 {
76        pub ftz: bool,         // {.ftz}
77        pub nan: bool,         // {.NaN}
78        pub abs: bool,         // {.abs}
79        pub f32: (),           // .f32
80        pub d: GeneralOperand, // d
81        pub a: GeneralOperand, // a
82        pub b: GeneralOperand, // b
83        pub c: GeneralOperand, // c
84        pub span: Span,
85    }
86
87    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
88    pub struct MinF64 {
89        pub f64: (),           // .f64
90        pub d: GeneralOperand, // d
91        pub a: GeneralOperand, // a
92        pub b: GeneralOperand, // b
93        pub span: Span,
94    }
95
96    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
97    pub struct MinFtzNanXorsignAbsF16 {
98        pub ftz: bool,         // {.ftz}
99        pub nan: bool,         // {.NaN}
100        pub xorsign_abs: bool, // {.xorsign.abs}
101        pub f16: (),           // .f16
102        pub d: GeneralOperand, // d
103        pub a: GeneralOperand, // a
104        pub b: GeneralOperand, // b
105        pub span: Span,
106    }
107
108    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
109    pub struct MinFtzNanXorsignAbsF16x2 {
110        pub ftz: bool,         // {.ftz}
111        pub nan: bool,         // {.NaN}
112        pub xorsign_abs: bool, // {.xorsign.abs}
113        pub f16x2: (),         // .f16x2
114        pub d: GeneralOperand, // d
115        pub a: GeneralOperand, // a
116        pub b: GeneralOperand, // b
117        pub span: Span,
118    }
119
120    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
121    pub struct MinNanXorsignAbsBf16 {
122        pub nan: bool,         // {.NaN}
123        pub xorsign_abs: bool, // {.xorsign.abs}
124        pub bf16: (),          // .bf16
125        pub d: GeneralOperand, // d
126        pub a: GeneralOperand, // a
127        pub b: GeneralOperand, // b
128        pub span: Span,
129    }
130
131    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
132    pub struct MinNanXorsignAbsBf16x2 {
133        pub nan: bool,         // {.NaN}
134        pub xorsign_abs: bool, // {.xorsign.abs}
135        pub bf16x2: (),        // .bf16x2
136        pub d: GeneralOperand, // d
137        pub a: GeneralOperand, // a
138        pub b: GeneralOperand, // b
139        pub span: Span,
140    }
141}
142
143// Re-export types with section suffixes to avoid naming conflicts
144// e.g., Type0 for section_0::Type, Type1 for section_1::Type
145pub use section_0::Atype as Atype0;
146pub use section_0::Btype as Btype0;
147pub use section_0::MinAtype;
148pub use section_0::MinF64;
149pub use section_0::MinFtzNanAbsF32;
150pub use section_0::MinFtzNanXorsignAbsF16;
151pub use section_0::MinFtzNanXorsignAbsF16x2;
152pub use section_0::MinFtzNanXorsignAbsF32;
153pub use section_0::MinNanXorsignAbsBf16;
154pub use section_0::MinNanXorsignAbsBf16x2;
155pub use section_0::MinReluBtype;