]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_cranelift/src/compiler_builtins.rs
Auto merge of #106938 - GuillaumeGomez:normalize-projection-field-ty, r=oli-obk
[rust.git] / compiler / rustc_codegen_cranelift / src / compiler_builtins.rs
1 macro_rules! builtin_functions {
2     ($register:ident; $(fn $name:ident($($arg_name:ident: $arg_ty:ty),*) -> $ret_ty:ty;)*) => {
3         #[cfg(feature = "jit")]
4         #[allow(improper_ctypes)]
5         extern "C" {
6             $(fn $name($($arg_name: $arg_ty),*) -> $ret_ty;)*
7         }
8
9         #[cfg(feature = "jit")]
10         pub(crate) fn $register(builder: &mut cranelift_jit::JITBuilder) {
11             for (name, val) in [$((stringify!($name), $name as *const u8)),*] {
12                 builder.symbol(name, val);
13             }
14         }
15     };
16 }
17
18 builtin_functions! {
19     register_functions_for_jit;
20
21     // integers
22     fn __multi3(a: i128, b: i128) -> i128;
23     fn __udivti3(n: u128, d: u128) -> u128;
24     fn __divti3(n: i128, d: i128) -> i128;
25     fn __umodti3(n: u128, d: u128) -> u128;
26     fn __modti3(n: i128, d: i128) -> i128;
27     fn __rust_u128_addo(a: u128, b: u128) -> (u128, bool);
28     fn __rust_i128_addo(a: i128, b: i128) -> (i128, bool);
29     fn __rust_u128_subo(a: u128, b: u128) -> (u128, bool);
30     fn __rust_i128_subo(a: i128, b: i128) -> (i128, bool);
31     fn __rust_u128_mulo(a: u128, b: u128) -> (u128, bool);
32     fn __rust_i128_mulo(a: i128, b: i128) -> (i128, bool);
33
34     // floats
35     fn __floattisf(i: i128) -> f32;
36     fn __floattidf(i: i128) -> f64;
37     fn __floatuntisf(i: u128) -> f32;
38     fn __floatuntidf(i: u128) -> f64;
39     fn __fixsfti(f: f32) -> i128;
40     fn __fixdfti(f: f64) -> i128;
41     fn __fixunssfti(f: f32) -> u128;
42     fn __fixunsdfti(f: f64) -> u128;
43 }