nac3core: use round instead of rint. Closes #61

escape-analysis
Sebastien Bourdeauducq 2021-10-11 08:18:52 +08:00
parent 3a1dd893a1
commit fd0b11087e
1 changed files with 4 additions and 4 deletions

View File

@ -228,10 +228,10 @@ impl TopLevelComposer {
codegen_callback: Some(Arc::new(GenCall::new(Box::new(|ctx, _, _, args| { codegen_callback: Some(Arc::new(GenCall::new(Box::new(|ctx, _, _, args| {
let arg = args[0].1; let arg = args[0].1;
let round_intrinsic = let round_intrinsic =
ctx.module.get_function("llvm.rint.f64").unwrap_or_else(|| { ctx.module.get_function("llvm.round.f64").unwrap_or_else(|| {
let float = ctx.ctx.f64_type(); let float = ctx.ctx.f64_type();
let fn_type = float.fn_type(&[float.into()], false); let fn_type = float.fn_type(&[float.into()], false);
ctx.module.add_function("llvm.rint.f64", fn_type, None) ctx.module.add_function("llvm.round.f64", fn_type, None)
}); });
let val = ctx let val = ctx
.builder .builder
@ -265,10 +265,10 @@ impl TopLevelComposer {
codegen_callback: Some(Arc::new(GenCall::new(Box::new(|ctx, _, _, args| { codegen_callback: Some(Arc::new(GenCall::new(Box::new(|ctx, _, _, args| {
let arg = args[0].1; let arg = args[0].1;
let round_intrinsic = let round_intrinsic =
ctx.module.get_function("llvm.rint.f64").unwrap_or_else(|| { ctx.module.get_function("llvm.round.f64").unwrap_or_else(|| {
let float = ctx.ctx.f64_type(); let float = ctx.ctx.f64_type();
let fn_type = float.fn_type(&[float.into()], false); let fn_type = float.fn_type(&[float.into()], false);
ctx.module.add_function("llvm.rint.f64", fn_type, None) ctx.module.add_function("llvm.round.f64", fn_type, None)
}); });
let val = ctx let val = ctx
.builder .builder