Skip to content

Commit ef328d9

Browse files
committed
remove win64_128bit_abi_hack
1 parent 3c09866 commit ef328d9

File tree

4 files changed

+2
-80
lines changed

4 files changed

+2
-80
lines changed

src/float/conv.rs

-4
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ intrinsics! {
403403
float_to_unsigned_int(f)
404404
}
405405

406-
#[win64_128bit_abi_hack]
407406
pub extern "C" fn __fixunssfti(f: f32) -> u128 {
408407
float_to_unsigned_int(f)
409408
}
@@ -418,7 +417,6 @@ intrinsics! {
418417
float_to_unsigned_int(f)
419418
}
420419

421-
#[win64_128bit_abi_hack]
422420
pub extern "C" fn __fixunsdfti(f: f64) -> u128 {
423421
float_to_unsigned_int(f)
424422
}
@@ -454,7 +452,6 @@ intrinsics! {
454452
float_to_signed_int(f)
455453
}
456454

457-
#[win64_128bit_abi_hack]
458455
pub extern "C" fn __fixsfti(f: f32) -> i128 {
459456
float_to_signed_int(f)
460457
}
@@ -469,7 +466,6 @@ intrinsics! {
469466
float_to_signed_int(f)
470467
}
471468

472-
#[win64_128bit_abi_hack]
473469
pub extern "C" fn __fixdfti(f: f64) -> i128 {
474470
float_to_signed_int(f)
475471
}

src/int/sdiv.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,5 @@ sdivmod!(
165165
i128,
166166
maybe_use_optimized_c_shim
167167
);
168-
sdiv!(__udivti3, __divti3, u128, i128, win64_128bit_abi_hack);
169-
smod!(__umodti3, __modti3, u128, i128, win64_128bit_abi_hack);
168+
sdiv!(__udivti3, __divti3, u128, i128,);
169+
smod!(__umodti3, __modti3, u128, i128,);

src/int/udiv.rs

-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ intrinsics! {
5858
// the existence of `u128_div_rem` to get 32-bit SPARC to compile, see `u128_divide_sparc` docs.
5959

6060
#[avr_skip]
61-
#[win64_128bit_abi_hack]
6261
/// Returns `n / d`
6362
pub extern "C" fn __udivti3(n: u128, d: u128) -> u128 {
6463
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))] {
@@ -70,7 +69,6 @@ intrinsics! {
7069
}
7170

7271
#[avr_skip]
73-
#[win64_128bit_abi_hack]
7472
/// Returns `n % d`
7573
pub extern "C" fn __umodti3(n: u128, d: u128) -> u128 {
7674
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))] {
@@ -84,7 +82,6 @@ intrinsics! {
8482
}
8583

8684
#[avr_skip]
87-
#[win64_128bit_abi_hack]
8885
/// Returns `n / d` and sets `*rem = n % d`
8986
pub extern "C" fn __udivmodti4(n: u128, d: u128, rem: Option<&mut u128>) -> u128 {
9087
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))] {

src/macros.rs

-71
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ macro_rules! public_test_dep {
6060
/// the specified ABI everywhere else.
6161
/// * `unadjusted_on_win64` - like `aapcs_on_arm` this switches to the
6262
/// `"unadjusted"` abi on Win64 and the specified abi elsewhere.
63-
/// * `win64_128bit_abi_hack` - this attribute is used for 128-bit integer
64-
/// intrinsics where the ABI is slightly tweaked on Windows platforms, but
65-
/// it's a normal ABI elsewhere for returning a 128 bit integer.
6663
/// * `arm_aeabi_alias` - handles the "aliasing" of various intrinsics on ARM
6764
/// their otherwise typical names to other prefixed ones.
6865
/// * `ppc_alias` - changes the name of the symbol on PowerPC platforms without
@@ -231,51 +228,6 @@ macro_rules! intrinsics {
231228
intrinsics!($($rest)*);
232229
);
233230

234-
// Some intrinsics on win64 which return a 128-bit integer have an.. unusual
235-
// calling convention. That's managed here with this "abi hack" which alters
236-
// the generated symbol's ABI.
237-
//
238-
// This will still define a function in this crate with the given name and
239-
// signature, but the actual symbol for the intrinsic may have a slightly
240-
// different ABI on win64.
241-
(
242-
#[win64_128bit_abi_hack]
243-
$(#[$($attr:tt)*])*
244-
pub extern $abi:tt fn $name:ident( $($argname:ident: $ty:ty),* ) $(-> $ret:ty)? {
245-
$($body:tt)*
246-
}
247-
248-
$($rest:tt)*
249-
) => (
250-
#[cfg(all(any(windows, target_os = "uefi"), target_arch = "x86_64"))]
251-
$(#[$($attr)*])*
252-
pub extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
253-
$($body)*
254-
}
255-
256-
#[cfg(all(any(windows, target_os = "uefi"), target_arch = "x86_64", not(feature = "mangled-names")))]
257-
mod $name {
258-
#[no_mangle]
259-
#[cfg_attr(not(all(windows, target_env = "gnu")), linkage = "weak")]
260-
extern $abi fn $name( $($argname: $ty),* )
261-
-> $crate::macros::win64_128bit_abi_hack::U64x2
262-
{
263-
let e: $($ret)? = super::$name($($argname),*);
264-
$crate::macros::win64_128bit_abi_hack::U64x2::from(e)
265-
}
266-
}
267-
268-
#[cfg(not(all(any(windows, target_os = "uefi"), target_arch = "x86_64")))]
269-
intrinsics! {
270-
$(#[$($attr)*])*
271-
pub extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
272-
$($body)*
273-
}
274-
}
275-
276-
intrinsics!($($rest)*);
277-
);
278-
279231
// `arm_aeabi_alias` would conflict with `f16_apple_{arg,ret}_abi` not handled here. Avoid macro ambiguity by combining in a
280232
// single `#[]`.
281233
(
@@ -576,26 +528,3 @@ macro_rules! intrinsics {
576528
intrinsics!($($rest)*);
577529
);
578530
}
579-
580-
// Hack for LLVM expectations for ABI on windows. This is used by the
581-
// `#[win64_128bit_abi_hack]` attribute recognized above
582-
#[cfg(all(any(windows, target_os = "uefi"), target_pointer_width = "64"))]
583-
pub mod win64_128bit_abi_hack {
584-
#[repr(simd)]
585-
pub struct U64x2([u64; 2]);
586-
587-
impl From<i128> for U64x2 {
588-
fn from(i: i128) -> U64x2 {
589-
use crate::int::DInt;
590-
let j = i as u128;
591-
U64x2([j.lo(), j.hi()])
592-
}
593-
}
594-
595-
impl From<u128> for U64x2 {
596-
fn from(i: u128) -> U64x2 {
597-
use crate::int::DInt;
598-
U64x2([i.lo(), i.hi()])
599-
}
600-
}
601-
}

0 commit comments

Comments
 (0)