From 18355612173d8a2f036d0e4cbd93a2dd2a15082e Mon Sep 17 00:00:00 2001 From: abdul124 Date: Thu, 20 Jun 2024 12:06:24 +0800 Subject: [PATCH] core/llvm_intrinsics: remove llvm.roundeven call from call_float_roundeven --- nac3core/src/codegen/llvm_intrinsics.rs | 5 +++-- nac3standalone/demo/src/math.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nac3core/src/codegen/llvm_intrinsics.rs b/nac3core/src/codegen/llvm_intrinsics.rs index 46b5aeea..27f6b59c 100644 --- a/nac3core/src/codegen/llvm_intrinsics.rs +++ b/nac3core/src/codegen/llvm_intrinsics.rs @@ -671,13 +671,14 @@ pub fn call_float_round<'ctx>( } /// Invokes the -/// [`llvm.roundeven`](https://llvm.org/docs/LangRef.html#llvm-roundeven-intrinsic) intrinsic. +/// [`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>( ctx: &CodeGenContext<'ctx, '_>, val: FloatValue<'ctx>, name: Option<&str>, ) -> FloatValue<'ctx> { - const FN_NAME: &str = "llvm.roundeven"; + const FN_NAME: &str = "llvm.nearbyint"; let llvm_float_t = val.get_type(); diff --git a/nac3standalone/demo/src/math.py b/nac3standalone/demo/src/math.py index 290c2123..a376de63 100644 --- a/nac3standalone/demo/src/math.py +++ b/nac3standalone/demo/src/math.py @@ -37,7 +37,7 @@ def test_round64(): output_int64(round64(x)) def test_np_round(): - for x in [-1.5, -0.5, 0.5, 1.5, dbl_inf(), -dbl_inf(), dbl_nan()]: + for x in [-1.5, -0.5, 0.5, 1.5, dbl_inf(), -dbl_inf(), dbl_nan(), 0.0, -0.0, 1.6, 1.4, -1.4, -1.6]: output_float64(np_round(x)) def test_np_isnan(): -- 2.44.2