]> git.proxmox.com Git - rustc.git/blob - vendor/compiler_builtins/src/math.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / vendor / compiler_builtins / src / math.rs
1 #[allow(dead_code)]
2 #[path = "../libm/src/math/mod.rs"]
3 mod libm;
4
5 macro_rules! no_mangle {
6 ($(fn $fun:ident($($iid:ident : $ity:ty),+) -> $oty:ty;)+) => {
7 intrinsics! {
8 $(
9 pub extern "C" fn $fun($($iid: $ity),+) -> $oty {
10 self::libm::$fun($($iid),+)
11 }
12 )+
13 }
14 }
15 }
16
17 #[cfg(any(
18 all(
19 target_family = "wasm",
20 target_os = "unknown",
21 not(target_env = "wasi")
22 ),
23 target_os = "xous",
24 all(target_arch = "x86_64", target_os = "uefi"),
25 all(target_arch = "xtensa", target_os = "none"),
26 all(target_vendor = "fortanix", target_env = "sgx")
27 ))]
28 no_mangle! {
29 fn acos(x: f64) -> f64;
30 fn asin(x: f64) -> f64;
31 fn cbrt(x: f64) -> f64;
32 fn expm1(x: f64) -> f64;
33 fn hypot(x: f64, y: f64) -> f64;
34 fn tan(x: f64) -> f64;
35 fn cos(x: f64) -> f64;
36 fn expf(x: f32) -> f32;
37 fn log2(x: f64) -> f64;
38 fn log2f(x: f32) -> f32;
39 fn log10(x: f64) -> f64;
40 fn log10f(x: f32) -> f32;
41 fn log(x: f64) -> f64;
42 fn logf(x: f32) -> f32;
43 fn fmin(x: f64, y: f64) -> f64;
44 fn fminf(x: f32, y: f32) -> f32;
45 fn fmax(x: f64, y: f64) -> f64;
46 fn fmaxf(x: f32, y: f32) -> f32;
47 fn round(x: f64) -> f64;
48 fn roundf(x: f32) -> f32;
49 fn rint(x: f64) -> f64;
50 fn rintf(x: f32) -> f32;
51 fn sin(x: f64) -> f64;
52 fn pow(x: f64, y: f64) -> f64;
53 fn powf(x: f32, y: f32) -> f32;
54 fn fmod(x: f64, y: f64) -> f64;
55 fn fmodf(x: f32, y: f32) -> f32;
56 fn acosf(n: f32) -> f32;
57 fn atan2f(a: f32, b: f32) -> f32;
58 fn atanf(n: f32) -> f32;
59 fn coshf(n: f32) -> f32;
60 fn expm1f(n: f32) -> f32;
61 fn fdim(a: f64, b: f64) -> f64;
62 fn fdimf(a: f32, b: f32) -> f32;
63 fn log1pf(n: f32) -> f32;
64 fn sinhf(n: f32) -> f32;
65 fn tanhf(n: f32) -> f32;
66 fn ldexp(f: f64, n: i32) -> f64;
67 fn ldexpf(f: f32, n: i32) -> f32;
68 fn tgamma(x: f64) -> f64;
69 fn tgammaf(x: f32) -> f32;
70 fn atan(x: f64) -> f64;
71 fn atan2(x: f64, y: f64) -> f64;
72 fn cosh(x: f64) -> f64;
73 fn log1p(x: f64) -> f64;
74 fn sinh(x: f64) -> f64;
75 fn tanh(x: f64) -> f64;
76 fn cosf(x: f32) -> f32;
77 fn exp(x: f64) -> f64;
78 fn sinf(x: f32) -> f32;
79 fn exp2(x: f64) -> f64;
80 fn exp2f(x: f32) -> f32;
81 fn fma(x: f64, y: f64, z: f64) -> f64;
82 fn fmaf(x: f32, y: f32, z: f32) -> f32;
83 fn asinf(n: f32) -> f32;
84 fn cbrtf(n: f32) -> f32;
85 fn hypotf(x: f32, y: f32) -> f32;
86 fn tanf(n: f32) -> f32;
87 }
88
89 #[cfg(any(target_os = "xous", target_os = "uefi"))]
90 no_mangle! {
91 fn sqrtf(x: f32) -> f32;
92 fn sqrt(x: f64) -> f64;
93 }
94
95 #[cfg(any(
96 all(target_vendor = "fortanix", target_env = "sgx"),
97 target_os = "xous",
98 target_os = "uefi"
99 ))]
100 no_mangle! {
101 fn ceil(x: f64) -> f64;
102 fn ceilf(x: f32) -> f32;
103 fn floor(x: f64) -> f64;
104 fn floorf(x: f32) -> f32;
105 fn trunc(x: f64) -> f64;
106 fn truncf(x: f32) -> f32;
107 }
108
109 // only for the thumb*-none-eabi* targets and riscv32*-none-elf targets that lack the floating point instruction set
110 #[cfg(any(
111 all(target_arch = "arm", target_os = "none"),
112 all(target_arch = "riscv32", not(target_feature = "f"), target_os = "none")
113 ))]
114 no_mangle! {
115 fn fmin(x: f64, y: f64) -> f64;
116 fn fminf(x: f32, y: f32) -> f32;
117 fn fmax(x: f64, y: f64) -> f64;
118 fn fmaxf(x: f32, y: f32) -> f32;
119 // `f64 % f64`
120 fn fmod(x: f64, y: f64) -> f64;
121 // `f32 % f32`
122 fn fmodf(x: f32, y: f32) -> f32;
123 }