Skip to main content

ptx_parser/parser/instruction/
st_bulk.rs

1//! Original PTX specification:
2//!
3//! st.bulk{.weak}{.shared::cta}  [a], size, initval; // initval must be zero
4
5#![allow(unused)]
6
7use crate::parser::{
8    PtxParseError, PtxParser, PtxTokenStream, Span,
9    util::{
10        between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
11        pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
12    },
13};
14use crate::r#type::common::*;
15use crate::{alt, ok, seq_n};
16
17pub mod section_0 {
18    use super::*;
19    use crate::r#type::instruction::st_bulk::section_0::*;
20
21    impl PtxParser for StBulkWeakSharedCta {
22        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
23            try_map(
24                seq_n!(
25                    string_p("st"),
26                    string_p(".bulk"),
27                    map(optional(string_p(".weak")), |value, _| value.is_some()),
28                    map(optional(string_p(".shared::cta")), |value, _| value
29                        .is_some()),
30                    AddressOperand::parse(),
31                    comma_p(),
32                    GeneralOperand::parse(),
33                    comma_p(),
34                    GeneralOperand::parse(),
35                    semicolon_p()
36                ),
37                |(_, bulk, weak, shared_cta, a, _, size, _, initval, _), span| {
38                    ok!(StBulkWeakSharedCta {
39                        bulk = bulk,
40                        weak = weak,
41                        shared_cta = shared_cta,
42                        a = a,
43                        size = size,
44                        initval = initval,
45
46                    })
47                },
48            )
49        }
50    }
51}