diff --git a/compiler/gen/src/llvm/build.rs b/compiler/gen/src/llvm/build.rs index d0716720e3..de5334c352 100644 --- a/compiler/gen/src/llvm/build.rs +++ b/compiler/gen/src/llvm/build.rs @@ -1255,6 +1255,18 @@ fn call_with_args<'a, 'ctx, 'env>( BasicValueEnum::IntValue(int_val) } + Symbol::INT_NEQ_I1 => { + debug_assert!(args.len() == 2); + + let int_val = env.builder.build_int_compare( + IntPredicate::NE, + args[0].0.into_int_value(), + args[1].0.into_int_value(), + "cmp_i1", + ); + + BasicValueEnum::IntValue(int_val) + } Symbol::INT_EQ_I8 => { debug_assert!(args.len() == 2); @@ -1267,6 +1279,18 @@ fn call_with_args<'a, 'ctx, 'env>( BasicValueEnum::IntValue(int_val) } + Symbol::INT_NEQ_I8 => { + debug_assert!(args.len() == 2); + + let int_val = env.builder.build_int_compare( + IntPredicate::NE, + args[0].0.into_int_value(), + args[1].0.into_int_value(), + "cmp_i8", + ); + + BasicValueEnum::IntValue(int_val) + } Symbol::NUM_TO_FLOAT => { // TODO specialize this to be not just for i64! let builtin_fn_name = "i64_to_f64_"; diff --git a/compiler/module/src/symbol.rs b/compiler/module/src/symbol.rs index ca57c6bc5b..bb2c11ff2d 100644 --- a/compiler/module/src/symbol.rs +++ b/compiler/module/src/symbol.rs @@ -607,6 +607,8 @@ define_builtins! { 17 INT_DIV_ARG_NUMERATOR: "div#numerator" // The first argument to `//`, the numerator 18 INT_DIV_ARG_DENOMINATOR: "div#denominator" // The first argument to `//`, the denominator 19 INT_NEQ_I64: "#neqi64" + 20 INT_NEQ_I1: "#neqi1" + 21 INT_NEQ_I8: "#neqi8" } 3 FLOAT: "Float" => { 0 FLOAT_FLOAT: "Float" imported // the Float.Float type alias diff --git a/compiler/mono/src/expr.rs b/compiler/mono/src/expr.rs index b84d12bf59..62734a1f2c 100644 --- a/compiler/mono/src/expr.rs +++ b/compiler/mono/src/expr.rs @@ -552,6 +552,8 @@ fn from_can<'a>( ) { Ok(Layout::Builtin(builtin)) => match builtin { Builtin::Int64 => Symbol::INT_NEQ_I64, + Builtin::Bool => Symbol::INT_NEQ_I1, + Builtin::Byte => Symbol::INT_NEQ_I8, _ => { panic!("Not-Equality not implemented for {:?}", builtin) }