Skip to content

Commit 6e60465

Browse files
committed
Fix another windows ABI mistake
...this time with the float intrinsics.
1 parent f31ee82 commit 6e60465

File tree

1 file changed

+30
-4
lines changed
  • src/libcompiler_builtins

1 file changed

+30
-4
lines changed

src/libcompiler_builtins/lib.rs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,33 @@ pub mod reimpls {
689689
float_as_signed!(a, f32, i128_)
690690
}
691691

692-
#[export_name="__floattidf"]
692+
// LLVM expectations for ABI on windows are pure madness.
693+
694+
#[cfg(not(stage0))]
695+
#[cfg_attr(windows, export_name="__floattidf")]
696+
pub extern "C" fn i128_as_f64_win(alow: u64, ahigh: i64) -> f64 {
697+
i128_as_f64(i128_::from_parts(alow, ahigh))
698+
}
699+
700+
#[cfg(not(stage0))]
701+
#[cfg_attr(windows, export_name="__floattisf")]
702+
pub extern "C" fn i128_as_f32_win(alow: u64, ahigh: i64) -> f32 {
703+
i128_as_f32(i128_::from_parts(alow, ahigh))
704+
}
705+
706+
#[cfg(not(stage0))]
707+
#[cfg_attr(windows, export_name="__floatuntidf")]
708+
pub extern "C" fn u128_as_f64_win(alow: u64, ahigh: u64) -> f64 {
709+
u128_as_f64(u128_::from_parts(alow, ahigh))
710+
}
711+
712+
#[cfg(not(stage0))]
713+
#[cfg_attr(windows, export_name="__floatuntisf")]
714+
pub extern "C" fn u128_as_f32_win(alow: u64, ahigh: u64) -> f32 {
715+
u128_as_f32(u128_::from_parts(alow, ahigh))
716+
}
717+
718+
#[cfg_attr(any(not(windows),stage0),export_name="__floattidf")]
693719
pub extern "C" fn i128_as_f64(a: i128_) -> f64 {
694720
match a.signum() {
695721
1 => u128_as_f64(a.uabs()),
@@ -698,7 +724,7 @@ pub mod reimpls {
698724
}
699725
}
700726

701-
#[export_name="__floattisf"]
727+
#[cfg_attr(any(not(windows),stage0),export_name="__floattisf")]
702728
pub extern "C" fn i128_as_f32(a: i128_) -> f32 {
703729
match a.signum() {
704730
1 => u128_as_f32(a.uabs()),
@@ -707,7 +733,7 @@ pub mod reimpls {
707733
}
708734
}
709735

710-
#[export_name="__floatuntidf"]
736+
#[cfg_attr(any(not(windows),stage0),export_name="__floatuntidf")]
711737
pub extern "C" fn u128_as_f64(mut a: u128_) -> f64 {
712738
use ::core::f64::MANTISSA_DIGITS;
713739
if a == 0 { return 0.0; }
@@ -743,7 +769,7 @@ pub mod reimpls {
743769
}
744770
}
745771

746-
#[export_name="__floatuntisf"]
772+
#[cfg_attr(any(not(windows),stage0),export_name="__floatuntisf")]
747773
pub extern "C" fn u128_as_f32(mut a: u128_) -> f32 {
748774
use ::core::f32::MANTISSA_DIGITS;
749775
if a == 0 { return 0.0; }

0 commit comments

Comments
 (0)