pub enum Cond {
Show 15 variants
Eq,
Ne,
Hs,
Lo,
Mi,
Pl,
Vs,
Vc,
Hi,
Ls,
Ge,
Lt,
Gt,
Le,
Al,
}Expand description
An ARM condition code.
0b1110 (AL, always) is Cond::Al. 0b1111 is not a condition:
in the 16-bit branch space it is SVC, and in the 32-bit space it is
reserved — so Cond::from_bits rejects it rather than inventing a
fifteenth condition.
use thumb_asm::Cond;
assert_eq!(Cond::from_bits(0b0001), Some(Cond::Ne));
assert_eq!(Cond::Ne.bits(), 0b0001);
assert_eq!(Cond::Ne.invert(), Cond::Eq);
assert_eq!(Cond::Hs.to_string(), "hs");
assert_eq!(Cond::from_bits(0b1111), None); // not a conditionVariants§
Eq
Equal — Z == 1.
Ne
Not equal — Z == 0.
Hs
Unsigned higher or same, also spelled CS — C == 1.
Lo
Unsigned lower, also spelled CC — C == 0.
Mi
Negative — N == 1.
Pl
Positive or zero — N == 0.
Vs
Overflow — V == 1.
Vc
No overflow — V == 0.
Hi
Unsigned higher — C == 1 && Z == 0.
Ls
Unsigned lower or same — C == 0 || Z == 1.
Ge
Signed greater than or equal — N == V.
Lt
Signed less than — N != V.
Gt
Signed greater than — Z == 0 && N == V.
Le
Signed less than or equal — Z == 1 || N != V.
Al
Always. Encodable in IT and in B<cond>.W, but never in the 16-bit
B<cond> (there, 0b1110 is the permanently-undefined UDF space).
Implementations§
Source§impl Cond
impl Cond
Sourcepub fn from_bits(bits: u8) -> Option<Self>
pub fn from_bits(bits: u8) -> Option<Self>
The condition with this 4-bit encoding, or None for 0b1111, which
the architecture does not define as a condition.