cranelift: Fix icmp_imm for small types in interpreter (#4506)

This commit is contained in:
Afonso Bordado
2022-07-23 01:26:56 +01:00
committed by GitHub
parent af62037f62
commit 446efd3e11
11 changed files with 87 additions and 3 deletions

View File

@@ -294,9 +294,7 @@ impl Value for DataValue {
Ok(match kind {
ValueConversionKind::Exact(ty) => match (self, ty) {
// TODO a lot to do here: from bmask to ireduce to raw_bitcast...
(DataValue::I64(n), types::I32) => DataValue::I32(i32::try_from(n)?),
(DataValue::I64(n), types::I64) => DataValue::I64(n),
(DataValue::I64(n), types::I128) => DataValue::I128(n as i128),
(DataValue::I64(n), ty) if ty.is_int() => DataValue::from_integer(n as i128, ty)?,
(DataValue::F32(n), types::I32) => DataValue::I32(n.bits() as i32),
(DataValue::F64(n), types::I64) => DataValue::I64(n.bits() as i64),
(DataValue::B(b), t) if t.is_bool() => DataValue::B(b),