Skip to main content

ptx_parser/type/instruction/
neg.rs

1//! Original PTX specification:
2//!
3//! neg.type  d, a;
4//! .type = { .s16, .s32, .s64 };
5//!
6//! neg{.ftz}.f32  d, a;
7//! neg.f64        d, a;
8//!
9//! neg{.ftz}.f16    d, a;
10//! neg{.ftz}.f16x2  d, a;
11//! neg.bf16         d, a;
12//! neg.bf16x2       d, a;
13
14#![allow(unused)]
15use crate::r#type::common::*;
16
17pub mod section_0 {
18    use crate::Spanned;
19    use crate::parser::Span;
20    use crate::r#type::common::*;
21
22    use serde::Serialize;
23
24    #[derive(Debug, Clone, PartialEq, Serialize)]
25    pub enum Type {
26        S16, // .s16
27        S32, // .s32
28        S64, // .s64
29    }
30
31    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
32    pub struct NegType {
33        pub type_: Type,       // .type
34        pub d: GeneralOperand, // d
35        pub a: GeneralOperand, // a
36        pub span: Span,
37    }
38
39    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
40    pub struct NegFtzF32 {
41        pub ftz: bool,         // {.ftz}
42        pub f32: (),           // .f32
43        pub d: GeneralOperand, // d
44        pub a: GeneralOperand, // a
45        pub span: Span,
46    }
47
48    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
49    pub struct NegF64 {
50        pub f64: (),           // .f64
51        pub d: GeneralOperand, // d
52        pub a: GeneralOperand, // a
53        pub span: Span,
54    }
55
56    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
57    pub struct NegFtzF16 {
58        pub ftz: bool,         // {.ftz}
59        pub f16: (),           // .f16
60        pub d: GeneralOperand, // d
61        pub a: GeneralOperand, // a
62        pub span: Span,
63    }
64
65    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
66    pub struct NegFtzF16x2 {
67        pub ftz: bool,         // {.ftz}
68        pub f16x2: (),         // .f16x2
69        pub d: GeneralOperand, // d
70        pub a: GeneralOperand, // a
71        pub span: Span,
72    }
73
74    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
75    pub struct NegBf16 {
76        pub bf16: (),          // .bf16
77        pub d: GeneralOperand, // d
78        pub a: GeneralOperand, // a
79        pub span: Span,
80    }
81
82    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
83    pub struct NegBf16x2 {
84        pub bf16x2: (),        // .bf16x2
85        pub d: GeneralOperand, // d
86        pub a: GeneralOperand, // a
87        pub span: Span,
88    }
89}
90
91// Re-export types with section suffixes to avoid naming conflicts
92// e.g., Type0 for section_0::Type, Type1 for section_1::Type
93pub use section_0::NegBf16;
94pub use section_0::NegBf16x2;
95pub use section_0::NegF64;
96pub use section_0::NegFtzF16;
97pub use section_0::NegFtzF16x2;
98pub use section_0::NegFtzF32;
99pub use section_0::NegType;
100pub use section_0::Type as Type0;