mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
first pass at decimal addition in the wasm backend
This commit is contained in:
parent
dbf5a1b8bb
commit
bceebc4f8f
3 changed files with 40 additions and 15 deletions
|
@ -2,7 +2,7 @@ use roc_builtins::bitcode::{self, FloatWidth};
|
|||
use roc_module::low_level::{LowLevel, LowLevel::*};
|
||||
use roc_module::symbol::Symbol;
|
||||
|
||||
use crate::layout::WasmLayout;
|
||||
use crate::layout::{StackMemoryFormat, WasmLayout};
|
||||
use crate::storage::Storage;
|
||||
use crate::wasm_module::{
|
||||
CodeBuilder,
|
||||
|
@ -63,11 +63,20 @@ pub fn decode_low_level<'a>(
|
|||
return NotImplemented;
|
||||
}
|
||||
|
||||
NumAdd => match ret_layout.value_type() {
|
||||
I32 => code_builder.i32_add(),
|
||||
I64 => code_builder.i64_add(),
|
||||
F32 => code_builder.f32_add(),
|
||||
F64 => code_builder.f64_add(),
|
||||
NumAdd => match ret_layout {
|
||||
WasmLayout::Primitive(value_type, _) => match value_type {
|
||||
I32 => code_builder.i32_add(),
|
||||
I64 => code_builder.i64_add(),
|
||||
F32 => code_builder.f32_add(),
|
||||
F64 => code_builder.f64_add(),
|
||||
},
|
||||
WasmLayout::StackMemory { format, .. } => match format {
|
||||
StackMemoryFormat::Aggregate => return NotImplemented,
|
||||
StackMemoryFormat::Int128 => return NotImplemented,
|
||||
StackMemoryFormat::Float128 => return NotImplemented,
|
||||
StackMemoryFormat::Decimal => return BuiltinCall(bitcode::DEC_ADD_WITH_OVERFLOW),
|
||||
},
|
||||
WasmLayout::HeapMemory { .. } => return NotImplemented,
|
||||
},
|
||||
NumAddWrap => match ret_layout.value_type() {
|
||||
I32 => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue