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