Skip to content

Commit 1f04794

Browse files
committed
Add math functions
1 parent 62228c7 commit 1f04794

File tree

8 files changed

+3336
-52
lines changed

8 files changed

+3336
-52
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 above just 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
@@ -126,10 +131,29 @@ fn main() {
126131
_ => false,
127132
};
128133

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

0 commit comments

Comments
 (0)