[codegen] legalize icmp for 64 and 128 bit operands
Add legalizations for icmp and icmp_imm for i64 and i128 operands for the narrow legalization set, allowing 32-bit ISAs (like x86-32) to compare 64-bit integers and all ISAs to compare 128-bit integers. Fixes: https://github.com/bnjbvr/cranelift-x86/issues/2
This commit is contained in:
committed by
Benjamin Bouvier
parent
19444649e7
commit
c062f12d7c
@@ -96,6 +96,32 @@ impl CondCode for IntCC {
|
||||
}
|
||||
|
||||
impl IntCC {
|
||||
/// Get the corresponding IntCC with the equal component removed.
|
||||
/// For conditions without a zero component, this is a no-op.
|
||||
pub fn without_equal(self) -> Self {
|
||||
use self::IntCC::*;
|
||||
match self {
|
||||
SignedGreaterThan | SignedGreaterThanOrEqual => SignedGreaterThan,
|
||||
SignedLessThan | SignedLessThanOrEqual => SignedLessThan,
|
||||
UnsignedGreaterThan | UnsignedGreaterThanOrEqual => UnsignedGreaterThan,
|
||||
UnsignedLessThan | UnsignedLessThanOrEqual => UnsignedLessThan,
|
||||
_ => self,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the corresponding IntCC with the signed component removed.
|
||||
/// For conditions without a signed component, this is a no-op.
|
||||
pub fn unsigned(self) -> Self {
|
||||
use self::IntCC::*;
|
||||
match self {
|
||||
SignedGreaterThan | UnsignedGreaterThan => UnsignedGreaterThan,
|
||||
SignedGreaterThanOrEqual | UnsignedGreaterThanOrEqual => UnsignedGreaterThanOrEqual,
|
||||
SignedLessThan | UnsignedLessThan => UnsignedLessThan,
|
||||
SignedLessThanOrEqual | UnsignedLessThanOrEqual => UnsignedLessThanOrEqual,
|
||||
_ => self,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the corresponding string condition code for the IntCC object.
|
||||
pub fn to_static_str(self) -> &'static str {
|
||||
use self::IntCC::*;
|
||||
|
||||
Reference in New Issue
Block a user