ptx_parser/parser/instruction/
selp.rs1#![allow(unused)]
10
11use crate::parser::{
12 PtxParseError, PtxParser, PtxTokenStream, Span,
13 util::{
14 between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
15 pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
16 },
17};
18use crate::r#type::common::*;
19use crate::{alt, ok, seq_n};
20
21pub mod section_0 {
22 use super::*;
23 use crate::r#type::instruction::selp::section_0::*;
24
25 impl PtxParser for Type {
30 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
31 alt!(
32 map(string_p(".b16"), |_, _span| Type::B16),
33 map(string_p(".b32"), |_, _span| Type::B32),
34 map(string_p(".b64"), |_, _span| Type::B64),
35 map(string_p(".u16"), |_, _span| Type::U16),
36 map(string_p(".u32"), |_, _span| Type::U32),
37 map(string_p(".u64"), |_, _span| Type::U64),
38 map(string_p(".s16"), |_, _span| Type::S16),
39 map(string_p(".s32"), |_, _span| Type::S32),
40 map(string_p(".s64"), |_, _span| Type::S64),
41 map(string_p(".f32"), |_, _span| Type::F32),
42 map(string_p(".f64"), |_, _span| Type::F64)
43 )
44 }
45 }
46
47 impl PtxParser for SelpType {
48 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
49 try_map(
50 seq_n!(
51 string_p("selp"),
52 Type::parse(),
53 GeneralOperand::parse(),
54 comma_p(),
55 GeneralOperand::parse(),
56 comma_p(),
57 GeneralOperand::parse(),
58 comma_p(),
59 GeneralOperand::parse(),
60 semicolon_p()
61 ),
62 |(_, type_, d, _, a, _, b, _, c, _), span| {
63 ok!(SelpType {
64 type_ = type_,
65 d = d,
66 a = a,
67 b = b,
68 c = c,
69
70 })
71 },
72 )
73 }
74 }
75}