Skip to content

Commit 3232a1d

Browse files
committed
Auto merge of #146023 - tgross35:rollup-gbec538, r=tgross35
Rollup of 9 pull requests Successful merges: - rust-lang/rust#145242 (std: use a TAIT to define `SplitPaths` on UNIX) - rust-lang/rust#145467 (Stabilize `strict_provenance_atomic_ptr` feature) - rust-lang/rust#145756 (str: Stabilize `round_char_boundary` feature) - rust-lang/rust#145967 (compiler: Include span of too huge enum with `-Cdebuginfo=2`) - rust-lang/rust#145990 (`AutoDeref::final_ty` is already resolved) - rust-lang/rust#145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`) - rust-lang/rust#146000 (Improve librustdoc error when a file creation/modification failed) - rust-lang/rust#146017 (Mark pipe2 supported in Android) - rust-lang/rust#146022 (compiler-builtins subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 414abe6 + 6ad7407 commit 3232a1d

File tree

15 files changed

+117
-37
lines changed

15 files changed

+117
-37
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ jobs:
5151
- target: aarch64-unknown-linux-gnu
5252
os: ubuntu-24.04-arm
5353
- target: aarch64-pc-windows-msvc
54-
os: windows-2025
55-
build_only: 1
54+
os: windows-11-arm
5655
- target: arm-unknown-linux-gnueabi
5756
os: ubuntu-24.04
5857
- target: arm-unknown-linux-gnueabihf

builtins-test/benches/float_conv.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(improper_ctypes)]
21
#![cfg_attr(f128_enabled, feature(f128))]
32

43
use builtins_test::float_bench;

builtins-test/tests/addsub.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(unused_macros)]
2+
#![cfg_attr(f16_enabled, feature(f16))]
23
#![cfg_attr(f128_enabled, feature(f128))]
34

