Support boolean comparisons

This commit is contained in:
Ahmad Sattar 2023-02-16 20:58:54 +01:00
parent b5fe932c22
commit 82c0aa083d
No known key found for this signature in database
GPG key ID: 457C18819D9C9570
2 changed files with 8 additions and 8 deletions

View file

@ -1102,7 +1102,7 @@ impl<
fn build_eq(&mut self, dst: &Symbol, src1: &Symbol, src2: &Symbol, arg_layout: &InLayout<'a>) {
match *arg_layout {
single_register_int_builtins!() => {
single_register_int_builtins!() | Layout::BOOL => {
let dst_reg = self.storage_manager.claim_general_reg(&mut self.buf, dst);
let src1_reg = self
.storage_manager
@ -1117,8 +1117,8 @@ impl<
}
fn build_neq(&mut self, dst: &Symbol, src1: &Symbol, src2: &Symbol, arg_layout: &InLayout<'a>) {
match self.layout_interner.get(*arg_layout) {
Layout::Builtin(Builtin::Int(IntWidth::I64 | IntWidth::U64)) => {
match *arg_layout {
single_register_int_builtins!() | Layout::BOOL => {
let dst_reg = self.storage_manager.claim_general_reg(&mut self.buf, dst);
let src1_reg = self
.storage_manager

View file

@ -27,7 +27,7 @@ fn eq_i64() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn neq_i64() {
assert_evals_to!(
indoc!(
@ -61,7 +61,7 @@ fn eq_u64() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn neq_u64() {
assert_evals_to!(
indoc!(
@ -78,7 +78,7 @@ fn neq_u64() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn eq_bool_tag() {
assert_evals_to!(
indoc!(
@ -95,7 +95,7 @@ fn eq_bool_tag() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn neq_bool_tag() {
assert_evals_to!(
indoc!(
@ -152,7 +152,7 @@ fn unit() {
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn newtype() {
assert_evals_to!("Identity 42 == Identity 42", true, bool);
assert_evals_to!("Identity 42 != Identity 42", false, bool);