Skip to content

Commit 8cfae22

Browse files
Rollup merge of #156393 - RalfJung:core-miri-tests, r=tgross35
enable more f16/f128 tests in Miri See the individual commit messages for details. The last commit is a drive-by comment fix that was not worth its own PR. r? @tgross35
2 parents f244bd7 + 33be37e commit 8cfae22

12 files changed

Lines changed: 201 additions & 258 deletions

File tree

compiler/rustc_codegen_cranelift/patches/0029-sysroot_tests-disable-f16-math.patch

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,117 +15,117 @@ index c61961f8584..d7b4fa20322 100644
1515
name: powf,
1616
attrs: {
1717
const: #[cfg(false)],
18-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
18+
- f16: #[cfg(target_has_reliable_f16_math)],
1919
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
20-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
20+
f128: #[cfg(target_has_reliable_f128_math)],
2121
},
2222
test {
2323
@@ -1557,7 +1557,7 @@ fn s_nan() -> Float {
2424
name: exp,
2525
attrs: {
2626
const: #[cfg(false)],
27-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
27+
- f16: #[cfg(target_has_reliable_f16_math)],
2828
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
29-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
29+
f128: #[cfg(target_has_reliable_f128_math)],
3030
},
3131
test {
3232
@@ -1578,7 +1578,7 @@ fn s_nan() -> Float {
3333
name: exp2,
3434
attrs: {
3535
const: #[cfg(false)],
36-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
36+
- f16: #[cfg(target_has_reliable_f16_math)],
3737
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
38-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
38+
f128: #[cfg(target_has_reliable_f128_math)],
3939
},
4040
test {
4141
@@ -1598,7 +1598,7 @@ fn s_nan() -> Float {
4242
name: ln,
4343
attrs: {
4444
const: #[cfg(false)],
45-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
45+
- f16: #[cfg(target_has_reliable_f16_math)],
4646
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
47-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
47+
f128: #[cfg(target_has_reliable_f128_math)],
4848
},
4949
test {
5050
@@ -1620,7 +1620,7 @@ fn s_nan() -> Float {
5151
name: log,
5252
attrs: {
5353
const: #[cfg(false)],
54-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
54+
- f16: #[cfg(target_has_reliable_f16_math)],
5555
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
56-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
56+
f128: #[cfg(target_has_reliable_f128_math)],
5757
},
5858
test {
5959
@@ -1645,7 +1645,7 @@ fn s_nan() -> Float {
6060
name: log2,
6161
attrs: {
6262
const: #[cfg(false)],
63-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
63+
- f16: #[cfg(target_has_reliable_f16_math)],
6464
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
65-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
65+
f128: #[cfg(target_has_reliable_f128_math)],
6666
},
6767
test {
6868
@@ -1668,7 +1668,7 @@ fn s_nan() -> Float {
6969
name: log10,
7070
attrs: {
7171
const: #[cfg(false)],
72-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
72+
- f16: #[cfg(target_has_reliable_f16_math)],
7373
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
74-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
74+
f128: #[cfg(target_has_reliable_f128_math)],
7575
},
7676
test {
7777
@@ -1692,7 +1692,7 @@ fn s_nan() -> Float {
7878
name: asinh,
7979
attrs: {
8080
const: #[cfg(false)],
81-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
81+
- f16: #[cfg(target_has_reliable_f16_math)],
8282
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
83-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
83+
f128: #[cfg(target_has_reliable_f128_math)],
8484
},
8585
test {
8686
@@ -1725,7 +1725,7 @@ fn s_nan() -> Float {
8787
name: acosh,
8888
attrs: {
8989
const: #[cfg(false)],
90-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
90+
- f16: #[cfg(target_has_reliable_f16_math)],
9191
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
92-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
92+
f128: #[cfg(target_has_reliable_f128_math)],
9393
},
9494
test {
9595
@@ -1753,7 +1753,7 @@ fn s_nan() -> Float {
9696
name: atanh,
9797
attrs: {
9898
const: #[cfg(false)],
99-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
99+
- f16: #[cfg(target_has_reliable_f16_math)],
100100
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
101-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
101+
f128: #[cfg(target_has_reliable_f128_math)],
102102
},
103103
test {
104104
@@ -1779,7 +1779,7 @@ fn s_nan() -> Float {
105105
name: gamma,
106106
attrs: {
107107
const: #[cfg(false)],
108-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
108+
- f16: #[cfg(target_has_reliable_f16_math)],
109109
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
110-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
110+
f128: #[cfg(target_has_reliable_f128_math)],
111111
},
112112
test {
113113
@@ -1814,7 +1814,7 @@ fn s_nan() -> Float {
114114
name: ln_gamma,
115115
attrs: {
116116
const: #[cfg(false)],
117-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
117+
- f16: #[cfg(target_has_reliable_f16_math)],
118118
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
119-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
119+
f128: #[cfg(target_has_reliable_f128_math)],
120120
},
121121
test {
122122
@@ -2027,7 +2027,7 @@ fn s_nan() -> Float {
123123
attrs: {
124124
// FIXME(f16_f128): add math tests when available
125125
const: #[cfg(false)],
126-
- f16: #[cfg(all(not(miri), target_has_reliable_f16_math))],
126+
- f16: #[cfg(target_has_reliable_f16_math)],
127127
+ f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622)
128-
f128: #[cfg(all(not(miri), target_has_reliable_f128_math))],
128+
f128: #[cfg(target_has_reliable_f128_math)],
129129
},
130130
test {
131131
--

library/core/src/num/f128.rs

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ impl f128 {
843843
///
844844
/// ```
845845
/// #![feature(f128)]
846-
/// # #[cfg(target_has_reliable_f128_math)] {
846+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
847847
///
848848
/// let x = 1.0f128;
849849
/// let y = 2.0f128;
@@ -874,7 +874,7 @@ impl f128 {
874874
///
875875
/// ```
876876
/// #![feature(f128)]
877-
/// # #[cfg(target_has_reliable_f128_math)] {
877+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
878878
///
879879
/// let x = 1.0f128;
880880
/// let y = 2.0f128;
@@ -906,7 +906,7 @@ impl f128 {
906906
/// ```
907907
/// #![feature(f128)]
908908
/// #![feature(float_minimum_maximum)]
909-
/// # #[cfg(target_has_reliable_f128_math)] {
909+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
910910
///
911911
/// let x = 1.0f128;
912912
/// let y = 2.0f128;
@@ -938,7 +938,7 @@ impl f128 {
938938
/// ```
939939
/// #![feature(f128)]
940940
/// #![feature(float_minimum_maximum)]
941-
/// # #[cfg(target_has_reliable_f128_math)] {
941+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
942942
///
943943
/// let x = 1.0f128;
944944
/// let y = 2.0f128;
@@ -1620,8 +1620,7 @@ impl f128 {
16201620
///
16211621
/// ```
16221622
/// #![feature(f128)]
1623-
/// # #[cfg(not(miri))]
1624-
/// # #[cfg(target_has_reliable_f128_math)] {
1623+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
16251624
///
16261625
/// let f = 3.7_f128;
16271626
/// let g = 3.0_f128;
@@ -1649,8 +1648,7 @@ impl f128 {
16491648
///
16501649
/// ```
16511650
/// #![feature(f128)]
1652-
/// # #[cfg(not(miri))]
1653-
/// # #[cfg(target_has_reliable_f128_math)] {
1651+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
16541652
///
16551653
/// let f = 3.01_f128;
16561654
/// let g = 4.0_f128;
@@ -1678,8 +1676,7 @@ impl f128 {
16781676
///
16791677
/// ```
16801678
/// #![feature(f128)]
1681-
/// # #[cfg(not(miri))]
1682-
/// # #[cfg(target_has_reliable_f128_math)] {
1679+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
16831680
///
16841681
/// let f = 3.3_f128;
16851682
/// let g = -3.3_f128;
@@ -1712,8 +1709,7 @@ impl f128 {
17121709
///
17131710
/// ```
17141711
/// #![feature(f128)]
1715-
/// # #[cfg(not(miri))]
1716-
/// # #[cfg(target_has_reliable_f128_math)] {
1712+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
17171713
///
17181714
/// let f = 3.3_f128;
17191715
/// let g = -3.3_f128;
@@ -1744,8 +1740,7 @@ impl f128 {
17441740
///
17451741
/// ```
17461742
/// #![feature(f128)]
1747-
/// # #[cfg(not(miri))]
1748-
/// # #[cfg(target_has_reliable_f128_math)] {
1743+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
17491744
///
17501745
/// let f = 3.7_f128;
17511746
/// let g = 3.0_f128;
@@ -1774,8 +1769,7 @@ impl f128 {
17741769
///
17751770
/// ```
17761771
/// #![feature(f128)]
1777-
/// # #[cfg(not(miri))]
1778-
/// # #[cfg(target_has_reliable_f128_math)] {
1772+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
17791773
///
17801774
/// let x = 3.6_f128;
17811775
/// let y = -3.6_f128;
@@ -1813,8 +1807,7 @@ impl f128 {
18131807
///
18141808
/// ```
18151809
/// #![feature(f128)]
1816-
/// # #[cfg(not(miri))]
1817-
/// # #[cfg(target_has_reliable_f128_math)] {
1810+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
18181811
///
18191812
/// let m = 10.0_f128;
18201813
/// let x = 4.0_f128;
@@ -1858,8 +1851,7 @@ impl f128 {
18581851
///
18591852
/// ```
18601853
/// #![feature(f128)]
1861-
/// # #[cfg(not(miri))]
1862-
/// # #[cfg(target_has_reliable_f128_math)] {
1854+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
18631855
///
18641856
/// let a: f128 = 7.0;
18651857
/// let b = 4.0;
@@ -1902,8 +1894,7 @@ impl f128 {
19021894
///
19031895
/// ```
19041896
/// #![feature(f128)]
1905-
/// # #[cfg(not(miri))]
1906-
/// # #[cfg(target_has_reliable_f128_math)] {
1897+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
19071898
///
19081899
/// let a: f128 = 7.0;
19091900
/// let b = 4.0;
@@ -1945,12 +1936,11 @@ impl f128 {
19451936
///
19461937
/// ```
19471938
/// #![feature(f128)]
1948-
/// # #[cfg(not(miri))]
19491939
/// # #[cfg(target_has_reliable_f128_math)] {
19501940
///
19511941
/// let x = 2.0_f128;
19521942
/// let abs_difference = (x.powi(2) - (x * x)).abs();
1953-
/// assert!(abs_difference <= f128::EPSILON);
1943+
/// assert!(abs_difference <= 1e-9);
19541944
///
19551945
/// assert_eq!(f128::powi(f128::NAN, 0), 1.0);
19561946
/// assert_eq!(f128::powi(0.0, 0), 1.0);
@@ -1978,8 +1968,7 @@ impl f128 {
19781968
///
19791969
/// ```
19801970
/// #![feature(f128)]
1981-
/// # #[cfg(not(miri))]
1982-
/// # #[cfg(target_has_reliable_f128_math)] {
1971+
/// # #[cfg(any(miri, target_has_reliable_f128_math))] { // Miri uses softfloats, always works
19831972
///
19841973
/// let positive = 4.0_f128;
19851974
/// let negative = -4.0_f128;

0 commit comments

Comments
 (0)