45
use builtins_test::*;
@@ -115,28 +116,25 @@ macro_rules! float_sum {
115116
mod float_addsub {
116117
use super::*;
117118

119+
#[cfg(f16_enabled)]
120+
float_sum! {
121+
f16, __addhf3, __subhf3, Half, all();
122+
}
123+
118124
float_sum! {
119125
f32, __addsf3, __subsf3, Single, all();
120126
f64, __adddf3, __subdf3, Double, all();
121127
}
122-
}
123-
124-
#[cfg(f128_enabled)]
125-
#[cfg(not(x86_no_sse))]
126-
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
127-
mod float_addsub_f128 {
128-
use super::*;
129128

129+
#[cfg(f128_enabled)]
130+
#[cfg(not(x86_no_sse))]
131+
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
130132
float_sum! {
131133
f128, __addtf3, __subtf3, Quad, not(feature = "no-sys-f128");
132134
}
133-
}
134-
135-
#[cfg(f128_enabled)]
136-
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
137-
mod float_addsub_f128_ppc {
138-
use super::*;
139135

136+
#[cfg(f128_enabled)]
137+
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
140138
float_sum! {
141139
f128, __addkf3, __subkf3, Quad, not(feature = "no-sys-f128");
142140
}

builtins-test/tests/cmp.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![allow(unused_macros)]
22
#![allow(unreachable_code)]
3+
#![cfg_attr(f16_enabled, feature(f16))]
34
#![cfg_attr(f128_enabled, feature(f128))]
45

56
use builtins_test::*;
@@ -51,6 +52,26 @@ mod float_comparisons {
5152
};
5253
}
5354

55+
#[test]
56+
#[cfg(f16_enabled)]
57+
fn cmp_f16() {
58+
use compiler_builtins::float::cmp::{
59+
__eqhf2, __gehf2, __gthf2, __lehf2, __lthf2, __nehf2, __unordhf2,
60+
};
61+
62+
fuzz_float_2(N, |x: f16, y: f16| {
63+
assert_eq!(__unordhf2(x, y) != 0, x.is_nan() || y.is_nan());
64+
cmp!(f16, x, y, Half, all(),
65+
1, __lthf2;
66+
1, __lehf2;
67+
1, __eqhf2;
68+
-1, __gehf2;
69+
-1, __gthf2;
70+
1, __nehf2;
71+
);
72+
});
73+
}
74+
5475
#[test]
5576
fn cmp_f32() {
5677
use compiler_builtins::float::cmp::{

builtins-test/tests/mul.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#![allow(unused_macros)]
1+
#![cfg_attr(f16_enabled, feature(f16))]
22
#![cfg_attr(f128_enabled, feature(f128))]
3+
#![allow(unused_macros)]
34

45
use builtins_test::*;
56

@@ -117,6 +118,11 @@ macro_rules! float_mul {
117118
mod float_mul {
118119
use super::*;
119120

121+
#[cfg(f16_enabled)]
122+
float_mul! {
123+
f16, __mulhf3, Half, all();
124+
}
125+
120126
// FIXME(#616): Stop ignoring arches that don't have native support once fix for builtins is in
121127
// nightly.
122128
float_mul! {

compiler-builtins/src/float/add.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ where
130130
return F::from_bits(MinInt::ZERO);
131131
}
132132

133-
// If partial cancellation occured, we need to left-shift the result
133+
// If partial cancellation occurred, we need to left-shift the result
134134
// and adjust the exponent:
135135
if a_significand < implicit_bit << 3 {
136136
let shift = a_significand.leading_zeros() as i32
@@ -191,6 +191,11 @@ where
191191
}
192192

193193
intrinsics! {
194+
#[cfg(f16_enabled)]
195+
pub extern "C" fn __addhf3(a: f16, b: f16) -> f16 {
196+
add(a, b)
197+
}
198+
194199
#[aapcs_on_arm]
195200
#[arm_aeabi_alias = __aeabi_fadd]
196201
pub extern "C" fn __addsf3(a: f32, b: f32) -> f32 {

compiler-builtins/src/float/cmp.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,37 @@ fn unord<F: Float>(a: F, b: F) -> bool {
115115
a_abs > inf_rep || b_abs > inf_rep
116116
}
117117

118+
#[cfg(f16_enabled)]
119+
intrinsics! {
120+
pub extern "C" fn __lehf2(a: f16, b: f16) -> crate::float::cmp::CmpResult {
121+
cmp(a, b).to_le_abi()
122+
}
123+
124+
pub extern "C" fn __gehf2(a: f16, b: f16) -> crate::float::cmp::CmpResult {
125+
cmp(a, b).to_ge_abi()
126+
}
127+
128+
pub extern "C" fn __unordhf2(a: f16, b: f16) -> crate::float::cmp::CmpResult {
129+
unord(a, b) as crate::float::cmp::CmpResult
130+
}
131+
132+
pub extern "C" fn __eqhf2(a: f16, b: f16) -> crate::float::cmp::CmpResult {
133+
cmp(a, b).to_le_abi()
134+
}
135+
136+
pub extern "C" fn __lthf2(a: f16, b: f16) -> crate::float::cmp::CmpResult {
137+
cmp(a, b).to_le_abi()
138+
}
139+
140+
pub extern "C" fn __nehf2(a: f16, b: f16) -> crate::float::cmp::CmpResult {
141+
cmp(a, b).to_le_abi()
142+
}
143+
144+
pub extern "C" fn __gthf2(a: f16, b: f16) -> crate::float::cmp::CmpResult {
145+
cmp(a, b).to_ge_abi()
146+
}
147+
}
148+
118149
intrinsics! {
119150
pub extern "C" fn __lesf2(a: f32, b: f32) -> crate::float::cmp::CmpResult {
120151
cmp(a, b).to_le_abi()

compiler-builtins/src/float/mul.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ where
180180
}
181181

182182
intrinsics! {
183+
#[cfg(f16_enabled)]
184+
pub extern "C" fn __mulhf3(a: f16, b: f16) -> f16 {
185+
mul(a, b)
186+
}
187+
183188
#[aapcs_on_arm]
184189
#[arm_aeabi_alias = __aeabi_fmul]
185190
pub extern "C" fn __mulsf3(a: f32, b: f32) -> f32 {

compiler-builtins/src/float/sub.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
use crate::float::Float;
22

33
intrinsics! {
4+
#[cfg(f16_enabled)]
5+
pub extern "C" fn __subhf3(a: f16, b: f16) -> f16 {
6+
crate::float::add::__addhf3(a, f16::from_bits(b.to_bits() ^ f16::SIGN_MASK))
7+
}
8+
49
#[arm_aeabi_alias = __aeabi_fsub]
510
pub extern "C" fn __subsf3(a: f32, b: f32) -> f32 {
611
crate::float::add::__addsf3(a, f32::from_bits(b.to_bits() ^ f32::SIGN_MASK))

compiler-builtins/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
#![no_std]
1919
#![allow(unused_features)]
2020
#![allow(internal_features)]
21-
// We use `u128` in a whole bunch of places which we currently agree with the
22-
// compiler on ABIs and such, so we should be "good enough" for now and changes
23-
// to the `u128` ABI will be reflected here.
24-
#![allow(improper_ctypes, improper_ctypes_definitions)]
2521
// `mem::swap` cannot be used because it may generate references to memcpy in unoptimized code.
2622
#![allow(clippy::manual_swap)]
2723
// Support compiling on both stage0 and stage1 which may differ in supported stable features.

0 commit comments

Comments
 (0)