ptx_parser/unparser/instruction/
selp.rs

1//! Original PTX specification:
2//!
3//! selp.type d, a, b, c;
4//! .type = { .b16, .b32, .b64,
5//! .u16, .u32, .u64,
6//! .s16, .s32, .s64,
7//! .f32, .f64 };
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::selp::section_0::*;
17
18    impl PtxUnparser for SelpType {
19        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
20            push_opcode(tokens, "selp");
21            match &self.type_ {
22                Type::B16 => {
23                    push_directive(tokens, "b16");
24                }
25                Type::B32 => {
26                    push_directive(tokens, "b32");
27                }
28                Type::B64 => {
29                    push_directive(tokens, "b64");
30                }
31                Type::U16 => {
32                    push_directive(tokens, "u16");
33                }
34                Type::U32 => {
35                    push_directive(tokens, "u32");
36                }
37                Type::U64 => {
38                    push_directive(tokens, "u64");
39                }
40                Type::S16 => {
41                    push_directive(tokens, "s16");
42                }
43                Type::S32 => {
44                    push_directive(tokens, "s32");
45                }
46                Type::S64 => {
47                    push_directive(tokens, "s64");
48                }
49                Type::F32 => {
50                    push_directive(tokens, "f32");
51                }
52                Type::F64 => {
53                    push_directive(tokens, "f64");
54                }
55            }
56            self.d.unparse_tokens(tokens);
57            tokens.push(PtxToken::Comma);
58            self.a.unparse_tokens(tokens);
59            tokens.push(PtxToken::Comma);
60            self.b.unparse_tokens(tokens);
61            tokens.push(PtxToken::Comma);
62            self.c.unparse_tokens(tokens);
63            tokens.push(PtxToken::Semicolon);
64        }
65    }
66}