ptx_parser/unparser/instruction/
tld4.rs

1//! Original PTX specification:
2//!
3//! tld4.comp.2d.v4.dtype.f32    d{|p}, [a, c] {, e} {, f};
4//! tld4.comp.geom.v4.dtype.f32  d{|p}, [a, b, c] {, e} {, f};  // explicit sampler
5//! .comp  = { .r, .g, .b, .a };
6//! .geom  = { .2d, .a2d, .cube, .acube };
7//! .dtype = { .u32, .s32, .f32 };
8
9#![allow(unused)]
10
11use crate::lexer::PtxToken;
12use crate::unparser::{PtxUnparser, common::*};
13
14pub mod section_0 {
15    use super::*;
16    use crate::r#type::instruction::tld4::section_0::*;
17
18    impl PtxUnparser for Tld4Comp2dV4DtypeF32 {
19        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
20            push_opcode(tokens, "tld4");
21                    match &self.comp {
22                            Comp::R => {
23                                    push_directive(tokens, "r");
24                            }
25                            Comp::G => {
26                                    push_directive(tokens, "g");
27                            }
28                            Comp::B => {
29                                    push_directive(tokens, "b");
30                            }
31                            Comp::A => {
32                                    push_directive(tokens, "a");
33                            }
34                    }
35                    push_directive(tokens, "2d");
36                    push_directive(tokens, "v4");
37                    match &self.dtype {
38                            Dtype::U32 => {
39                                    push_directive(tokens, "u32");
40                            }
41                            Dtype::S32 => {
42                                    push_directive(tokens, "s32");
43                            }
44                            Dtype::F32 => {
45                                    push_directive(tokens, "f32");
46                            }
47                    }
48                    push_directive(tokens, "f32");
49                    self.d.unparse_tokens(tokens);
50                    if let Some(p_0) = self.p.as_ref() {
51                        tokens.push(PtxToken::Pipe);
52                        p_0.unparse_tokens(tokens);
53                    }
54            tokens.push(PtxToken::Comma);
55                    self.a.unparse_tokens(tokens);
56            if self.e.is_some() { tokens.push(PtxToken::Comma); }
57                    if let Some(opt_1) = self.e.as_ref() {
58                        opt_1.unparse_tokens(tokens);
59                    }
60            if self.f.is_some() { tokens.push(PtxToken::Comma); }
61                    if let Some(opt_2) = self.f.as_ref() {
62                        opt_2.unparse_tokens(tokens);
63                    }
64            tokens.push(PtxToken::Semicolon);
65        }
66    }
67
68    impl PtxUnparser for Tld4CompGeomV4DtypeF32 {
69        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
70            push_opcode(tokens, "tld4");
71                    match &self.comp {
72                            Comp::R => {
73                                    push_directive(tokens, "r");
74                            }
75                            Comp::G => {
76                                    push_directive(tokens, "g");
77                            }
78                            Comp::B => {
79                                    push_directive(tokens, "b");
80                            }
81                            Comp::A => {
82                                    push_directive(tokens, "a");
83                            }
84                    }
85                    match &self.geom {
86                            Geom::Acube => {
87                                    push_directive(tokens, "acube");
88                            }
89                            Geom::Cube => {
90                                    push_directive(tokens, "cube");
91                            }
92                            Geom::A2d => {
93                                    push_directive(tokens, "a2d");
94                            }
95                            Geom::_2d => {
96                                    push_directive(tokens, "2d");
97                            }
98                    }
99                    push_directive(tokens, "v4");
100                    match &self.dtype {
101                            Dtype::U32 => {
102                                    push_directive(tokens, "u32");
103                            }
104                            Dtype::S32 => {
105                                    push_directive(tokens, "s32");
106                            }
107                            Dtype::F32 => {
108                                    push_directive(tokens, "f32");
109                            }
110                    }
111                    push_directive(tokens, "f32");
112                    self.d.unparse_tokens(tokens);
113                    if let Some(p_3) = self.p.as_ref() {
114                        tokens.push(PtxToken::Pipe);
115                        p_3.unparse_tokens(tokens);
116                    }
117            tokens.push(PtxToken::Comma);
118                    self.a.unparse_tokens(tokens);
119            if self.e.is_some() { tokens.push(PtxToken::Comma); }
120                    if let Some(opt_4) = self.e.as_ref() {
121                        opt_4.unparse_tokens(tokens);
122                    }
123            if self.f.is_some() { tokens.push(PtxToken::Comma); }
124                    if let Some(opt_5) = self.f.as_ref() {
125                        opt_5.unparse_tokens(tokens);
126                    }
127            tokens.push(PtxToken::Semicolon);
128        }
129    }
130
131}
132