@@ -7,6 +7,7 @@ macro_rules! no_mangle {
77 ( $( fn $fun: ident( $( $iid: ident : $ity: ty) ,+) -> $oty: ty; ) +) => {
88 intrinsics! {
99 $(
10+ #[ cfg_attr( all( not( windows) , not( target_vendor = "apple" ) ) , weak) ]
1011 pub extern "C" fn $fun( $( $iid: $ity) ,+) -> $oty {
1112 self :: libm:: $fun( $( $iid) ,+)
1213 }
@@ -15,17 +16,7 @@ macro_rules! no_mangle {
1516 }
1617}
1718
18- #[ cfg( any(
19- all(
20- target_family = "wasm" ,
21- target_os = "unknown" ,
22- not( target_env = "wasi" )
23- ) ,
24- target_os = "xous" ,
25- target_os = "uefi" ,
26- all( target_arch = "xtensa" , target_os = "none" ) ,
27- all( target_vendor = "fortanix" , target_env = "sgx" )
28- ) ) ]
19+ #[ cfg( not( target_os = "windows" ) ) ]
2920no_mangle ! {
3021 fn acos( x: f64 ) -> f64 ;
3122 fn asin( x: f64 ) -> f64 ;
@@ -41,19 +32,13 @@ no_mangle! {
4132 fn log10f( x: f32 ) -> f32 ;
4233 fn log( x: f64 ) -> f64 ;
4334 fn logf( x: f32 ) -> f32 ;
44- fn fmin( x: f64 , y: f64 ) -> f64 ;
45- fn fminf( x: f32 , y: f32 ) -> f32 ;
46- fn fmax( x: f64 , y: f64 ) -> f64 ;
47- fn fmaxf( x: f32 , y: f32 ) -> f32 ;
4835 fn round( x: f64 ) -> f64 ;
4936 fn roundf( x: f32 ) -> f32 ;
5037 fn rint( x: f64 ) -> f64 ;
5138 fn rintf( x: f32 ) -> f32 ;
5239 fn sin( x: f64 ) -> f64 ;
5340 fn pow( x: f64 , y: f64 ) -> f64 ;
5441 fn powf( x: f32 , y: f32 ) -> f32 ;
55- fn fmod( x: f64 , y: f64 ) -> f64 ;
56- fn fmodf( x: f32 , y: f32 ) -> f32 ;
5742 fn acosf( n: f32 ) -> f32 ;
5843 fn atan2f( a: f32 , b: f32 ) -> f32 ;
5944 fn atanf( n: f32 ) -> f32 ;
@@ -85,67 +70,17 @@ no_mangle! {
8570 fn cbrtf( n: f32 ) -> f32 ;
8671 fn hypotf( x: f32 , y: f32 ) -> f32 ;
8772 fn tanf( n: f32 ) -> f32 ;
88- }
89-
90- #[ cfg( any(
91- all(
92- target_family = "wasm" ,
93- target_os = "unknown" ,
94- not( target_env = "wasi" )
95- ) ,
96- target_os = "xous" ,
97- target_os = "uefi" ,
98- all( target_arch = "xtensa" , target_os = "none" ) ,
99- all( target_vendor = "fortanix" , target_env = "sgx" ) ,
100- target_os = "windows"
101- ) ) ]
102- intrinsics ! {
103- pub extern "C" fn lgamma_r( x: f64 , s: & mut i32 ) -> f64 {
104- let r = self :: libm:: lgamma_r( x) ;
105- * s = r. 1 ;
106- r. 0
107- }
108-
109- pub extern "C" fn lgammaf_r( x: f32 , s: & mut i32 ) -> f32 {
110- let r = self :: libm:: lgammaf_r( x) ;
111- * s = r. 1 ;
112- r. 0
113- }
114- }
11573
116- #[ cfg( any(
117- target_os = "xous" ,
118- target_os = "uefi" ,
119- all( target_arch = "xtensa" , target_os = "none" ) ,
120- ) ) ]
121- no_mangle ! {
12274 fn sqrtf( x: f32 ) -> f32 ;
12375 fn sqrt( x: f64 ) -> f64 ;
124- }
12576
126- #[ cfg( any(
127- all( target_vendor = "fortanix" , target_env = "sgx" ) ,
128- all( target_arch = "xtensa" , target_os = "none" ) ,
129- target_os = "xous" ,
130- target_os = "uefi"
131- ) ) ]
132- no_mangle ! {
13377 fn ceil( x: f64 ) -> f64 ;
13478 fn ceilf( x: f32 ) -> f32 ;
13579 fn floor( x: f64 ) -> f64 ;
13680 fn floorf( x: f32 ) -> f32 ;
13781 fn trunc( x: f64 ) -> f64 ;
13882 fn truncf( x: f32 ) -> f32 ;
139- }
14083
141- // only for the thumb*-none-eabi*, riscv32*-none-elf, x86_64-unknown-none and mips*-unknown-none targets that lack the floating point instruction set
142- #[ cfg( any(
143- all( target_arch = "arm" , target_os = "none" ) ,
144- all( target_arch = "riscv32" , not( target_feature = "f" ) , target_os = "none" ) ,
145- all( target_arch = "x86_64" , target_os = "none" ) ,
146- all( target_arch = "mips" , target_os = "none" ) ,
147- ) ) ]
148- no_mangle ! {
14984 fn fmin( x: f64 , y: f64 ) -> f64 ;
15085 fn fminf( x: f32 , y: f32 ) -> f32 ;
15186 fn fmax( x: f64 , y: f64 ) -> f64 ;
@@ -155,3 +90,19 @@ no_mangle! {
15590 // `f32 % f32`
15691 fn fmodf( x: f32 , y: f32 ) -> f32 ;
15792}
93+
94+ intrinsics ! {
95+ #[ cfg_attr( all( not( windows) , not( target_vendor = "apple" ) ) , weak) ]
96+ pub extern "C" fn lgamma_r( x: f64 , s: & mut i32 ) -> f64 {
97+ let r = self :: libm:: lgamma_r( x) ;
98+ * s = r. 1 ;
99+ r. 0
100+ }
101+
102+ #[ cfg_attr( all( not( windows) , not( target_vendor = "apple" ) ) , weak) ]
103+ pub extern "C" fn lgammaf_r( x: f32 , s: & mut i32 ) -> f32 {
104+ let r = self :: libm:: lgammaf_r( x) ;
105+ * s = r. 1 ;
106+ r. 0
107+ }
108+ }
0 commit comments