diff --git a/compiler/rustc_codegen_cranelift/patches/0029-sysroot_tests-disable-f16-math.patch b/compiler/rustc_codegen_cranelift/patches/0029-sysroot_tests-disable-f16-math.patch deleted file mode 100644 index 8d21359aa0043..0000000000000 --- a/compiler/rustc_codegen_cranelift/patches/0029-sysroot_tests-disable-f16-math.patch +++ /dev/null @@ -1,582 +0,0 @@ -From 285d5716fcfa6d43a3516d899b73bc85da322c25 Mon Sep 17 00:00:00 2001 -From: xonx <119700621+xonx4l@users.noreply.github.com> -Date: Sun, 15 Feb 2026 14:06:49 +0000 -Subject: [PATCH] Disable f16 math tests for cranelift - ---- - coretests/tests/num/floats.rs | 26 +++++++++++++------------- - 1 file changed, 13 insertions(+), 13 deletions(-) - -diff --git a/coretests/tests/num/floats.rs b/coretests/tests/num/floats.rs -index 1d7956b..01e4caa 100644 ---- a/coretests/tests/num/floats.rs -+++ b/coretests/tests/num/floats.rs -@@ -444,7 +444,7 @@ pub(crate) use float_test; - float_test! { - name: num, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -463,7 +463,7 @@ float_test! { - name: num_rem, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -476,7 +476,7 @@ float_test! { - float_test! { - name: nan, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -496,7 +496,7 @@ float_test! { - float_test! { - name: infinity, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -514,7 +514,7 @@ float_test! { - float_test! { - name: neg_infinity, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -532,7 +532,7 @@ float_test! { - float_test! { - name: zero, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -550,7 +550,7 @@ float_test! { - float_test! { - name: neg_zero, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -570,7 +570,7 @@ float_test! { - float_test! { - name: one, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -588,7 +588,7 @@ float_test! { - float_test! { - name: is_nan, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -609,7 +609,7 @@ float_test! { - float_test! { - name: is_infinite, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -630,7 +630,7 @@ float_test! { - float_test! { - name: is_finite, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -651,7 +651,7 @@ float_test! { - float_test! { - name: is_normal, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -673,7 +673,7 @@ float_test! { - float_test! { - name: classify, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - }, - test { - let nan: Float = Float::NAN; -@@ -695,7 +695,7 @@ float_test! { - name: min, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -737,7 +737,7 @@ float_test! { - name: max, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -780,7 +780,7 @@ float_test! { - name: minimum, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -812,7 +812,7 @@ float_test! { - name: maximum, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -845,7 +845,7 @@ float_test! { - name: midpoint, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -898,7 +898,7 @@ float_test! { - attrs: { - const: #[cfg(false)], - // Needs powi -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -929,7 +929,7 @@ float_test! { - name: abs, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -948,7 +948,7 @@ float_test! { - name: copysign, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -964,7 +964,7 @@ float_test! { - attrs: { - const: #[cfg(false)], - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -982,7 +982,7 @@ float_test! { - attrs: { - const: #[cfg(false)], - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -998,7 +998,7 @@ float_test! { - name: floor, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1028,7 +1028,7 @@ float_test! { - name: ceil, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1058,7 +1058,7 @@ float_test! { - name: round, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1089,7 +1089,7 @@ float_test! { - name: round_ties_even, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1120,7 +1120,7 @@ float_test! { - name: trunc, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1150,7 +1150,7 @@ float_test! { - name: fract, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1182,7 +1182,7 @@ float_test! { - name: signum, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1200,7 +1200,7 @@ float_test! { - float_test! { - name: is_sign_positive, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -1219,7 +1219,7 @@ float_test! { - float_test! { - name: is_sign_negative, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -1238,7 +1238,7 @@ float_test! { - float_test! { - name: next_up, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -1269,7 +1269,7 @@ float_test! { - float_test! { - name: next_down, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -1303,7 +1303,7 @@ float_test! { - attrs: { - const: #[cfg(false)], - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1321,7 +1321,7 @@ float_test! { - name: clamp_min_greater_than_max, - attrs: { - const: #[cfg(false)], -- f16: #[should_panic, cfg(target_has_reliable_f16)], -+ f16: #[should_panic, cfg(false)], - f32: #[should_panic], - f64: #[should_panic], - f128: #[should_panic, cfg(target_has_reliable_f128)], -@@ -1335,7 +1335,7 @@ float_test! { - name: clamp_min_is_nan, - attrs: { - const: #[cfg(false)], -- f16: #[should_panic, cfg(target_has_reliable_f16)], -+ f16: #[should_panic, cfg(false)], - f32: #[should_panic], - f64: #[should_panic], - f128: #[should_panic, cfg(target_has_reliable_f128)], -@@ -1349,7 +1349,7 @@ float_test! { - name: clamp_max_is_nan, - attrs: { - const: #[cfg(false)], -- f16: #[should_panic, cfg(target_has_reliable_f16)], -+ f16: #[should_panic, cfg(false)], - f32: #[should_panic], - f64: #[should_panic], - f128: #[should_panic, cfg(target_has_reliable_f128)], -@@ -1363,7 +1363,7 @@ float_test! { - name: total_cmp, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1469,7 +1469,7 @@ float_test! { - attrs: { - const: #[cfg(false)], - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1526,7 +1526,7 @@ float_test! { - name: recip, - attrs: { - // Miri only uses softfloats here, so that always works -- f16: #[cfg(any(miri, target_has_reliable_f16_math))], -+ f16: #[cfg(false)], - f128: #[cfg(any(miri, target_has_reliable_f128_math))], - }, - test { -@@ -1549,7 +1549,7 @@ float_test! { - name: powi, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1570,7 +1570,7 @@ float_test! { - name: powf, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1593,7 +1593,7 @@ float_test! { - name: exp, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1614,7 +1614,7 @@ float_test! { - name: exp2, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1634,7 +1634,7 @@ float_test! { - name: ln, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1656,7 +1656,7 @@ float_test! { - name: log, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1681,7 +1681,7 @@ float_test! { - name: log2, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1704,7 +1704,7 @@ float_test! { - name: log10, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1728,7 +1728,7 @@ float_test! { - name: asinh, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1764,7 +1764,7 @@ float_test! { - name: acosh, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1795,7 +1795,7 @@ float_test! { - name: atanh, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1821,7 +1821,7 @@ float_test! { - name: gamma, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1856,7 +1856,7 @@ float_test! { - name: ln_gamma, - attrs: { - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { -@@ -1874,7 +1874,7 @@ float_test! { - float_test! { - name: to_degrees, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -1895,7 +1895,7 @@ float_test! { - float_test! { - name: to_radians, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -1916,7 +1916,7 @@ float_test! { - float_test! { - name: to_algebraic, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -1940,7 +1940,7 @@ float_test! { - float_test! { - name: to_bits_conv, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -1967,7 +1967,7 @@ float_test! { - float_test! { - name: mul_add, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - // FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/ - f32: #[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)], - f64: #[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)], -@@ -1992,7 +1992,7 @@ float_test! { - float_test! { - name: from, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -2049,7 +2049,7 @@ float_test! { - float_test! { - name: max_exact_integer_constant, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -2091,7 +2091,7 @@ float_test! { - float_test! { - name: min_exact_integer_constant, - attrs: { -- f16: #[cfg(target_has_reliable_f16)], -+ f16: #[cfg(false)], - f128: #[cfg(target_has_reliable_f128)], - }, - test { -@@ -2156,7 +2156,7 @@ float_test! { - attrs: { - // FIXME(f16_f128): add math tests when available - const: #[cfg(false)], -- f16: #[cfg(target_has_reliable_f16_math)], -+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) - f128: #[cfg(target_has_reliable_f128_math)], - }, - test { --- -2.50.1 diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs index d4bb8bd019331..0598e6909ce2e 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs @@ -314,11 +314,11 @@ fn codegen_float_intrinsic_call<'tcx>( ret: CPlace<'tcx>, ) -> bool { let (name, arg_count, ty, clif_ty) = match intrinsic { - sym::expf16 => ("expf16", 1, fx.tcx.types.f16, types::F16), + sym::expf16 => return false, // has a fallback via f32 sym::expf32 => ("expf", 1, fx.tcx.types.f32, types::F32), sym::expf64 => ("exp", 1, fx.tcx.types.f64, types::F64), sym::expf128 => ("expf128", 1, fx.tcx.types.f128, types::F128), - sym::exp2f16 => ("exp2f16", 1, fx.tcx.types.f16, types::F16), + sym::exp2f16 => return false, // has a fallback via f32 sym::exp2f32 => ("exp2f", 1, fx.tcx.types.f32, types::F32), sym::exp2f64 => ("exp2", 1, fx.tcx.types.f64, types::F64), sym::exp2f128 => ("exp2f128", 1, fx.tcx.types.f128, types::F128), @@ -330,19 +330,20 @@ fn codegen_float_intrinsic_call<'tcx>( sym::powif32 => ("__powisf2", 2, fx.tcx.types.f32, types::F32), // compiler-builtins sym::powif64 => ("__powidf2", 2, fx.tcx.types.f64, types::F64), // compiler-builtins sym::powif128 => ("__powitf2", 2, fx.tcx.types.f128, types::F128), // compiler-builtins - sym::powf16 => ("powf16", 2, fx.tcx.types.f16, types::F16), + + sym::powf16 => return false, // has a fallback via f32 sym::powf32 => ("powf", 2, fx.tcx.types.f32, types::F32), sym::powf64 => ("pow", 2, fx.tcx.types.f64, types::F64), sym::powf128 => ("powf128", 2, fx.tcx.types.f128, types::F128), - sym::logf16 => ("logf16", 1, fx.tcx.types.f16, types::F16), + sym::logf16 => return false, // has a fallback via f32 sym::logf32 => ("logf", 1, fx.tcx.types.f32, types::F32), sym::logf64 => ("log", 1, fx.tcx.types.f64, types::F64), sym::logf128 => ("logf128", 1, fx.tcx.types.f128, types::F128), - sym::log2f16 => ("log2f16", 1, fx.tcx.types.f16, types::F16), + sym::log2f16 => return false, // has a fallback via f32 sym::log2f32 => ("log2f", 1, fx.tcx.types.f32, types::F32), sym::log2f64 => ("log2", 1, fx.tcx.types.f64, types::F64), sym::log2f128 => ("log2f128", 1, fx.tcx.types.f128, types::F128), - sym::log10f16 => ("log10f16", 1, fx.tcx.types.f16, types::F16), + sym::log10f16 => return false, // has a fallback via f32 sym::log10f32 => ("log10f", 1, fx.tcx.types.f32, types::F32), sym::log10f64 => ("log10", 1, fx.tcx.types.f64, types::F64), sym::log10f128 => ("log10f128", 1, fx.tcx.types.f128, types::F128),