split out int and frac division into separate lowlevels

This commit is contained in:
Folkert 2022-08-23 11:07:38 +02:00
parent 2151891ecd
commit 2d366acc6e
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
6 changed files with 30 additions and 31 deletions

View file

@ -442,19 +442,19 @@ trait Backend<'a> {
);
self.build_num_mul(sym, &args[0], &args[1], ret_layout)
}
LowLevel::NumDivUnchecked => {
LowLevel::NumDivTruncUnchecked | LowLevel::NumDivFrac => {
debug_assert_eq!(
2,
args.len(),
"NumMul: expected to have exactly two argument"
"NumDiv: expected to have exactly two argument"
);
debug_assert_eq!(
arg_layouts[0], arg_layouts[1],
"NumMul: expected all arguments of to have the same layout"
"NumDiv: expected all arguments of to have the same layout"
);
debug_assert_eq!(
arg_layouts[0], *ret_layout,
"NumMul: expected to have the same argument and return layout"
"NumDiv: expected to have the same argument and return layout"
);
self.build_num_div(sym, &args[0], &args[1], ret_layout)
}
@ -694,13 +694,6 @@ trait Backend<'a> {
self.load_literal_symbols(args);
self.build_fn_call(sym, fn_name, args, arg_layouts, ret_layout)
}
Symbol::NUM_DIV_TRUNC | Symbol::NUM_DIV_FRAC => self.build_run_low_level(
sym,
&LowLevel::NumDivUnchecked,
args,
arg_layouts,
ret_layout,
),
_ => todo!("the function, {:?}", func_sym),
}
}