From 323191b9fc4b83f7d851b75b78dc1f166692f95a Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 6 Aug 2020 10:32:13 +0800 Subject: [PATCH] runtime: expose more libm functions --- src/runtime/src/kernel/api.rs | 66 ++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/src/runtime/src/kernel/api.rs b/src/runtime/src/kernel/api.rs index 22752b66..c787f595 100644 --- a/src/runtime/src/kernel/api.rs +++ b/src/runtime/src/kernel/api.rs @@ -190,30 +190,80 @@ pub fn resolve(required: &[u8]) -> Option { api!(__artiq_reraise = eh_artiq::reraise), // libm - api_libm_f64f64!(sqrt), - api_libm_f64f64!(round), + api_libm_f64f64!(acos), + api_libm_f64f64!(acosh), + api_libm_f64f64!(asin), + api_libm_f64f64!(asinh), + api_libm_f64f64!(atan), + { + extern fn atan2(y: f64, x: f64) -> f64 { + libm::atan2(y, x) + } + api!(atan2 = atan2) + }, + api_libm_f64f64!(cbrt), + api_libm_f64f64!(ceil), + api_libm_f64f64!(cos), + api_libm_f64f64!(cosh), + api_libm_f64f64!(erf), + api_libm_f64f64!(erfc), + api_libm_f64f64!(exp), + api_libm_f64f64!(exp2), + api_libm_f64f64!(exp10), + api_libm_f64f64!(expm1), + api_libm_f64f64!(fabs), api_libm_f64f64!(floor), + { + extern fn fma(x: f64, y: f64, z: f64) -> f64 { + libm::fma(x, y, z) + } + api!(fma = fma) + }, { extern fn fmod(x: f64, y: f64) -> f64 { libm::fmod(x, y) } api!(fmod = fmod) }, + { + extern fn hypot(x: f64, y: f64) -> f64 { + libm::hypot(x, y) + } + api!(hypot = hypot) + }, + api_libm_f64f64!(j0), + api_libm_f64f64!(j1), + { + extern fn jn(n: i32, x: f64) -> f64 { + libm::jn(n, x) + } + api!(jn = jn) + }, + api_libm_f64f64!(lgamma), api_libm_f64f64!(log), + api_libm_f64f64!(log2), api_libm_f64f64!(log10), - api_libm_f64f64!(exp), { extern fn pow(x: f64, y: f64) -> f64 { libm::pow(x, y) } api!(pow = pow) }, + api_libm_f64f64!(round), api_libm_f64f64!(sin), - api_libm_f64f64!(cos), - api_libm_f64f64!(tan), - api_libm_f64f64!(asin), - api_libm_f64f64!(acos), - api_libm_f64f64!(atan), + api_libm_f64f64!(sinh), + api_libm_f64f64!(sqrt), + api_libm_f64f64!(tanh), + api_libm_f64f64!(tgamma), + api_libm_f64f64!(trunc), + api_libm_f64f64!(y0), + api_libm_f64f64!(y1), + { + extern fn yn(n: i32, x: f64) -> f64 { + libm::yn(n, x) + } + api!(yn = yn) + }, ]; api.iter() .find(|&&(exported, _)| exported.as_bytes() == required)