Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,8 @@ impl MsvcBasicName for ty::UintTy {

impl MsvcBasicName for ty::FloatTy {
fn msvc_basic_name(self) -> &'static str {
// FIXME(f16_f128): `f16` and `f128` have no MSVC representation. We could improve the
// debuginfo. See: <https://github.com/rust-lang/rust/issues/121837>
// FIXME(f128): `f128` has no MSVC representation. We could improve the debuginfo.
// See: <https://github.com/rust-lang/rust/issues/121837>
match self {
ty::FloatTy::F16 => {
bug!("`f16` should have been handled in `build_basic_type_di_node`")
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/asm/riscv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl RiscVInlineAsmRegClass {
types! { _: I8, I16, I32, F16, F32; }
}
}
// FIXME(f16_f128): Add `q: F128;` once LLVM support the `Q` extension.
// FIXME(f128): Add `q: F128;` once LLVM support the `Q` extension.
Self::freg => types! { f: F16, F32; d: F64; },
Self::vreg => &[],
}
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/convert/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl_from!(i16 => isize, #[stable(feature = "lossless_iusize_conv", since = "1.2
// * 53 bits in f64
// * 113 bits in f128
// Lossy float conversions are not implemented at this time.
// FIXME(f16_f128): The `f16`/`f128` impls `#[stable]` attributes should be changed to reference
// FIXME(f16,f128): The `f16`/`f128` impls `#[stable]` attributes should be changed to reference
// `f16`/`f128` when they are stabilised (trait impls have to have a `#[stable]` attribute, but none
// of the `f16`/`f128` impls can be used on stable as the `f16` and `f128` types are unstable).

Expand All @@ -168,7 +168,7 @@ impl_from!(i16 => f64, #[stable(feature = "lossless_float_conv", since = "1.6.0"
impl_from!(i16 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
impl_from!(i32 => f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
impl_from!(i32 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
// FIXME(f16_f128): This impl would allow using `f128` on stable before it is stabilised.
// FIXME(f128): This impl would allow using `f128` on stable before it is stabilised.
// impl_from!(i64 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);

// unsigned integer -> float
Expand All @@ -181,11 +181,11 @@ impl_from!(u16 => f64, #[stable(feature = "lossless_float_conv", since = "1.6.0"
impl_from!(u16 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
impl_from!(u32 => f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
impl_from!(u32 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
// FIXME(f16_f128): This impl would allow using `f128` on stable before it is stabilised.
// FIXME(f128): This impl would allow using `f128` on stable before it is stabilised.
// impl_from!(u64 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);

// float -> float
// FIXME(f16_f128): adding additional `From<{float}>` impls to `f32` breaks inference. See
// FIXME(f16,f128): adding additional `From<{float}>` impls to `f32` breaks inference. See
// <https://github.com/rust-lang/rust/issues/123831>
impl_from!(f16 => f64, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
impl_from!(f16 => f128, #[stable(feature = "lossless_float_conv", since = "1.6.0")]);
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/fmt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ floating! { f32 f64 }
#[cfg(target_has_reliable_f16)]
floating! { f16 }

// FIXME(f16_f128): A fallback is used when the backend+target does not support f16 well, in order
// FIXME(f16): A fallback is used when the backend+target does not support f16 well, in order
// to avoid ICEs.

#[cfg(not(target_has_reliable_f16))]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/num/dec2flt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ from_str_float_impl!(f16);
from_str_float_impl!(f32);
from_str_float_impl!(f64);

// FIXME(f16_f128): A fallback is used when the backend+target does not support f16 well, in order
// FIXME(f16): A fallback is used when the backend+target does not support f16 well, in order
// to avoid ICEs.

#[cfg(not(target_has_reliable_f16))]
Expand Down
87 changes: 30 additions & 57 deletions library/core/src/num/f128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,8 @@ pub mod consts {
pub const LN_10: f128 = 2.30258509299404568401799145468436420760110148862877297603333_f128;
}

#[doc(test(attr(feature(cfg_target_has_reliable_f16_f128), allow(internal_features))))]
impl f128 {
// FIXME(f16_f128): almost all methods in this `impl` are missing examples and a const
// implementation. Add these once we can run code on all platforms and have f16/f128 in CTFE.

/// The radix or base of the internal representation of `f128`.
#[unstable(feature = "f128", issue = "116909")]
pub const RADIX: u32 = 2;
Expand Down Expand Up @@ -277,8 +275,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `unordtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let nan = f128::NAN;
/// let f = 7.0_f128;
Expand All @@ -300,8 +297,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let f = 7.0f128;
/// let inf = f128::INFINITY;
Expand All @@ -326,8 +322,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `lttf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let f = 7.0f128;
/// let inf: f128 = f128::INFINITY;
Expand Down Expand Up @@ -355,8 +350,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let min = f128::MIN_POSITIVE; // 3.362103143e-4932f128
/// let max = f128::MAX;
Expand Down Expand Up @@ -386,8 +380,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let min = f128::MIN_POSITIVE; // 3.362103143e-4932f128
/// let max = f128::MAX;
Expand Down Expand Up @@ -419,8 +412,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// use std::num::FpCategory;
///
Expand Down Expand Up @@ -514,8 +506,7 @@ impl f128 {
///
/// ```rust
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// // f128::EPSILON is the difference between 1.0 and the next number up.
/// assert_eq!(1.0f128.next_up(), 1.0 + f128::EPSILON);
Expand Down Expand Up @@ -569,8 +560,7 @@ impl f128 {
///
/// ```rust
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let x = 1.0f128;
/// // Clamp value into range [0, 1).
Expand Down Expand Up @@ -613,8 +603,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let x = 2.0_f128;
/// let abs_difference = (x.recip() - (1.0 / x)).abs();
Expand All @@ -640,8 +629,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let angle = std::f128::consts::PI;
///
Expand Down Expand Up @@ -671,8 +659,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let angle = 180.0f128;
///
Expand Down Expand Up @@ -706,8 +693,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128_math)] {
///
/// let x = 1.0f128;
/// let y = 2.0f128;
Expand Down Expand Up @@ -738,8 +724,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128_math)] {
///
/// let x = 1.0f128;
/// let y = 2.0f128;
Expand Down Expand Up @@ -771,8 +756,7 @@ impl f128 {
/// ```
/// #![feature(f128)]
/// #![feature(float_minimum_maximum)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128_math)] {
///
/// let x = 1.0f128;
/// let y = 2.0f128;
Expand Down Expand Up @@ -804,8 +788,7 @@ impl f128 {
/// ```
/// #![feature(f128)]
/// #![feature(float_minimum_maximum)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128_math)] {
///
/// let x = 1.0f128;
/// let y = 2.0f128;
Expand All @@ -831,8 +814,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // Using aarch64 because `reliable_f128_math` is needed
/// # #[cfg(all(target_arch = "aarch64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// assert_eq!(1f128.midpoint(4.0), 2.5);
/// assert_eq!((-5.5f128).midpoint(8.0), 1.25);
Expand Down Expand Up @@ -862,8 +844,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `float*itf` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let value = 4.6_f128;
/// let rounded = unsafe { value.to_int_unchecked::<u16>() };
Expand Down Expand Up @@ -906,10 +887,11 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # #[cfg(target_has_reliable_f128)] {
///
/// # // FIXME(f16_f128): enable this once const casting works
/// # // assert_ne!((1f128).to_bits(), 1f128 as u128); // to_bits() is not casting!
/// assert_ne!((1f128).to_bits(), 1f128 as u128); // to_bits() is not casting!
/// assert_eq!((12.5f128).to_bits(), 0x40029000000000000000000000000000);
/// # }
/// ```
#[inline]
#[unstable(feature = "f128", issue = "116909")]
Expand Down Expand Up @@ -952,8 +934,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let v = f128::from_bits(0x40029000000000000000000000000000);
/// assert_eq!(v, 12.5);
Expand Down Expand Up @@ -1064,8 +1045,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let value = f128::from_be_bytes(
/// [0x40, 0x02, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -1090,8 +1070,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let value = f128::from_le_bytes(
/// [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1123,8 +1102,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `eqtf2` is available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let value = f128::from_ne_bytes(if cfg!(target_endian = "big") {
/// [0x40, 0x02, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1257,8 +1235,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # // FIXME(f16_f128): remove when `{eq,gt,unord}tf` are available
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// assert!((-3.0f128).clamp(-2.0, 1.0) == -2.0);
/// assert!((0.0f128).clamp(-2.0, 1.0) == 0.0);
Expand Down Expand Up @@ -1333,7 +1310,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let x = 3.5_f128;
/// let y = -3.5_f128;
Expand All @@ -1349,9 +1326,7 @@ impl f128 {
#[rustc_const_unstable(feature = "f128", issue = "116909")]
#[must_use = "method returns a new number and does not mutate the original value"]
pub const fn abs(self) -> Self {
// FIXME(f16_f128): replace with `intrinsics::fabsf128` when available
// We don't do this now because LLVM has lowering bugs for f128 math.
Self::from_bits(self.to_bits() & !(1 << 127))
intrinsics::fabsf128(self)
}

/// Returns a number that represents the sign of `self`.
Expand All @@ -1364,7 +1339,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let f = 3.5_f128;
///
Expand Down Expand Up @@ -1400,7 +1375,7 @@ impl f128 {
///
/// ```
/// #![feature(f128)]
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
/// # #[cfg(target_has_reliable_f128)] {
///
/// let f = 3.5_f128;
///
Expand Down Expand Up @@ -1477,8 +1452,6 @@ impl f128 {
}

// Functions in this module fall into `core_float_math`
// FIXME(f16_f128): all doctests must be gated to platforms that have `long double` === `_Float128`
// due to https://github.com/llvm/llvm-project/issues/44744. aarch64 linux matches this.
// #[unstable(feature = "core_float_math", issue = "137578")]
#[cfg(not(test))]
#[doc(test(attr(feature(cfg_target_has_reliable_f16_f128), expect(internal_features))))]
Expand Down
6 changes: 1 addition & 5 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ pub mod consts {

#[doc(test(attr(feature(cfg_target_has_reliable_f16_f128), allow(internal_features))))]
impl f16 {
// FIXME(f16_f128): almost all methods in this `impl` are missing examples and a const
// implementation. Add these once we can run code on all platforms and have f16/f128 in CTFE.

/// The radix or base of the internal representation of `f16`.
#[unstable(feature = "f16", issue = "116909")]
pub const RADIX: u32 = 2;
Expand Down Expand Up @@ -887,8 +884,7 @@ impl f16 {
/// #![feature(f16)]
/// # #[cfg(target_has_reliable_f16)] {
///
/// # // FIXME(f16_f128): enable this once const casting works
/// # // assert_ne!((1f16).to_bits(), 1f16 as u128); // to_bits() is not casting!
/// assert_ne!((1f16).to_bits(), 1f16 as u16); // to_bits() is not casting!
/// assert_eq!((12.5f16).to_bits(), 0x4a40);
/// # }
/// ```
Expand Down
Loading
Loading