@@ -3,11 +3,34 @@ use std::ffi::c_int;
3
3
#[ cfg( feature = "jit" ) ]
4
4
use std:: ffi:: c_void;
5
5
6
+ use cranelift_codegen:: ir:: { Type , types} ;
7
+
6
8
// FIXME replace with core::ffi::c_size_t once stabilized
7
9
#[ allow( non_camel_case_types) ]
8
10
#[ cfg( feature = "jit" ) ]
9
11
type size_t = usize ;
10
12
13
+ // Needs to stay in sync with compiler-builtins
14
+
15
+ // Aarch64 uses `int` rather than a pointer-sized value.
16
+ #[ cfg( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ]
17
+ #[ cfg( feature = "jit" ) ]
18
+ type CmpResult = i32 ;
19
+ #[ cfg( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ]
20
+ pub ( crate ) const CMP_RESULT_TY : Type = types:: I32 ;
21
+
22
+ // In compiler-rt, LLP64 ABIs use `long long` and everything else uses `long`. In effect,
23
+ // this means the return value is always pointer-sized.
24
+ #[ cfg( not( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ) ]
25
+ #[ cfg( feature = "jit" ) ]
26
+ type CmpResult = isize ;
27
+ #[ cfg( not( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ) ]
28
+ #[ cfg( target_pointer_width = "32" ) ]
29
+ pub ( crate ) const CMP_RESULT_TY : Type = types:: I32 ;
30
+ #[ cfg( not( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ) ]
31
+ #[ cfg( target_pointer_width = "64" ) ]
32
+ pub ( crate ) const CMP_RESULT_TY : Type = types:: I64 ;
33
+
11
34
macro_rules! builtin_functions {
12
35
(
13
36
$register: ident;
@@ -88,12 +111,12 @@ builtin_functions! {
88
111
#[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
89
112
fn fmodf128( a: f128, b: f128) -> f128;
90
113
// float comparison
91
- fn __eqtf2( a: f128, b: f128) -> i32 ;
92
- fn __netf2( a: f128, b: f128) -> i32 ;
93
- fn __lttf2( a: f128, b: f128) -> i32 ;
94
- fn __letf2( a: f128, b: f128) -> i32 ;
95
- fn __gttf2( a: f128, b: f128) -> i32 ;
96
- fn __getf2( a: f128, b: f128) -> i32 ;
114
+ fn __eqtf2( a: f128, b: f128) -> CmpResult ;
115
+ fn __netf2( a: f128, b: f128) -> CmpResult ;
116
+ fn __lttf2( a: f128, b: f128) -> CmpResult ;
117
+ fn __letf2( a: f128, b: f128) -> CmpResult ;
118
+ fn __gttf2( a: f128, b: f128) -> CmpResult ;
119
+ fn __getf2( a: f128, b: f128) -> CmpResult ;
97
120
#[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
98
121
fn fminimumf128( a: f128, b: f128) -> f128;
99
122
#[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
0 commit comments