pub enum Cmp {
Slt,
Sle,
Sgt,
Sge,
Eq,
Ne,
O,
Uo,
Ult,
Ule,
Ugt,
Uge,
}Expand description
QBE comparison operations used in conditional instructions.
The result of a comparison is 1 if the condition is true, and 0 if false.
§Examples
use qbe::{Cmp, Instr, Type, Value};
// Compare if %a is less than %b (signed comparison)
let slt_instr = Instr::Cmp(
Type::Word,
Cmp::Slt,
Value::Temporary("a".to_string()),
Value::Temporary("b".to_string()),
);
// Check if two values are equal
let eq_instr = Instr::Cmp(
Type::Word,
Cmp::Eq,
Value::Temporary("x".to_string()),
Value::Const(0),
);Variants§
Slt
Returns 1 if first value is less than second, respecting signedness
Sle
Returns 1 if first value is less than or equal to second, respecting signedness
Sgt
Returns 1 if first value is greater than second, respecting signedness
Sge
Returns 1 if first value is greater than or equal to second, respecting signedness
Eq
Returns 1 if values are equal
Ne
Returns 1 if values are not equal
O
Returns 1 if both operands are not NaN (ordered comparison)
Uo
Returns 1 if at least one operand is NaN (unordered comparison)
Ult
Returns 1 if first value is less than second, unsigned comparison
Ule
Returns 1 if first value is less than or equal to second, unsigned comparison
Ugt
Returns 1 if first value is greater than second, unsigned comparison
Uge
Returns 1 if first value is greater than or equal to second, unsigned comparison