cranelift: Implement PartialEq on Ieee{32,64} (#4849)

* cranelift: Add `fcmp` tests

Some of these are disabled on aarch64 due to not being implemented yet.

* cranelift: Implement float PartialEq for Ieee{32,64} (fixes #4828)

Previously `PartialEq` was auto derived. This means that it was implemented in terms of PartialEq in a u32.

This is not correct for floats because `NaN != NaN`.

PartialOrd was manually implemented in 6d50099816, but it seems like it was an oversight to leave PartialEq out until now.

The test suite depends on the previous behaviour so we adjust it to keep comparing bits instead of floats.

* cranelift: Disable `fcmp ord` tests on aarch64

* cranelift: Disable `fcmp ueq` tests on aarch64
This commit is contained in:
Afonso Bordado
2022-09-02 18:42:42 +01:00
committed by GitHub
parent 48bf078c83
commit f30a7eb0c9
18 changed files with 4503 additions and 74 deletions

View File

@@ -1309,16 +1309,14 @@ where
FloatCC::OrderedNotEqual => Value::lt(left, right)? || Value::gt(left, right)?,
FloatCC::UnorderedOrEqual => Value::eq(left, right)? || Value::uno(left, right)?,
FloatCC::LessThan => Value::lt(left, right)?,
FloatCC::LessThanOrEqual => Value::lt(left, right)? || Value::eq(left, right)?,
FloatCC::LessThanOrEqual => Value::le(left, right)?,
FloatCC::GreaterThan => Value::gt(left, right)?,
FloatCC::GreaterThanOrEqual => Value::gt(left, right)? || Value::eq(left, right)?,
FloatCC::GreaterThanOrEqual => Value::ge(left, right)?,
FloatCC::UnorderedOrLessThan => Value::uno(left, right)? || Value::lt(left, right)?,
FloatCC::UnorderedOrLessThanOrEqual => {
Value::uno(left, right)? || Value::lt(left, right)? || Value::eq(left, right)?
}
FloatCC::UnorderedOrLessThanOrEqual => Value::uno(left, right)? || Value::le(left, right)?,
FloatCC::UnorderedOrGreaterThan => Value::uno(left, right)? || Value::gt(left, right)?,
FloatCC::UnorderedOrGreaterThanOrEqual => {
Value::uno(left, right)? || Value::gt(left, right)? || Value::eq(left, right)?
Value::uno(left, right)? || Value::ge(left, right)?
}
})
}