@@ -3,11 +3,34 @@ use std::ffi::c_int;
33#[ cfg( feature = "jit" ) ]
44use std:: ffi:: c_void;
55
6+ use cranelift_codegen:: ir:: { Type , types} ;
7+
68// FIXME replace with core::ffi::c_size_t once stabilized
79#[ allow( non_camel_case_types) ]
810#[ cfg( feature = "jit" ) ]
911type size_t = usize ;
1012
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+
1134macro_rules! builtin_functions {
1235 (
1336 $register: ident;
@@ -88,12 +111,12 @@ builtin_functions! {
88111 #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
89112 fn fmodf128( a: f128, b: f128) -> f128;
90113 // 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 ;
97120 #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
98121 fn fminimumf128( a: f128, b: f128) -> f128;
99122 #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
0 commit comments