mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-15 21:23:57 +00:00
decimal division in dev backend
This commit is contained in:
parent
4bcd195b92
commit
6c521555ea
2 changed files with 11 additions and 2 deletions
|
|
@ -1652,6 +1652,15 @@ impl<
|
|||
let src2_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src2);
|
||||
ASM::div_freg32_freg32_freg32(&mut self.buf, dst_reg, src1_reg, src2_reg);
|
||||
}
|
||||
LayoutRepr::Builtin(Builtin::Decimal) => {
|
||||
self.build_fn_call(
|
||||
&dst,
|
||||
bitcode::DEC_DIV.to_string(),
|
||||
&[*src1, *src2],
|
||||
&[*layout, *layout],
|
||||
&layout,
|
||||
);
|
||||
}
|
||||
x => todo!("NumDiv: layout, {:?}", x),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -800,14 +800,14 @@ fn gen_div_checked_by_zero_dec() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
#[should_panic(expected = r#"Roc failed with message: "Decimal division by 0!"#)]
|
||||
fn gen_div_dec_by_zero() {
|
||||
assert_evals_to!("1dec / 0", RocDec::from_str_to_i128_unsafe("-1"), i128);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
#[should_panic(expected = r#"Roc failed with message: "Integer division by 0!"#)]
|
||||
fn gen_div_ceil_by_zero() {
|
||||
assert_evals_to!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue