@@ -3,11 +3,32 @@ 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+ type CmpResult = i32 ;
18+ #[ cfg( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ]
19+ pub ( crate ) const CMP_RESULT_TY : Type = types:: I32 ;
20+
21+ // In compiler-rt, LLP64 ABIs use `long long` and everything else uses `long`. In effect,
22+ // this means the return value is always pointer-sized.
23+ #[ cfg( not( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ) ]
24+ type CmpResult = isize ;
25+ #[ cfg( not( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ) ]
26+ #[ cfg( target_pointer_width = "32" ) ]
27+ pub ( crate ) const CMP_RESULT_TY : Type = types:: I32 ;
28+ #[ cfg( not( any( target_arch = "aarch64" , target_arch = "arm64ec" ) ) ) ]
29+ #[ cfg( target_pointer_width = "64" ) ]
30+ pub ( crate ) const CMP_RESULT_TY : Type = types:: I64 ;
31+
1132macro_rules! builtin_functions {
1233 (
1334 $register: ident;
@@ -88,12 +109,12 @@ builtin_functions! {
88109 #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
89110 fn fmodf128( a: f128, b: f128) -> f128;
90111 // 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 ;
112+ fn __eqtf2( a: f128, b: f128) -> CmpResult ;
113+ fn __netf2( a: f128, b: f128) -> CmpResult ;
114+ fn __lttf2( a: f128, b: f128) -> CmpResult ;
115+ fn __letf2( a: f128, b: f128) -> CmpResult ;
116+ fn __gttf2( a: f128, b: f128) -> CmpResult ;
117+ fn __getf2( a: f128, b: f128) -> CmpResult ;
97118 #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
98119 fn fminimumf128( a: f128, b: f128) -> f128;
99120 #[ cfg( not( all( target_os = "windows" , target_env = "gnu" ) ) ) ]
0 commit comments