Skip to content

Commit f6fbaa1

Browse files
authored
Unrolled build for #148206
Rollup merge of #148206 - xonx4l:deduplicate-float-tests, r=tgross35 Deduplicated float tests and unified in floats/mod.rs In this PR Float tests are deduplicated and are unified in floats/mod.rs, as discussed in #141726. The moved float tests are: -> test_powf -> test_exp -> test_exp2 -> test_ln -> test_log_generic -> test_log2 -> test_log10 -> test_asinh -> test_acosh -> test_atanh -> test_gamma -> test_ln_gamma Closes: #141726
2 parents fef627b + 8379475 commit f6fbaa1

10 files changed

Lines changed: 712 additions & 1346 deletions

File tree

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
From 285d5716fcfa6d43a3516d899b73bc85da322c25 Mon Sep 17 00:00:00 2001
2+
From: xonx <119700621+xonx4l@users.noreply.github.com>
3+
Date: Sun, 15 Feb 2026 14:06:49 +0000
4+
Subject: [PATCH] Disable f16 math tests for cranelift
5+
6+
---
7+
coretests/tests/floats/mod.rs | 26 +++++++++++++-------------
8+
1 file changed, 13 insertions(+), 13 deletions(-)
9+
10+
diff --git a/coretests/tests/floats/mod.rs b/coretests/tests/floats/mod.rs
11+
index c61961f8584..d7b4fa20322 100644
12+
--- a/coretests/tests/floats/mod.rs
13+
+++ b/coretests/tests/floats/mod.rs
14+
@@ -1534,7 +1534,7 @@ fn s_nan() -> Float {
15+
name: powf,
16+
attrs: {
17+
const: #[cfg(false)],
18+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
19+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
20+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
21+
},
22+
test<Float> {
23+
@@ -1557,7 +1557,7 @@ fn s_nan() -> Float {
24+
name: exp,
25+
attrs: {
26+
const: #[cfg(false)],
27+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
28+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
29+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
30+
},
31+
test<Float> {
32+
@@ -1578,7 +1578,7 @@ fn s_nan() -> Float {
33+
name: exp2,
34+
attrs: {
35+
const: #[cfg(false)],
36+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
37+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
38+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
39+
},
40+
test<Float> {
41+
@@ -1598,7 +1598,7 @@ fn s_nan() -> Float {
42+
name: ln,
43+
attrs: {
44+
const: #[cfg(false)],
45+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
46+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
47+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
48+
},
49+
test<Float> {
50+
@@ -1620,7 +1620,7 @@ fn s_nan() -> Float {
51+
name: log,
52+
attrs: {
53+
const: #[cfg(false)],
54+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
55+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
56+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
57+
},
58+
test<Float> {
59+
@@ -1645,7 +1645,7 @@ fn s_nan() -> Float {
60+
name: log2,
61+
attrs: {
62+
const: #[cfg(false)],
63+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
64+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
65+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
66+
},
67+
test<Float> {
68+
@@ -1668,7 +1668,7 @@ fn s_nan() -> Float {
69+
name: log10,
70+
attrs: {
71+
const: #[cfg(false)],
72+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
73+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
74+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
75+
},
76+
test<Float> {
77+
@@ -1692,7 +1692,7 @@ fn s_nan() -> Float {
78+
name: asinh,
79+
attrs: {
80+
const: #[cfg(false)],
81+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
82+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
83+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
84+
},
85+
test<Float> {
86+
@@ -1725,7 +1725,7 @@ fn s_nan() -> Float {
87+
name: acosh,
88+
attrs: {
89+
const: #[cfg(false)],
90+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
91+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
92+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
93+
},
94+
test<Float> {
95+
@@ -1753,7 +1753,7 @@ fn s_nan() -> Float {
96+
name: atanh,
97+
attrs: {
98+
const: #[cfg(false)],
99+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
100+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
101+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
102+
},
103+
test<Float> {
104+
@@ -1779,7 +1779,7 @@ fn s_nan() -> Float {
105+
name: gamma,
106+
attrs: {
107+
const: #[cfg(false)],
108+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
109+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
110+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
111+
},
112+
test<Float> {
113+
@@ -1814,7 +1814,7 @@ fn s_nan() -> Float {
114+
name: ln_gamma,
115+
attrs: {
116+
const: #[cfg(false)],
117+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
118+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
119+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
120+
},
121+
test<Float> {
122+
@@ -2027,7 +2027,7 @@ fn s_nan() -> Float {
123+
attrs: {
124+
// FIXME(f16_f128): add math tests when available
125+
const: #[cfg(false)],
126+
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
127+
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
128+
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
129+
},
130+
test<Float> {
131+
--
132+
2.50.1
133+

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ impl CodegenBackend for CraneliftCodegenBackend {
180180
&& sess.target.env == Env::Gnu
181181
&& sess.target.abi != Abi::Llvm);
182182

183+
// FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always
184+
// filled in by compiler-builtins. The only libc that provides these currently is glibc.
185+
let has_reliable_f128_math = has_reliable_f16_f128 && sess.target.env == Env::Gnu;
186+
183187
TargetConfig {
184188
target_features,
185189
unstable_target_features,
@@ -188,7 +192,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
188192
has_reliable_f16: has_reliable_f16_f128,
189193
has_reliable_f16_math: has_reliable_f16_f128,
190194
has_reliable_f128: has_reliable_f16_f128,
191-
has_reliable_f128_math: has_reliable_f16_f128,
195+
has_reliable_f128_math,
192196
}
193197
}
194198

0 commit comments

Comments
 (0)