add x86_64 Num.toFloat support for gen_dev

This commit is contained in:
satotake 2021-12-05 12:32:16 +00:00 committed by GitHub
parent f80409800d
commit 10af89654b
5 changed files with 634 additions and 24 deletions

View file

@ -453,6 +453,19 @@ where
);
self.build_num_lt(sym, &args[0], &args[1], &arg_layouts[0])
}
LowLevel::NumToFloat => {
debug_assert_eq!(
1,
args.len(),
"NumToFloat: expected to have exactly one argument"
);
// debug_assert_eq!(
// Layout::Builtin(Builtin::Float(FloatWidth::F32 | FloatWidth::F64)),
// *ret_layout,
// "NumToFloat: expected to have return layout of type Float64"
// );
self.build_num_to_float(sym, &args[0], &arg_layouts[0], ret_layout)
}
LowLevel::NumRound => self.build_fn_call(
sym,
bitcode::NUM_ROUND[FloatWidth::F64].to_string(),
@ -586,6 +599,15 @@ where
arg_layout: &Layout<'a>,
) -> Result<(), String>;
/// build_num_to_float convert Number to Float
fn build_num_to_float(
&mut self,
dst: &Symbol,
src: &Symbol,
arg_layout: &Layout<'a>,
ret_layout: &Layout<'a>,
) -> Result<(), String>;
/// literal_map gets the map from symbol to literal, used for lazy loading and literal folding.
fn literal_map(&mut self) -> &mut MutMap<Symbol, Literal<'a>>;