Skip to content

Commit ea38a04

Browse files
committed
Add math functions
1 parent 3b7e69a commit ea38a04

File tree

9 files changed

+3406
-92
lines changed

9 files changed

+3406
-92
lines changed

‎library/std/build.rs

+24
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ fn main() {
8585
println!("cargo:rustc-check-cfg=cfg(reliable_f16)");
8686
println!("cargo:rustc-check-cfg=cfg(reliable_f128)");
8787

88+
// This is a step beyond only having the types and basic functions available. Math functions
89+
// aren't consistently available or correct.
90+
println!("cargo:rustc-check-cfg=cfg(reliable_f16_math)");
91+
println!("cargo:rustc-check-cfg=cfg(reliable_f128_math)");
92+
8893
let has_reliable_f16 = match (target_arch.as_str(), target_os.as_str()) {
8994
// Selection failure until recent LLVM <https://github.com/llvm/llvm-project/issues/93894>
9095
// FIXME(llvm19): can probably be removed at the version bump
@@ -128,10 +133,29 @@ fn main() {
128133
_ => false,
129134
};
130135

136+
// LLVM is currenlty adding missing routines, <https://github.com/llvm/llvm-project/issues/93566>
137+
let has_reliable_f16_math = has_reliable_f16
138+
&& match (target_arch.as_str(), target_os.as_str()) {
139+
("x86", _) => false,
140+
_ => true,
141+
};
142+
143+
let has_reliable_f128_math = has_reliable_f128
144+
&& match (target_arch.as_str(), target_os.as_str()) {
145+
// ("aarch64", _) => false,
146+
_ => true,
147+
};
148+
131149
if has_reliable_f16 {
132150
println!("cargo:rustc-cfg=reliable_f16");
133151
}
134152
if has_reliable_f128 {
135153
println!("cargo:rustc-cfg=reliable_f128");
136154
}
155+
if has_reliable_f16_math {
156+
println!("cargo:rustc-cfg=reliable_f16_math");
157+
}
158+
if has_reliable_f128_math {
159+
println!("cargo:rustc-cfg=reliable_f128_math");
160+
}
137161
}

0 commit comments

Comments
 (0)