1use super::{
5 CheckRegId,
6 GMArgs,
7 GTFArgs,
8 Imm12,
9 Imm18,
10 Instruction,
11 RegId,
12 narrowint,
13 wideint,
14};
15
16#[doc(inline)]
20pub use super::_op::*;
21
22#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
23impl GM {
24 pub fn from_args(ra: RegId, args: GMArgs) -> Self {
26 Self::new(ra, Imm18::new(args as _))
27 }
28}
29
30#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
31impl GTF {
32 pub fn from_args(ra: RegId, rb: RegId, args: GTFArgs) -> Self {
34 Self::new(ra, rb, Imm12::new(args as _))
35 }
36}
37
38pub fn gm_args<A: CheckRegId>(ra: A, args: GMArgs) -> Instruction {
40 Instruction::GM(GM::from_args(ra.check(), args))
41}
42
43#[cfg(feature = "typescript")]
44const _: () = {
45 use super::*;
46
47 #[wasm_bindgen::prelude::wasm_bindgen]
48 pub fn gm_args(ra: u8, args: GMArgs) -> typescript::Instruction {
50 Instruction::GM(GM::from_args(ra.check(), args)).into()
51 }
52};
53
54pub fn gtf_args<A: CheckRegId, B: CheckRegId>(
56 ra: A,
57 rb: B,
58 args: GTFArgs,
59) -> Instruction {
60 Instruction::GTF(GTF::from_args(ra.check(), rb.check(), args))
61}
62
63#[cfg(feature = "typescript")]
64const _: () = {
65 use super::*;
66
67 #[wasm_bindgen::prelude::wasm_bindgen]
68 pub fn gtf_args(ra: u8, rb: u8, args: GTFArgs) -> typescript::Instruction {
70 Instruction::GTF(GTF::from_args(ra.check(), rb.check(), args)).into()
71 }
72};
73
74#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
75impl NIOP {
76 pub fn from_args(ra: RegId, rb: RegId, rc: RegId, args: narrowint::MathArgs) -> Self {
78 Self::new(ra, rb, rc, args.to_imm())
79 }
80}
81
82pub fn niop_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
84 ra: A,
85 rb: B,
86 rc: C,
87 args: narrowint::MathArgs,
88) -> Instruction {
89 Instruction::NIOP(NIOP::from_args(ra.check(), rb.check(), rc.check(), args))
90}
91
92#[cfg(feature = "typescript")]
93const _: () = {
94 use super::*;
95
96 #[wasm_bindgen::prelude::wasm_bindgen]
97 pub fn niop_args(
99 ra: u8,
100 rb: u8,
101 rc: u8,
102 args: narrowint::MathArgs,
103 ) -> typescript::Instruction {
104 crate::op::niop_args(ra, rb, rc, args).into()
105 }
106};
107
108#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
109impl WDCM {
110 pub fn from_args(
112 ra: RegId,
113 rb: RegId,
114 rc: RegId,
115 args: wideint::CompareArgs,
116 ) -> Self {
117 Self::new(ra, rb, rc, args.to_imm())
118 }
119}
120
121#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
122impl WQCM {
123 pub fn from_args(
125 ra: RegId,
126 rb: RegId,
127 rc: RegId,
128 args: wideint::CompareArgs,
129 ) -> Self {
130 Self::new(ra, rb, rc, args.to_imm())
131 }
132}
133
134#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
135impl WDOP {
136 pub fn from_args(ra: RegId, rb: RegId, rc: RegId, args: wideint::MathArgs) -> Self {
138 Self::new(ra, rb, rc, args.to_imm())
139 }
140}
141
142#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
143impl WQOP {
144 pub fn from_args(ra: RegId, rb: RegId, rc: RegId, args: wideint::MathArgs) -> Self {
146 Self::new(ra, rb, rc, args.to_imm())
147 }
148}
149
150#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
151impl WDML {
152 pub fn from_args(ra: RegId, rb: RegId, rc: RegId, args: wideint::MulArgs) -> Self {
154 Self::new(ra, rb, rc, args.to_imm())
155 }
156}
157
158#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
159impl WQML {
160 pub fn from_args(ra: RegId, rb: RegId, rc: RegId, args: wideint::MulArgs) -> Self {
162 Self::new(ra, rb, rc, args.to_imm())
163 }
164}
165
166#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
167impl WDDV {
168 pub fn from_args(ra: RegId, rb: RegId, rc: RegId, args: wideint::DivArgs) -> Self {
170 Self::new(ra, rb, rc, args.to_imm())
171 }
172}
173
174#[cfg_attr(feature = "typescript", wasm_bindgen::prelude::wasm_bindgen)]
175impl WQDV {
176 pub fn from_args(ra: RegId, rb: RegId, rc: RegId, args: wideint::DivArgs) -> Self {
178 Self::new(ra, rb, rc, args.to_imm())
179 }
180}
181
182pub fn wdcm_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
184 ra: A,
185 rb: B,
186 rc: C,
187 args: wideint::CompareArgs,
188) -> Instruction {
189 Instruction::WDCM(WDCM::from_args(ra.check(), rb.check(), rc.check(), args))
190}
191
192#[cfg(feature = "typescript")]
193const _: () = {
194 use super::*;
195
196 #[wasm_bindgen::prelude::wasm_bindgen]
197 pub fn wdcm_args(
199 ra: u8,
200 rb: u8,
201 rc: u8,
202 args: wideint::CompareArgs,
203 ) -> typescript::Instruction {
204 crate::op::wdcm_args(ra, rb, rc, args).into()
205 }
206};
207
208pub fn wqcm_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
210 ra: A,
211 rb: B,
212 rc: C,
213 args: wideint::CompareArgs,
214) -> Instruction {
215 Instruction::WQCM(WQCM::from_args(ra.check(), rb.check(), rc.check(), args))
216}
217
218#[cfg(feature = "typescript")]
219const _: () = {
220 use super::*;
221
222 #[wasm_bindgen::prelude::wasm_bindgen]
223 pub fn wqcm_args(
225 ra: u8,
226 rb: u8,
227 rc: u8,
228 args: wideint::CompareArgs,
229 ) -> typescript::Instruction {
230 crate::op::wqcm_args(ra, rb, rc, args).into()
231 }
232};
233
234pub fn wdop_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
236 ra: A,
237 rb: B,
238 rc: C,
239 args: wideint::MathArgs,
240) -> Instruction {
241 Instruction::WDOP(WDOP::from_args(ra.check(), rb.check(), rc.check(), args))
242}
243
244#[cfg(feature = "typescript")]
245const _: () = {
246 use super::*;
247
248 #[wasm_bindgen::prelude::wasm_bindgen]
249 pub fn wdop_args(
251 ra: u8,
252 rb: u8,
253 rc: u8,
254 args: wideint::MathArgs,
255 ) -> typescript::Instruction {
256 crate::op::wdop_args(ra, rb, rc, args).into()
257 }
258};
259
260pub fn wqop_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
262 ra: A,
263 rb: B,
264 rc: C,
265 args: wideint::MathArgs,
266) -> Instruction {
267 Instruction::WQOP(WQOP::from_args(ra.check(), rb.check(), rc.check(), args))
268}
269
270#[cfg(feature = "typescript")]
271const _: () = {
272 use super::*;
273
274 #[wasm_bindgen::prelude::wasm_bindgen]
275 pub fn wqop_args(
277 ra: u8,
278 rb: u8,
279 rc: u8,
280 args: wideint::MathArgs,
281 ) -> typescript::Instruction {
282 crate::op::wqop_args(ra, rb, rc, args).into()
283 }
284};
285
286pub fn wdml_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
288 ra: A,
289 rb: B,
290 rc: C,
291 args: wideint::MulArgs,
292) -> Instruction {
293 Instruction::WDML(WDML::from_args(ra.check(), rb.check(), rc.check(), args))
294}
295
296#[cfg(feature = "typescript")]
297const _: () = {
298 use super::*;
299
300 #[wasm_bindgen::prelude::wasm_bindgen]
301 pub fn wdml_args(
303 ra: u8,
304 rb: u8,
305 rc: u8,
306 args: wideint::MulArgs,
307 ) -> typescript::Instruction {
308 crate::op::wdml_args(ra, rb, rc, args).into()
309 }
310};
311
312pub fn wqml_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
314 ra: A,
315 rb: B,
316 rc: C,
317 args: wideint::MulArgs,
318) -> Instruction {
319 Instruction::WQML(WQML::from_args(ra.check(), rb.check(), rc.check(), args))
320}
321
322#[cfg(feature = "typescript")]
323const _: () = {
324 use super::*;
325
326 #[wasm_bindgen::prelude::wasm_bindgen]
327 pub fn wqml_args(
329 ra: u8,
330 rb: u8,
331 rc: u8,
332 args: wideint::MulArgs,
333 ) -> typescript::Instruction {
334 crate::op::wqml_args(ra, rb, rc, args).into()
335 }
336};
337
338pub fn wddv_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
340 ra: A,
341 rb: B,
342 rc: C,
343 args: wideint::DivArgs,
344) -> Instruction {
345 Instruction::WDDV(WDDV::from_args(ra.check(), rb.check(), rc.check(), args))
346}
347
348#[cfg(feature = "typescript")]
349const _: () = {
350 use super::*;
351
352 #[wasm_bindgen::prelude::wasm_bindgen]
353 pub fn wddv_args(
355 ra: u8,
356 rb: u8,
357 rc: u8,
358 args: wideint::DivArgs,
359 ) -> typescript::Instruction {
360 crate::op::wddv_args(ra, rb, rc, args).into()
361 }
362};
363
364pub fn wqdv_args<A: CheckRegId, B: CheckRegId, C: CheckRegId>(
366 ra: A,
367 rb: B,
368 rc: C,
369 args: wideint::DivArgs,
370) -> Instruction {
371 Instruction::WQDV(WQDV::from_args(ra.check(), rb.check(), rc.check(), args))
372}
373
374#[cfg(feature = "typescript")]
375const _: () = {
376 use super::*;
377
378 #[wasm_bindgen::prelude::wasm_bindgen]
379 pub fn wqdv_args(
381 ra: u8,
382 rb: u8,
383 rc: u8,
384 args: wideint::DivArgs,
385 ) -> typescript::Instruction {
386 crate::op::wqdv_args(ra, rb, rc, args).into()
387 }
388};