]>
Witch of Git - jade-mouse/blob - toolchain/src/inst.rs
130afc9f924952772058a84d31ba5c843aeb0b89
6 use proptest_derive
::Arbitrary
;
8 pub use self::{decode
::Decode
, encode
::Encode
};
10 use std
::cmp
::PartialEq
;
12 #[derive(Clone, Copy, Debug, PartialOrd, Ord, PartialEq, Eq)]
13 #[cfg_attr(test, derive(Arbitrary))]
22 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
23 #[cfg_attr(test, derive(Arbitrary))]
30 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
31 #[cfg_attr(test, derive(Arbitrary))]
40 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
41 #[cfg_attr(test, derive(Arbitrary))]
54 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
55 #[cfg_attr(test, derive(Arbitrary))]
66 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
67 #[cfg_attr(test, derive(Arbitrary))]
68 pub struct U4(#[cfg_attr(test, proptest(strategy = "0..=15u8"))] u8);
69 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
70 #[cfg_attr(test, derive(Arbitrary))]
71 pub struct I5(#[cfg_attr(test, proptest(strategy = "-16..=15i8"))] i8);
72 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
73 #[cfg_attr(test, derive(Arbitrary))]
74 pub struct I7(#[cfg_attr(test, proptest(strategy = "-64..=63i8"))] i8);
75 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
76 #[cfg_attr(test, derive(Arbitrary))]
77 pub struct U7(#[cfg_attr(test, proptest(strategy = "0..=127u8"))] u8);
79 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
80 #[cfg_attr(test, derive(Arbitrary))]
87 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
88 #[cfg_attr(test, derive(Arbitrary))]
95 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
96 #[cfg_attr(test, derive(Arbitrary))]
108 #[derive(Clone, Copy, Debug, Eq)]
109 #[cfg_attr(test, derive(Arbitrary))]
111 #[cfg_attr(test, proptest(strategy = "test::regpair(Cond::Eql)"))]
113 #[cfg_attr(test, proptest(strategy = "test::regpair(Cond::Neq)"))]
115 #[cfg_attr(test, proptest(strategy = "test::regpair(Cond::Test)"))]
117 #[cfg_attr(test, proptest(strategy = "test::regpair(Cond::TestNot)"))]
119 #[cfg_attr(test, proptest(strategy = "test::regpair(Cond::Lt)"))]
121 #[cfg_attr(test, proptest(strategy = "test::regpair(Cond::Ult)"))]
125 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
126 #[cfg_attr(test, derive(Arbitrary))]
132 #[cfg_attr(test, proptest(strategy = "test::regpair(Inst::Move)"))]
135 Mem(LdSt
, Reg
, Addr
),
139 AluCompact(Reg
, OpC
, U4
),
140 LdImm(Half
, Reg
, u8),
143 impl PartialEq
for Cond
{
144 fn eq(&self, other
: &Cond
) -> bool
{
146 match (self, other
) {
147 (Eql(a1
, b1
), Eql(a2
, b2
)) => (a1
, b1
) == (a2
, b2
) || (a1
, b1
) == (b2
, a2
),
148 (Neq(a1
, b1
), Neq(a2
, b2
)) => (a1
, b1
) == (a2
, b2
) || (a1
, b1
) == (b2
, a2
),
149 (Test(a1
, b1
), Test(a2
, b2
)) => (a1
, b1
) == (a2
, b2
) || (a1
, b1
) == (b2
, a2
),
150 (TestNot(a1
, b1
), TestNot(a2
, b2
)) => (a1
, b1
) == (a2
, b2
) || (a1
, b1
) == (b2
, a2
),
151 (Lt(a1
, b1
), Lt(a2
, b2
)) => (a1
, b1
) == (a2
, b2
),
152 (Ult(a1
, b1
), Ult(a2
, b2
)) => (a1
, b1
) == (a2
, b2
),