ptx_parser/parser/instruction/
movmatrix.rs1#![allow(unused)]
8
9use crate::parser::{
10 PtxParseError, PtxParser, PtxTokenStream, Span,
11 util::{
12 between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
13 pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
14 },
15};
16use crate::r#type::common::*;
17use crate::{alt, ok, seq_n};
18
19pub mod section_0 {
20 use super::*;
21 use crate::r#type::instruction::movmatrix::section_0::*;
22
23 impl PtxParser for Shape {
28 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
29 alt!(map(string_p(".m8n8"), |_, _span| Shape::M8n8))
30 }
31 }
32
33 impl PtxParser for Type {
34 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
35 alt!(map(string_p(".b16"), |_, _span| Type::B16))
36 }
37 }
38
39 impl PtxParser for MovmatrixSyncAlignedShapeTransType {
40 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
41 try_map(
42 seq_n!(
43 string_p("movmatrix"),
44 string_p(".sync"),
45 string_p(".aligned"),
46 Shape::parse(),
47 string_p(".trans"),
48 Type::parse(),
49 GeneralOperand::parse(),
50 comma_p(),
51 GeneralOperand::parse(),
52 semicolon_p()
53 ),
54 |(_, sync, aligned, shape, trans, type_, d, _, a, _), span| {
55 ok!(MovmatrixSyncAlignedShapeTransType {
56 sync = sync,
57 aligned = aligned,
58 shape = shape,
59 trans = trans,
60 type_ = type_,
61 d = d,
62 a = a,
63
64 })
65 },
66 )
67 }
68 }
69}