core/llvm_intrinsic: use llvm.rint for rounding #447
|
@ -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!(
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue