cranelift: Remove of/nof overflow flags from icmp (#4879)
* cranelift: Remove of/nof overflow flags from icmp Neither Wasmtime nor cg-clif use these flags under any circumstances. From discussion on #3060 I see it's long been unclear what purpose these flags served. Fixes #3060, fixes #4406, and fixes #4875... by deleting all the code that could have been buggy. This changes the cranelift-fuzzgen input format by removing some IntCC options, so I've gone ahead and enabled I128 icmp tests at the same time. Since only the of/nof cases were failing before, I expect these to work. * Restore trapif tests It's still useful to validate that iadd_ifcout's iflags result can be forwarded correctly to trapif, and for that purpose it doesn't really matter what condition code is checked.
This commit is contained in:
@@ -740,7 +740,7 @@ mod tests {
|
||||
#[test]
|
||||
fn state_flags() {
|
||||
let mut state = InterpreterState::default();
|
||||
let flag = IntCC::Overflow;
|
||||
let flag = IntCC::UnsignedLessThan;
|
||||
assert!(!state.has_iflag(flag));
|
||||
state.set_iflag(flag);
|
||||
assert!(state.has_iflag(flag));
|
||||
|
||||
@@ -1293,8 +1293,6 @@ where
|
||||
&left.clone().convert(ValueConversionKind::ToUnsigned)?,
|
||||
&right.clone().convert(ValueConversionKind::ToUnsigned)?,
|
||||
)?,
|
||||
IntCC::Overflow => Value::overflow(left, right)?,
|
||||
IntCC::NotOverflow => !Value::overflow(left, right)?,
|
||||
},
|
||||
bool_ty,
|
||||
)?)
|
||||
|
||||
@@ -46,7 +46,6 @@ pub trait Value: Clone + From<DataValue> {
|
||||
Ok(other.eq(self)? || other.gt(self)?)
|
||||
}
|
||||
fn uno(&self, other: &Self) -> ValueResult<bool>;
|
||||
fn overflow(&self, other: &Self) -> ValueResult<bool>;
|
||||
|
||||
// Arithmetic.
|
||||
fn add(self, other: Self) -> ValueResult<Self>;
|
||||
@@ -478,17 +477,6 @@ impl Value for DataValue {
|
||||
Ok(self.is_nan()? || other.is_nan()?)
|
||||
}
|
||||
|
||||
fn overflow(&self, other: &Self) -> ValueResult<bool> {
|
||||
Ok(match (self, other) {
|
||||
(DataValue::I8(a), DataValue::I8(b)) => a.checked_sub(*b).is_none(),
|
||||
(DataValue::I16(a), DataValue::I16(b)) => a.checked_sub(*b).is_none(),
|
||||
(DataValue::I32(a), DataValue::I32(b)) => a.checked_sub(*b).is_none(),
|
||||
(DataValue::I64(a), DataValue::I64(b)) => a.checked_sub(*b).is_none(),
|
||||
(DataValue::I128(a), DataValue::I128(b)) => a.checked_sub(*b).is_none(),
|
||||
_ => unimplemented!(),
|
||||
})
|
||||
}
|
||||
|
||||
fn add(self, other: Self) -> ValueResult<Self> {
|
||||
if self.is_float() {
|
||||
binary_match!(+(self, other); [F32, F64])
|
||||
|
||||
Reference in New Issue
Block a user