From 59fb34e63ae41d3bd93bfe656882f37da7b31a83 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 5 Mar 2023 12:17:21 -0800 Subject: [PATCH] Added lgamma_r and lgammaf_r --- library/compiler-builtins/src/math.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/library/compiler-builtins/src/math.rs b/library/compiler-builtins/src/math.rs index 982c9499a211..498e4d85ff09 100644 --- a/library/compiler-builtins/src/math.rs +++ b/library/compiler-builtins/src/math.rs @@ -86,6 +86,31 @@ no_mangle! { fn tanf(n: f32) -> f32; } +#[cfg(any( + all( + target_family = "wasm", + target_os = "unknown", + not(target_env = "wasi") + ), + target_os = "xous", + all(target_arch = "x86_64", target_os = "uefi"), + all(target_arch = "xtensa", target_os = "none"), + all(target_vendor = "fortanix", target_env = "sgx") +))] +intrinsics! { + pub extern "C" fn lgamma_r(x: f64, s: &mut i32) -> f64 { + let r = self::libm::lgamma_r(x); + *s = r.1; + r.0 + } + + pub extern "C" fn lgammaf_r(x: f32, s: &mut i32) -> f32 { + let r = self::libm::lgammaf_r(x); + *s = r.1; + r.0 + } +} + #[cfg(any( target_os = "xous", target_os = "uefi",