Skip to content

Commit 28eb849

Browse files
committed
Allow f16 and f128 on s390x and non-mingw windows
1 parent 296501b commit 28eb849

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

src/lib.rs

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -182,36 +182,23 @@ impl CodegenBackend for CraneliftCodegenBackend {
182182
// FIXME do `unstable_target_features` properly
183183
let unstable_target_features = target_features.clone();
184184

185-
// FIXME(f16_f128): LLVM 20 (currently used by `rustc`) passes `f128` in XMM registers on
186-
// Windows, whereas LLVM 21+ and Cranelift pass it indirectly. This means that `f128` won't
187-
// work when linking against a LLVM-built sysroot.
188-
let has_reliable_f128 = !sess.target.is_like_windows;
189-
let has_reliable_f16 = match &*sess.target.arch {
190-
// FIXME(f16_f128): LLVM 20 does not support `f16` on s390x, meaning the required
191-
// builtins are not available in `compiler-builtins`.
192-
"s390x" => false,
193-
// FIXME(f16_f128): `rustc_codegen_llvm` currently disables support on Windows GNU
194-
// targets due to GCC using a different ABI than LLVM. Therefore `f16` won't be
195-
// available when using a LLVM-built sysroot.
196-
"x86_64"
197-
if sess.target.os == "windows"
198-
&& sess.target.env == "gnu"
199-
&& sess.target.abi != "llvm" =>
200-
{
201-
false
202-
}
203-
_ => true,
204-
};
185+
// FIXME(f16_f128): `rustc_codegen_llvm` currently disables support on Windows GNU
186+
// targets due to GCC using a different ABI than LLVM. Therefore `f16` and `f128`
187+
// won't be available when using a LLVM-built sysroot.
188+
let has_reliable_f16_f128 = !(sess.target.arch == "x86_64"
189+
&& sess.target.os == "windows"
190+
&& sess.target.env == "gnu"
191+
&& sess.target.abi != "llvm");
205192

206193
TargetConfig {
207194
target_features,
208195
unstable_target_features,
209196
// `rustc_codegen_cranelift` polyfills functionality not yet
210197
// available in Cranelift.
211-
has_reliable_f16,
212-
has_reliable_f16_math: has_reliable_f16,
213-
has_reliable_f128,
214-
has_reliable_f128_math: has_reliable_f128,
198+
has_reliable_f16: has_reliable_f16_f128,
199+
has_reliable_f16_math: has_reliable_f16_f128,
200+
has_reliable_f128: has_reliable_f16_f128,
201+
has_reliable_f128_math: has_reliable_f16_f128,
215202
}
216203
}
217204

0 commit comments

Comments
 (0)