@@ -51,31 +51,46 @@ impl Target {
51
51
/// Configure whether or not `f16` and `f128` support should be enabled.
52
52
pub fn configure_f16_f128 ( target : & Target ) {
53
53
// Set whether or not `f16` and `f128` are supported at a basic level by LLVM. This only means
54
- // that the backend will not crash when using these types. This does not mean that the
55
- // backend does the right thing, or that the platform doesn't have ABI bugs.
54
+ // that the backend will not crash when using these types and generates code that can be called
55
+ // without crashing (no infinite recursion). This does not mean that the platform doesn't have
56
+ // ABI or other bugs.
56
57
//
57
58
// We do this here rather than in `rust-lang/rust` because configuring via cargo features is
58
59
// not straightforward.
59
60
//
60
61
// Original source of this list:
61
62
// <https://github.com/rust-lang/compiler-builtins/pull/652#issuecomment-2266151350>
62
- let ( f16_ok, f128_ok) = match target. arch . as_str ( ) {
63
- // `f16` and `f128` both crash <https://github.com/llvm/llvm-project/issues/94434>
64
- "arm64ec" => ( false , false ) ,
65
- // `f16` crashes <https://github.com/llvm/llvm-project/issues/50374>
66
- "s390x" => ( false , true ) ,
67
- // FIXME(llvm): `f16` test failures fixed by <https://github.com/llvm/llvm-project/pull/107791>
68
- "loongarch64" => ( false , true ) ,
69
- // `f128` crashes <https://github.com/llvm/llvm-project/issues/96432>
70
- "mips64" | "mips64r6" => ( true , false ) ,
71
- // `f128` crashes <https://github.com/llvm/llvm-project/issues/101545>
72
- "powerpc64" if & target. os == "aix" => ( true , false ) ,
73
- // `f128` crashes <https://github.com/llvm/llvm-project/issues/41838>
74
- "sparc" => ( true , false ) ,
75
- // `f16` miscompiles <https://github.com/llvm/llvm-project/issues/96438>
76
- "wasm32" | "wasm64" => ( false , true ) ,
63
+ let f16_enabled = match target. arch . as_str ( ) {
64
+ // Unsupported <https://github.com/llvm/llvm-project/issues/94434>
65
+ "arm64ec" => false ,
66
+ // Selection failure <https://github.com/llvm/llvm-project/issues/50374>
67
+ "s390x" => false ,
68
+ // Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
69
+ // FIXME(llvm): loongarch fixed by <https://github.com/llvm/llvm-project/pull/107791>
70
+ "csky" => false ,
71
+ "hexagon" => false ,
72
+ "loongarch64" => false ,
73
+ "mips" | "mips64" | "mips32r6" | "mips64r6" => false ,
74
+ "powerpc" | "powerpc64" => false ,
75
+ "sparc" | "sparc64" => false ,
76
+ "wasm32" | "wasm64" => false ,
77
77
// Most everything else works as of LLVM 19
78
- _ => ( true , true ) ,
78
+ _ => true ,
79
+ } ;
80
+
81
+ let f128_enabled = match target. arch . as_str ( ) {
82
+ // Unsupported <https://github.com/llvm/llvm-project/issues/94434>
83
+ "arm64ec" => false ,
84
+ // Selection failure <https://github.com/llvm/llvm-project/issues/96432>
85
+ "mips64" | "mips64r6" => false ,
86
+ // Selection failure <https://github.com/llvm/llvm-project/issues/95471>
87
+ "nvptx64" => false ,
88
+ // Selection failure <https://github.com/llvm/llvm-project/issues/101545>
89
+ "powerpc64" if & target. os == "aix" => false ,
90
+ // Selection failure <https://github.com/llvm/llvm-project/issues/41838>
91
+ "sparc" => false ,
92
+ // Most everything else works as of LLVM 19
93
+ _ => true ,
79
94
} ;
80
95
81
96
// If the feature is set, disable these types.
@@ -84,11 +99,11 @@ pub fn configure_f16_f128(target: &Target) {
84
99
println ! ( "cargo::rustc-check-cfg=cfg(f16_enabled)" ) ;
85
100
println ! ( "cargo::rustc-check-cfg=cfg(f128_enabled)" ) ;
86
101
87
- if f16_ok && !disable_both {
102
+ if f16_enabled && !disable_both {
88
103
println ! ( "cargo::rustc-cfg=f16_enabled" ) ;
89
104
}
90
105
91
- if f128_ok && !disable_both {
106
+ if f128_enabled && !disable_both {
92
107
println ! ( "cargo::rustc-cfg=f128_enabled" ) ;
93
108
}
94
109
}
0 commit comments