mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Implement and test Float.#add
This commit is contained in:
parent
523282e7bc
commit
21e4eb505a
4 changed files with 32 additions and 1 deletions
|
@ -552,6 +552,13 @@ fn call_by_name<'a, B: Backend>(
|
|||
|
||||
builder.ins().iadd(a, b)
|
||||
}
|
||||
Symbol::FLOAT_ADD => {
|
||||
debug_assert!(args.len() == 2);
|
||||
let a = build_arg(&args[0], env, scope, module, builder, procs);
|
||||
let b = build_arg(&args[1], env, scope, module, builder, procs);
|
||||
|
||||
builder.ins().fadd(a, b)
|
||||
}
|
||||
Symbol::NUM_SUB => {
|
||||
debug_assert!(args.len() == 2);
|
||||
let a = build_arg(&args[0], env, scope, module, builder, procs);
|
||||
|
|
|
@ -547,6 +547,17 @@ fn call_with_args<'a, 'ctx, 'env>(
|
|||
|
||||
BasicValueEnum::IntValue(int_val)
|
||||
}
|
||||
Symbol::FLOAT_ADD => {
|
||||
debug_assert!(args.len() == 2);
|
||||
|
||||
let float_val = env.builder.build_float_add(
|
||||
args[0].into_float_value(),
|
||||
args[1].into_float_value(),
|
||||
"add_f64",
|
||||
);
|
||||
|
||||
BasicValueEnum::FloatValue(float_val)
|
||||
}
|
||||
Symbol::NUM_SUB => {
|
||||
debug_assert!(args.len() == 2);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue