core/llvm_intrinsic: replace roundeven with rint

This commit is contained in:
abdul124 2024-07-05 13:35:22 +08:00
parent cbff356d50
commit 3e4a096e82
2 changed files with 5 additions and 7 deletions

View File

@ -419,7 +419,7 @@ pub fn call_numpy_round<'ctx, G: CodeGenerator + ?Sized>(
BasicValueEnum::FloatValue(n) => {
debug_assert!(ctx.unifier.unioned(n_ty, ctx.primitives.float));
llvm_intrinsics::call_float_roundeven(ctx, n, None).into()
llvm_intrinsics::call_float_rint(ctx, n, None).into()
}
BasicValueEnum::PointerValue(n)
@ -1383,7 +1383,7 @@ create_helper_call_numpy_unary_elementwise_float_to_float!(
create_helper_call_numpy_unary_elementwise_float_to_float!(
call_numpy_rint,
"np_rint",
llvm_intrinsics::call_float_roundeven
llvm_intrinsics::call_float_rint
);
create_helper_call_numpy_unary_elementwise_float_to_float!(

View File

@ -684,15 +684,13 @@ pub fn call_float_round<'ctx>(
.unwrap()
}
/// Invokes the
/// [`llvm.nearbyint`](https://llvm.org/docs/LangRef.html#llvm-nearbyint-intrinsic)
/// Note [`llvm.roundeven`](https://llvm.org/docs/LangRef.html#llvm-roundeven-intrinsic) not supported on all platforms
pub fn call_float_roundeven<'ctx>(
/// Invokes the [`llvm.rint`](https://llvm.org/docs/LangRef.html#llvm-rint-intrinsic) intrinsic.
pub fn call_float_rint<'ctx>(
ctx: &CodeGenContext<'ctx, '_>,
val: FloatValue<'ctx>,
name: Option<&str>,
) -> FloatValue<'ctx> {
const FN_NAME: &str = "llvm.nearbyint";
const FN_NAME: &str = "llvm.rint";
let llvm_float_t = val.get_type();