core/llvm_intrinsics: remove llvm.roundeven call from call_float_roundeven (issue 396) #428

Merged
sb10q merged 1 commits from issue-396 into master 2024-07-03 14:17:52 +08:00
2 changed files with 4 additions and 3 deletions
Showing only changes of commit 1835561217 - Show all commits

View File

@ -671,13 +671,14 @@ pub fn call_float_round<'ctx>(
} }
/// Invokes the /// 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>( 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.roundeven"; const FN_NAME: &str = "llvm.nearbyint";
let llvm_float_t = val.get_type(); let llvm_float_t = val.get_type();

View File

@ -37,7 +37,7 @@ def test_round64():
output_int64(round64(x)) output_int64(round64(x))
def test_np_round(): 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)) output_float64(np_round(x))
def test_np_isnan(): def test_np_isnan():