Skip to content

Commit

Permalink
Auto merge of #128349 - tgross35:x86-f16, r=<try>
Browse files Browse the repository at this point in the history
Enable `f16` on x86 and x86-64

Since the `compiler_builtins` update [1], ABI bugs on x86 should be resolved. Enable tests for f16 on these platforms now.

[1]: #125016

try-job: i686-gnu
try-job: dist-i586-gnu-i586-i686-musl
  • Loading branch information
bors committed Jul 29, 2024
2 parents 4db3d12 + bd348e0 commit 1d3189c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
26 changes: 13 additions & 13 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let nan = f16::NAN;
/// let f = 7.0_f16;
Expand Down Expand Up @@ -301,7 +301,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let f = 7.0f16;
/// let inf = f16::INFINITY;
Expand All @@ -328,7 +328,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let f = 7.0f16;
/// let inf: f16 = f16::INFINITY;
Expand Down Expand Up @@ -357,7 +357,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let min = f16::MIN_POSITIVE; // 6.1035e-5
/// let max = f16::MAX;
Expand Down Expand Up @@ -388,7 +388,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let min = f16::MIN_POSITIVE; // 6.1035e-5
/// let max = f16::MAX;
Expand Down Expand Up @@ -421,7 +421,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// use std::num::FpCategory;
///
Expand Down Expand Up @@ -744,7 +744,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let value = 4.6_f16;
/// let rounded = unsafe { value.to_int_unchecked::<u16>() };
Expand Down Expand Up @@ -787,7 +787,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// # // FIXME(f16_f128): enable this once const casting works
/// # // assert_ne!((1f16).to_bits(), 1f16 as u128); // to_bits() is not casting!
Expand Down Expand Up @@ -876,7 +876,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let v = f16::from_bits(0x4a40);
/// assert_eq!(v, 12.5);
Expand Down Expand Up @@ -1030,7 +1030,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let value = f16::from_be_bytes([0x4a, 0x40]);
/// assert_eq!(value, 12.5);
Expand All @@ -1053,7 +1053,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let value = f16::from_le_bytes([0x40, 0x4a]);
/// assert_eq!(value, 12.5);
Expand Down Expand Up @@ -1083,7 +1083,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// let value = f16::from_ne_bytes(if cfg!(target_endian = "big") {
/// [0x4a, 0x40]
Expand Down Expand Up @@ -1217,7 +1217,7 @@ impl f16 {
///
/// ```
/// #![feature(f16)]
/// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
/// # #[cfg(target_arch = "x86_64")] {
///
/// assert!((-3.0f16).clamp(-2.0, 1.0) == -2.0);
/// assert!((0.0f16).clamp(-2.0, 1.0) == 0.0);
Expand Down
3 changes: 0 additions & 3 deletions library/std/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ fn main() {
("arm64ec", _) => false,
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
("x86", "windows") => false,
// x86 has ABI bugs that show up with optimizations. This should be partially fixed with
// the compiler-builtins update. <https://github.com/rust-lang/rust/issues/123885>
("x86" | "x86_64", _) => false,
// Missing `__gnu_h2f_ieee` and `__gnu_f2h_ieee`
("powerpc" | "powerpc64", _) => false,
// Missing `__gnu_h2f_ieee` and `__gnu_f2h_ieee`
Expand Down

0 comments on commit 1d3189c

Please sign in to comment.