@@ -201,14 +201,36 @@ impl CodegenBackend for CraneliftCodegenBackend {
201201 // FIXME do `unstable_target_features` properly
202202 let unstable_target_features = target_features. clone ( ) ;
203203
204+ // FIXME(f16_f128): LLVM 20 (currently used by `rustc`) passes `f128` in XMM registers on
205+ // Windows, whereas LLVM 21+ and Cranelift pass it indirectly. This means that `f128` won't
206+ // work when linking against a LLVM-built sysroot.
207+ let has_reliable_f128 = !sess. target . is_like_windows ;
208+ let has_reliable_f16 = match & * sess. target . arch {
209+ // FIXME(f16_f128): LLVM 20 does not support `f16` on s390x, meaning the required
210+ // builtins are not available in `compiler-builtins`.
211+ "s390x" => false ,
212+ // FIXME(f16_f128): `rustc_codegen_llvm` currently disables support on Windows GNU
213+ // targets due to GCC using a different ABI than LLVM. Therefore `f16` won't be
214+ // available when using a LLVM-built sysroot.
215+ "x86_64"
216+ if sess. target . os == "windows"
217+ && sess. target . env == "gnu"
218+ && sess. target . abi != "llvm" =>
219+ {
220+ false
221+ }
222+ _ => true ,
223+ } ;
224+
204225 TargetConfig {
205226 target_features,
206227 unstable_target_features,
207- // Cranelift does not yet support f16 or f128
208- has_reliable_f16 : false ,
209- has_reliable_f16_math : false ,
210- has_reliable_f128 : false ,
211- has_reliable_f128_math : false ,
228+ // `rustc_codegen_cranelift` polyfills functionality not yet
229+ // available in Cranelift.
230+ has_reliable_f16,
231+ has_reliable_f16_math : has_reliable_f16,
232+ has_reliable_f128,
233+ has_reliable_f128_math : has_reliable_f128,
212234 }
213235 }
214236
0 commit comments