forked from M-Labs/nac3
core/llvm_intrinsic: replace roundeven with rint
This commit is contained in:
parent
f52086b706
commit
f062ef5f59
|
@ -419,7 +419,7 @@ pub fn call_numpy_round<'ctx, G: CodeGenerator + ?Sized>(
|
||||||
BasicValueEnum::FloatValue(n) => {
|
BasicValueEnum::FloatValue(n) => {
|
||||||
debug_assert!(ctx.unifier.unioned(n_ty, ctx.primitives.float));
|
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)
|
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!(
|
create_helper_call_numpy_unary_elementwise_float_to_float!(
|
||||||
call_numpy_rint,
|
call_numpy_rint,
|
||||||
"np_rint",
|
"np_rint",
|
||||||
llvm_intrinsics::call_float_roundeven
|
llvm_intrinsics::call_float_rint
|
||||||
);
|
);
|
||||||
|
|
||||||
create_helper_call_numpy_unary_elementwise_float_to_float!(
|
create_helper_call_numpy_unary_elementwise_float_to_float!(
|
||||||
|
|
|
@ -684,15 +684,13 @@ pub fn call_float_round<'ctx>(
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Invokes the
|
/// Invokes the [`llvm.rint`](https://llvm.org/docs/LangRef.html#llvm-rint-intrinsic) intrinsic.
|
||||||
/// [`llvm.nearbyint`](https://llvm.org/docs/LangRef.html#llvm-nearbyint-intrinsic)
|
pub fn call_float_rint<'ctx>(
|
||||||
/// Note [`llvm.roundeven`](https://llvm.org/docs/LangRef.html#llvm-roundeven-intrinsic) not supported on all platforms
|
|
||||||
pub fn call_float_roundeven<'ctx>(
|
|
||||||
ctx: &CodeGenContext<'ctx, '_>,
|
ctx: &CodeGenContext<'ctx, '_>,
|
||||||
val: FloatValue<'ctx>,
|
val: FloatValue<'ctx>,
|
||||||
name: Option<&str>,
|
name: Option<&str>,
|
||||||
) -> FloatValue<'ctx> {
|
) -> FloatValue<'ctx> {
|
||||||
const FN_NAME: &str = "llvm.nearbyint";
|
const FN_NAME: &str = "llvm.rint";
|
||||||
|
|
||||||
let llvm_float_t = val.get_type();
|
let llvm_float_t = val.get_type();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue