Skip to content

Commit 0f9dcd8

Browse files
committed
Update tests.
1 parent 8fec6a9 commit 0f9dcd8

6 files changed

+459
-20
lines changed

library/coretests/tests/num/flt2dec/mod.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -914,22 +914,22 @@ where
914914
);
915915

916916
// very large output
917-
assert_eq!(to_string(f, 0.0, Minus, 80000, false), format!("0.{:0>79999}e0", ""));
918-
assert_eq!(to_string(f, 1.0e1, Minus, 80000, false), format!("1.{:0>79999}e1", ""));
919-
assert_eq!(to_string(f, 1.0e0, Minus, 80000, false), format!("1.{:0>79999}e0", ""));
917+
assert_eq!(to_string(f, 0.0, Minus, 50000, false), format!("0.{:0>49999}e0", ""));
918+
assert_eq!(to_string(f, 1.0e1, Minus, 50000, false), format!("1.{:0>49999}e1", ""));
919+
assert_eq!(to_string(f, 1.0e0, Minus, 50000, false), format!("1.{:0>49999}e0", ""));
920920
assert_eq!(
921-
to_string(f, 1.0e-1, Minus, 80000, false),
921+
to_string(f, 1.0e-1, Minus, 50000, false),
922922
format!(
923-
"1.000000000000000055511151231257827021181583404541015625{:0>79945}\
923+
"1.000000000000000055511151231257827021181583404541015625{:0>49945}\
924924
e-1",
925925
""
926926
)
927927
);
928928
assert_eq!(
929-
to_string(f, 1.0e-20, Minus, 80000, false),
929+
to_string(f, 1.0e-20, Minus, 50000, false),
930930
format!(
931931
"9.999999999999999451532714542095716517295037027873924471077157760\
932-
66783064379706047475337982177734375{:0>79901}e-21",
932+
66783064379706047475337982177734375{:0>49901}e-21",
933933
""
934934
)
935935
);
@@ -1150,18 +1150,18 @@ where
11501150
);
11511151

11521152
// very large output
1153-
assert_eq!(to_string(f, 0.0, Minus, 80000), format!("0.{:0>80000}", ""));
1154-
assert_eq!(to_string(f, 1.0e1, Minus, 80000), format!("10.{:0>80000}", ""));
1155-
assert_eq!(to_string(f, 1.0e0, Minus, 80000), format!("1.{:0>80000}", ""));
1153+
assert_eq!(to_string(f, 0.0, Minus, 50000), format!("0.{:0>50000}", ""));
1154+
assert_eq!(to_string(f, 1.0e1, Minus, 50000), format!("10.{:0>50000}", ""));
1155+
assert_eq!(to_string(f, 1.0e0, Minus, 50000), format!("1.{:0>50000}", ""));
11561156
assert_eq!(
1157-
to_string(f, 1.0e-1, Minus, 80000),
1158-
format!("0.1000000000000000055511151231257827021181583404541015625{:0>79945}", "")
1157+
to_string(f, 1.0e-1, Minus, 50000),
1158+
format!("0.1000000000000000055511151231257827021181583404541015625{:0>49945}", "")
11591159
);
11601160
assert_eq!(
1161-
to_string(f, 1.0e-20, Minus, 80000),
1161+
to_string(f, 1.0e-20, Minus, 50000),
11621162
format!(
11631163
"0.0000000000000000000099999999999999994515327145420957165172950370\
1164-
2787392447107715776066783064379706047475337982177734375{:0>79881}",
1164+
2787392447107715776066783064379706047475337982177734375{:0>49881}",
11651165
""
11661166
)
11671167
);

tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-abort.diff

+42-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
debug precision => _8;
3030
let _8: usize;
3131
scope 5 (inlined Formatter::<'_>::precision) {
32+
let mut _22: std::option::Option<u16>;
33+
scope 6 (inlined Option::<u16>::map::<usize, {closure@Formatter<'_>::precision::{closure#0}}>) {
34+
let mut _23: isize;
35+
let _24: u16;
36+
let mut _25: usize;
37+
scope 7 {
38+
scope 8 (inlined Formatter::<'_>::precision::{closure#0}) {
39+
}
40+
}
41+
}
3242
}
3343
}
3444
}
@@ -65,9 +75,12 @@
6575

6676
bb3: {
6777
StorageLive(_6);
68-
_6 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<usize>);
69-
_7 = discriminant(_6);
70-
switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb9];
78+
StorageLive(_24);
79+
StorageLive(_22);
80+
_22 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<u16>);
81+
StorageLive(_23);
82+
_23 = discriminant(_22);
83+
switchInt(move _23) -> [0: bb11, 1: bb12, otherwise: bb10];
7184
}
7285

7386
bb4: {
@@ -135,7 +148,33 @@
135148
}
136149

137150
bb9: {
151+
StorageDead(_23);
152+
StorageDead(_22);
153+
StorageDead(_24);
154+
_7 = discriminant(_6);
155+
switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb10];
156+
}
157+
158+
bb10: {
138159
unreachable;
139160
}
161+
162+
bb11: {
163+
_6 = const Option::<usize>::None;
164+
goto -> bb9;
165+
}
166+
167+
bb12: {
168+
_24 = move ((_22 as Some).0: u16);
169+
StorageLive(_25);
170+
_25 = copy _24 as usize (IntToInt);
171+
_6 = Option::<usize>::Some(move _25);
172+
StorageDead(_25);
173+
goto -> bb9;
174+
}
175+
}
176+
177+
ALLOC0 (size: 8, align: 4) {
178+
00 00 00 00 __ __ __ __ │ ....░░░░
140179
}
141180

tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff tests/mir-opt/funky_arms.float_to_exponential_common.GVN.32bit.panic-unwind.diff

+42-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
debug precision => _8;
3030
let _8: usize;
3131
scope 5 (inlined Formatter::<'_>::precision) {
32+
let mut _22: std::option::Option<u16>;
33+
scope 6 (inlined Option::<u16>::map::<usize, {closure@Formatter<'_>::precision::{closure#0}}>) {
34+
let mut _23: isize;
35+
let _24: u16;
36+
let mut _25: usize;
37+
scope 7 {
38+
scope 8 (inlined Formatter::<'_>::precision::{closure#0}) {
39+
}
40+
}
41+
}
3242
}
3343
}
3444
}
@@ -65,9 +75,12 @@
6575

6676
bb3: {
6777
StorageLive(_6);
68-
_6 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<usize>);
69-
_7 = discriminant(_6);
70-
switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb9];
78+
StorageLive(_24);
79+
StorageLive(_22);
80+
_22 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<u16>);
81+
StorageLive(_23);
82+
_23 = discriminant(_22);
83+
switchInt(move _23) -> [0: bb11, 1: bb12, otherwise: bb10];
7184
}
7285

7386
bb4: {
@@ -135,7 +148,33 @@
135148
}
136149

137150
bb9: {
151+
StorageDead(_23);
152+
StorageDead(_22);
153+
StorageDead(_24);
154+
_7 = discriminant(_6);
155+
switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb10];
156+
}
157+
158+
bb10: {
138159
unreachable;
139160
}
161+
162+
bb11: {
163+
_6 = const Option::<usize>::None;
164+
goto -> bb9;
165+
}
166+
167+
bb12: {
168+
_24 = move ((_22 as Some).0: u16);
169+
StorageLive(_25);
170+
_25 = copy _24 as usize (IntToInt);
171+
_6 = Option::<usize>::Some(move _25);
172+
StorageDead(_25);
173+
goto -> bb9;
174+
}
175+
}
176+
177+
ALLOC0 (size: 8, align: 4) {
178+
00 00 00 00 __ __ __ __ │ ....░░░░
140179
}
141180

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
- // MIR for `float_to_exponential_common` before GVN
2+
+ // MIR for `float_to_exponential_common` after GVN
3+
4+
fn float_to_exponential_common(_1: &mut Formatter<'_>, _2: &T, _3: bool) -> Result<(), std::fmt::Error> {
5+
debug fmt => _1;
6+
debug num => _2;
7+
debug upper => _3;
8+
let mut _0: std::result::Result<(), std::fmt::Error>;
9+
let _4: bool;
10+
let mut _6: std::option::Option<usize>;
11+
let mut _7: isize;
12+
let mut _9: &mut std::fmt::Formatter<'_>;
13+
let mut _10: &T;
14+
let mut _11: core::num::flt2dec::Sign;
15+
let mut _12: u32;
16+
let mut _13: u32;
17+
let mut _14: usize;
18+
let mut _15: bool;
19+
let mut _16: &mut std::fmt::Formatter<'_>;
20+
let mut _17: &T;
21+
let mut _18: core::num::flt2dec::Sign;
22+
let mut _19: bool;
23+
scope 1 {
24+
debug force_sign => _4;
25+
let _5: core::num::flt2dec::Sign;
26+
scope 2 {
27+
debug sign => _5;
28+
scope 3 {
29+
debug precision => _8;
30+
let _8: usize;
31+
scope 5 (inlined Formatter::<'_>::precision) {
32+
let mut _22: std::option::Option<u16>;
33+
scope 6 (inlined Option::<u16>::map::<usize, {closure@Formatter<'_>::precision::{closure#0}}>) {
34+
let mut _23: isize;
35+
let _24: u16;
36+
let mut _25: usize;
37+
scope 7 {
38+
scope 8 (inlined Formatter::<'_>::precision::{closure#0}) {
39+
}
40+
}
41+
}
42+
}
43+
}
44+
}
45+
}
46+
scope 4 (inlined Formatter::<'_>::sign_plus) {
47+
let mut _20: u32;
48+
let mut _21: u32;
49+
}
50+
51+
bb0: {
52+
StorageLive(_4);
53+
StorageLive(_20);
54+
StorageLive(_21);
55+
_21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
56+
_20 = BitAnd(move _21, const 1_u32);
57+
StorageDead(_21);
58+
_4 = Ne(move _20, const 0_u32);
59+
StorageDead(_20);
60+
StorageLive(_5);
61+
switchInt(copy _4) -> [0: bb2, otherwise: bb1];
62+
}
63+
64+
bb1: {
65+
- _5 = MinusPlus;
66+
+ _5 = const MinusPlus;
67+
goto -> bb3;
68+
}
69+
70+
bb2: {
71+
- _5 = core::num::flt2dec::Sign::Minus;
72+
+ _5 = const core::num::flt2dec::Sign::Minus;
73+
goto -> bb3;
74+
}
75+
76+
bb3: {
77+
StorageLive(_6);
78+
StorageLive(_24);
79+
StorageLive(_22);
80+
_22 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<u16>);
81+
StorageLive(_23);
82+
_23 = discriminant(_22);
83+
switchInt(move _23) -> [0: bb11, 1: bb12, otherwise: bb10];
84+
}
85+
86+
bb4: {
87+
- StorageLive(_8);
88+
+ nop;
89+
_8 = copy ((_6 as Some).0: usize);
90+
StorageLive(_9);
91+
_9 = copy _1;
92+
StorageLive(_10);
93+
_10 = copy _2;
94+
StorageLive(_11);
95+
_11 = copy _5;
96+
StorageLive(_12);
97+
StorageLive(_13);
98+
StorageLive(_14);
99+
_14 = copy _8;
100+
- _13 = move _14 as u32 (IntToInt);
101+
+ _13 = copy _8 as u32 (IntToInt);
102+
StorageDead(_14);
103+
_12 = Add(move _13, const 1_u32);
104+
StorageDead(_13);
105+
StorageLive(_15);
106+
_15 = copy _3;
107+
- _0 = float_to_exponential_common_exact::<T>(move _9, move _10, move _11, move _12, move _15) -> [return: bb5, unwind unreachable];
108+
+ _0 = float_to_exponential_common_exact::<T>(copy _1, copy _2, move _11, move _12, copy _3) -> [return: bb5, unwind unreachable];
109+
}
110+
111+
bb5: {
112+
StorageDead(_15);
113+
StorageDead(_12);
114+
StorageDead(_11);
115+
StorageDead(_10);
116+
StorageDead(_9);
117+
- StorageDead(_8);
118+
+ nop;
119+
goto -> bb8;
120+
}
121+
122+
bb6: {
123+
StorageLive(_16);
124+
_16 = copy _1;
125+
StorageLive(_17);
126+
_17 = copy _2;
127+
StorageLive(_18);
128+
_18 = copy _5;
129+
StorageLive(_19);
130+
_19 = copy _3;
131+
- _0 = float_to_exponential_common_shortest::<T>(move _16, move _17, move _18, move _19) -> [return: bb7, unwind unreachable];
132+
+ _0 = float_to_exponential_common_shortest::<T>(copy _1, copy _2, move _18, copy _3) -> [return: bb7, unwind unreachable];
133+
}
134+
135+
bb7: {
136+
StorageDead(_19);
137+
StorageDead(_18);
138+
StorageDead(_17);
139+
StorageDead(_16);
140+
goto -> bb8;
141+
}
142+
143+
bb8: {
144+
StorageDead(_5);
145+
StorageDead(_4);
146+
StorageDead(_6);
147+
return;
148+
}
149+
150+
bb9: {
151+
StorageDead(_23);
152+
StorageDead(_22);
153+
StorageDead(_24);
154+
_7 = discriminant(_6);
155+
switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb10];
156+
}
157+
158+
bb10: {
159+
unreachable;
160+
}
161+
162+
bb11: {
163+
_6 = const Option::<usize>::None;
164+
goto -> bb9;
165+
}
166+
167+
bb12: {
168+
_24 = move ((_22 as Some).0: u16);
169+
StorageLive(_25);
170+
_25 = copy _24 as usize (IntToInt);
171+
_6 = Option::<usize>::Some(move _25);
172+
StorageDead(_25);
173+
goto -> bb9;
174+
}
175+
}
176+
177+
ALLOC0 (size: 16, align: 8) {
178+
00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
179+
}
180+

0 commit comments

Comments
 (0)