ptx_parser/type/instruction/set.rs
1//! Original PTX specification:
2//!
3//! set.CmpOp{.ftz}.dtype.stype d, a, b;
4//! set.CmpOp.BoolOp{.ftz}.dtype.stype d, a, b, {!}c;
5//! .CmpOp = { .eq, .ne, .lt, .le, .gt, .ge, .lo, .ls, .hi, .hs,
6//! .equ, .neu, .ltu, .leu, .gtu, .geu, .num, .nan };
7//! .BoolOp = { .and, .or, .xor };
8//! .dtype = { .u32, .s32, .f32 };
9//! .stype = { .b16, .b32, .b64,
10//! .u16, .u32, .u64,
11//! .s16, .s32, .s64,
12//! .f32, .f64 };
13//! -------------------------------------------------------------
14//! set.CmpOp{.ftz}.f16.stype d, a, b;
15//! set.CmpOp.BoolOp{.ftz}.f16.stype d, a, b, {!}c;
16//! set.CmpOp.bf16.stype d, a, b;
17//! set.CmpOp.BoolOp.bf16.stype d, a, b, {!}c;
18//! set.CmpOp{.ftz}.dtype.f16 d, a, b;
19//! set.CmpOp.BoolOp{.ftz}.dtype.f16 d, a, b, {!}c;
20//! .dtype = { .u16, .s16, .u32, .s32};
21//! ----------------------------------------------------
22//! // Alternate floating point type:
23//! set.CmpOp.dtype.bf16 d, a, b;
24//! set.CmpOp.BoolOp.dtype.bf16 d, a, b, {!}c;
25//! .dtype = { .u16, .s16, .u32, .s32};
26//! ----------------------------------------------------
27//! // Alternate floating point type:
28//! set.CmpOp{.ftz}.dtype.f16x2 d, a, b;
29//! set.CmpOp.BoolOp{.ftz}.dtype.f16x2 d, a, b, {!}c;
30//! .dtype = { .f16x2, .u32, .s32};
31//! ----------------------------------------------------
32//! // Alternate floating point type:
33//! set.CmpOp.dtype.bf16x2 d, a, b;
34//! set.CmpOp.BoolOp.dtype.bf16x2 d, a, b, {!}c;
35//! .dtype = { .bf16x2, .u32, .s32};
36//! .CmpOp = { .eq, .ne, .lt, .le, .gt, .ge,
37//! .equ, .neu, .ltu, .leu, .gtu, .geu, .num, .nan };
38//! .BoolOp = { .and, .or, .xor };
39//! .stype = { .b16, .b32, .b64,
40//! .u16, .u32, .u64,
41//! .s16, .s32, .s64,
42//! .f16, .f32, .f64};
43
44#![allow(unused)]
45use crate::r#type::common::*;
46
47pub mod section_0 {
48 use crate::r#type::common::*;
49
50 #[derive(Debug, Clone, PartialEq)]
51 pub enum Cmpop {
52 Equ, // .equ
53 Neu, // .neu
54 Ltu, // .ltu
55 Leu, // .leu
56 Gtu, // .gtu
57 Geu, // .geu
58 Num, // .num
59 Nan, // .nan
60 Eq, // .eq
61 Ne, // .ne
62 Lt, // .lt
63 Le, // .le
64 Gt, // .gt
65 Ge, // .ge
66 Lo, // .lo
67 Ls, // .ls
68 Hi, // .hi
69 Hs, // .hs
70 }
71
72 #[derive(Debug, Clone, PartialEq)]
73 pub enum Dtype {
74 U32, // .u32
75 S32, // .s32
76 F32, // .f32
77 }
78
79 #[derive(Debug, Clone, PartialEq)]
80 pub enum Stype {
81 B16, // .b16
82 B32, // .b32
83 B64, // .b64
84 U16, // .u16
85 U32, // .u32
86 U64, // .u64
87 S16, // .s16
88 S32, // .s32
89 S64, // .s64
90 F32, // .f32
91 F64, // .f64
92 }
93
94 #[derive(Debug, Clone, PartialEq)]
95 pub enum Boolop {
96 And, // .and
97 Xor, // .xor
98 Or, // .or
99 }
100
101 #[derive(Debug, Clone, PartialEq)]
102 pub struct SetCmpopFtzDtypeStype {
103 pub cmpop: Cmpop, // .CmpOp
104 pub ftz: bool, // {.ftz}
105 pub dtype: Dtype, // .dtype
106 pub stype: Stype, // .stype
107 pub d: GeneralOperand, // d
108 pub a: GeneralOperand, // a
109 pub b: GeneralOperand, // b
110 }
111
112 #[derive(Debug, Clone, PartialEq)]
113 pub struct SetCmpopBoolopFtzDtypeStype {
114 pub cmpop: Cmpop, // .CmpOp
115 pub boolop: Boolop, // .BoolOp
116 pub ftz: bool, // {.ftz}
117 pub dtype: Dtype, // .dtype
118 pub stype: Stype, // .stype
119 pub d: GeneralOperand, // d
120 pub a: GeneralOperand, // a
121 pub b: GeneralOperand, // b
122 pub c_op: bool, // {!} operator
123 pub c: GeneralOperand, // {!}c
124 }
125}
126
127pub mod section_1 {
128 use crate::r#type::common::*;
129
130 #[derive(Debug, Clone, PartialEq)]
131 pub enum Cmpop {
132 Equ, // .equ
133 Neu, // .neu
134 Ltu, // .ltu
135 Leu, // .leu
136 Gtu, // .gtu
137 Geu, // .geu
138 Num, // .num
139 Nan, // .nan
140 Eq, // .eq
141 Ne, // .ne
142 Lt, // .lt
143 Le, // .le
144 Gt, // .gt
145 Ge, // .ge
146 Lo, // .lo
147 Ls, // .ls
148 Hi, // .hi
149 Hs, // .hs
150 }
151
152 #[derive(Debug, Clone, PartialEq)]
153 pub enum Stype {
154 B16, // .b16
155 B32, // .b32
156 B64, // .b64
157 U16, // .u16
158 U32, // .u32
159 U64, // .u64
160 S16, // .s16
161 S32, // .s32
162 S64, // .s64
163 F32, // .f32
164 F64, // .f64
165 }
166
167 #[derive(Debug, Clone, PartialEq)]
168 pub enum Boolop {
169 And, // .and
170 Xor, // .xor
171 Or, // .or
172 }
173
174 #[derive(Debug, Clone, PartialEq)]
175 pub enum Dtype {
176 U16, // .u16
177 S16, // .s16
178 U32, // .u32
179 S32, // .s32
180 }
181
182 #[derive(Debug, Clone, PartialEq)]
183 pub struct SetCmpopFtzF16Stype {
184 pub cmpop: Cmpop, // .CmpOp
185 pub ftz: bool, // {.ftz}
186 pub f16: (), // .f16
187 pub stype: Stype, // .stype
188 pub d: GeneralOperand, // d
189 pub a: GeneralOperand, // a
190 pub b: GeneralOperand, // b
191 }
192
193 #[derive(Debug, Clone, PartialEq)]
194 pub struct SetCmpopBoolopFtzF16Stype {
195 pub cmpop: Cmpop, // .CmpOp
196 pub boolop: Boolop, // .BoolOp
197 pub ftz: bool, // {.ftz}
198 pub f16: (), // .f16
199 pub stype: Stype, // .stype
200 pub d: GeneralOperand, // d
201 pub a: GeneralOperand, // a
202 pub b: GeneralOperand, // b
203 pub c_op: bool, // {!} operator
204 pub c: GeneralOperand, // {!}c
205 }
206
207 #[derive(Debug, Clone, PartialEq)]
208 pub struct SetCmpopBf16Stype {
209 pub cmpop: Cmpop, // .CmpOp
210 pub bf16: (), // .bf16
211 pub stype: Stype, // .stype
212 pub d: GeneralOperand, // d
213 pub a: GeneralOperand, // a
214 pub b: GeneralOperand, // b
215 }
216
217 #[derive(Debug, Clone, PartialEq)]
218 pub struct SetCmpopBoolopBf16Stype {
219 pub cmpop: Cmpop, // .CmpOp
220 pub boolop: Boolop, // .BoolOp
221 pub bf16: (), // .bf16
222 pub stype: Stype, // .stype
223 pub d: GeneralOperand, // d
224 pub a: GeneralOperand, // a
225 pub b: GeneralOperand, // b
226 pub c_op: bool, // {!} operator
227 pub c: GeneralOperand, // {!}c
228 }
229
230 #[derive(Debug, Clone, PartialEq)]
231 pub struct SetCmpopFtzDtypeF16 {
232 pub cmpop: Cmpop, // .CmpOp
233 pub ftz: bool, // {.ftz}
234 pub dtype: Dtype, // .dtype
235 pub f16: (), // .f16
236 pub d: GeneralOperand, // d
237 pub a: GeneralOperand, // a
238 pub b: GeneralOperand, // b
239 }
240
241 #[derive(Debug, Clone, PartialEq)]
242 pub struct SetCmpopBoolopFtzDtypeF16 {
243 pub cmpop: Cmpop, // .CmpOp
244 pub boolop: Boolop, // .BoolOp
245 pub ftz: bool, // {.ftz}
246 pub dtype: Dtype, // .dtype
247 pub f16: (), // .f16
248 pub d: GeneralOperand, // d
249 pub a: GeneralOperand, // a
250 pub b: GeneralOperand, // b
251 pub c_op: bool, // {!} operator
252 pub c: GeneralOperand, // {!}c
253 }
254}
255
256pub mod section_2 {
257 use crate::r#type::common::*;
258
259 #[derive(Debug, Clone, PartialEq)]
260 pub enum Cmpop {
261 Equ, // .equ
262 Neu, // .neu
263 Ltu, // .ltu
264 Leu, // .leu
265 Gtu, // .gtu
266 Geu, // .geu
267 Num, // .num
268 Nan, // .nan
269 Eq, // .eq
270 Ne, // .ne
271 Lt, // .lt
272 Le, // .le
273 Gt, // .gt
274 Ge, // .ge
275 Lo, // .lo
276 Ls, // .ls
277 Hi, // .hi
278 Hs, // .hs
279 }
280
281 #[derive(Debug, Clone, PartialEq)]
282 pub enum Dtype {
283 U16, // .u16
284 S16, // .s16
285 U32, // .u32
286 S32, // .s32
287 }
288
289 #[derive(Debug, Clone, PartialEq)]
290 pub enum Boolop {
291 And, // .and
292 Xor, // .xor
293 Or, // .or
294 }
295
296 #[derive(Debug, Clone, PartialEq)]
297 pub struct SetCmpopDtypeBf16 {
298 pub cmpop: Cmpop, // .CmpOp
299 pub dtype: Dtype, // .dtype
300 pub bf16: (), // .bf16
301 pub d: GeneralOperand, // d
302 pub a: GeneralOperand, // a
303 pub b: GeneralOperand, // b
304 }
305
306 #[derive(Debug, Clone, PartialEq)]
307 pub struct SetCmpopBoolopDtypeBf16 {
308 pub cmpop: Cmpop, // .CmpOp
309 pub boolop: Boolop, // .BoolOp
310 pub dtype: Dtype, // .dtype
311 pub bf16: (), // .bf16
312 pub d: GeneralOperand, // d
313 pub a: GeneralOperand, // a
314 pub b: GeneralOperand, // b
315 pub c_op: bool, // {!} operator
316 pub c: GeneralOperand, // {!}c
317 }
318}
319
320pub mod section_3 {
321 use crate::r#type::common::*;
322
323 #[derive(Debug, Clone, PartialEq)]
324 pub enum Cmpop {
325 Equ, // .equ
326 Neu, // .neu
327 Ltu, // .ltu
328 Leu, // .leu
329 Gtu, // .gtu
330 Geu, // .geu
331 Num, // .num
332 Nan, // .nan
333 Eq, // .eq
334 Ne, // .ne
335 Lt, // .lt
336 Le, // .le
337 Gt, // .gt
338 Ge, // .ge
339 Lo, // .lo
340 Ls, // .ls
341 Hi, // .hi
342 Hs, // .hs
343 }
344
345 #[derive(Debug, Clone, PartialEq)]
346 pub enum Dtype {
347 F16x2, // .f16x2
348 U32, // .u32
349 S32, // .s32
350 }
351
352 #[derive(Debug, Clone, PartialEq)]
353 pub enum Boolop {
354 And, // .and
355 Xor, // .xor
356 Or, // .or
357 }
358
359 #[derive(Debug, Clone, PartialEq)]
360 pub struct SetCmpopFtzDtypeF16x2 {
361 pub cmpop: Cmpop, // .CmpOp
362 pub ftz: bool, // {.ftz}
363 pub dtype: Dtype, // .dtype
364 pub f16x2: (), // .f16x2
365 pub d: GeneralOperand, // d
366 pub a: GeneralOperand, // a
367 pub b: GeneralOperand, // b
368 }
369
370 #[derive(Debug, Clone, PartialEq)]
371 pub struct SetCmpopBoolopFtzDtypeF16x2 {
372 pub cmpop: Cmpop, // .CmpOp
373 pub boolop: Boolop, // .BoolOp
374 pub ftz: bool, // {.ftz}
375 pub dtype: Dtype, // .dtype
376 pub f16x2: (), // .f16x2
377 pub d: GeneralOperand, // d
378 pub a: GeneralOperand, // a
379 pub b: GeneralOperand, // b
380 pub c_op: bool, // {!} operator
381 pub c: GeneralOperand, // {!}c
382 }
383}
384
385pub mod section_4 {
386 use crate::r#type::common::*;
387
388 #[derive(Debug, Clone, PartialEq)]
389 pub enum Cmpop {
390 Equ, // .equ
391 Neu, // .neu
392 Ltu, // .ltu
393 Leu, // .leu
394 Gtu, // .gtu
395 Geu, // .geu
396 Num, // .num
397 Nan, // .nan
398 Eq, // .eq
399 Ne, // .ne
400 Lt, // .lt
401 Le, // .le
402 Gt, // .gt
403 Ge, // .ge
404 }
405
406 #[derive(Debug, Clone, PartialEq)]
407 pub enum Dtype {
408 Bf16x2, // .bf16x2
409 U32, // .u32
410 S32, // .s32
411 }
412
413 #[derive(Debug, Clone, PartialEq)]
414 pub enum Boolop {
415 And, // .and
416 Xor, // .xor
417 Or, // .or
418 }
419
420 #[derive(Debug, Clone, PartialEq)]
421 pub struct SetCmpopDtypeBf16x2 {
422 pub cmpop: Cmpop, // .CmpOp
423 pub dtype: Dtype, // .dtype
424 pub bf16x2: (), // .bf16x2
425 pub d: GeneralOperand, // d
426 pub a: GeneralOperand, // a
427 pub b: GeneralOperand, // b
428 }
429
430 #[derive(Debug, Clone, PartialEq)]
431 pub struct SetCmpopBoolopDtypeBf16x2 {
432 pub cmpop: Cmpop, // .CmpOp
433 pub boolop: Boolop, // .BoolOp
434 pub dtype: Dtype, // .dtype
435 pub bf16x2: (), // .bf16x2
436 pub d: GeneralOperand, // d
437 pub a: GeneralOperand, // a
438 pub b: GeneralOperand, // b
439 pub c_op: bool, // {!} operator
440 pub c: GeneralOperand, // {!}c
441 }
442}
443
444// Re-export types with section suffixes to avoid naming conflicts
445// e.g., Type0 for section_0::Type, Type1 for section_1::Type
446pub use section_0::Boolop as Boolop0;
447pub use section_0::Cmpop as Cmpop0;
448pub use section_0::Dtype as Dtype0;
449pub use section_0::SetCmpopBoolopFtzDtypeStype;
450pub use section_0::SetCmpopFtzDtypeStype;
451pub use section_0::Stype as Stype0;
452pub use section_1::Boolop as Boolop1;
453pub use section_1::Cmpop as Cmpop1;
454pub use section_1::Dtype as Dtype1;
455pub use section_1::SetCmpopBf16Stype;
456pub use section_1::SetCmpopBoolopBf16Stype;
457pub use section_1::SetCmpopBoolopFtzDtypeF16;
458pub use section_1::SetCmpopBoolopFtzF16Stype;
459pub use section_1::SetCmpopFtzDtypeF16;
460pub use section_1::SetCmpopFtzF16Stype;
461pub use section_1::Stype as Stype1;
462pub use section_2::Boolop as Boolop2;
463pub use section_2::Cmpop as Cmpop2;
464pub use section_2::Dtype as Dtype2;
465pub use section_2::SetCmpopBoolopDtypeBf16;
466pub use section_2::SetCmpopDtypeBf16;
467pub use section_3::Boolop as Boolop3;
468pub use section_3::Cmpop as Cmpop3;
469pub use section_3::Dtype as Dtype3;
470pub use section_3::SetCmpopBoolopFtzDtypeF16x2;
471pub use section_3::SetCmpopFtzDtypeF16x2;
472pub use section_4::Boolop as Boolop4;
473pub use section_4::Cmpop as Cmpop4;
474pub use section_4::Dtype as Dtype4;
475pub use section_4::SetCmpopBoolopDtypeBf16x2;
476pub use section_4::SetCmpopDtypeBf16x2;