Skip to content

Commit 9d3e35c

Browse files
RalfJungwesleywiser
authored andcommitted
Add tests for #102403 and #113407
1 parent 98dd81e commit 9d3e35c

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// run-pass
2+
// compile-flags: -O -Zmir-opt-level=3 -Cno-prepopulate-passes
3+
// min-llvm-version: 16.0 (requires APFloat fixes in LLVM)
4+
5+
// Regression test for a broken MIR optimization (issue #113407).
6+
pub fn main() {
7+
let f = f64::from_bits(0x19873cc2) as f32;
8+
assert_eq!(f.to_bits(), 0);
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// run-pass
2+
// compile-flags: -O -Zmir-opt-level=3 -Cno-prepopulate-passes
3+
4+
// Regression test for a broken MIR optimization (issue #102403).
5+
pub fn f() -> f64 {
6+
std::hint::black_box(-1.0) % std::hint::black_box(-1.0)
7+
}
8+
9+
pub fn g() -> f64 {
10+
-1.0 % -1.0
11+
}
12+
13+
pub fn main() {
14+
assert_eq!(f().signum(), g().signum());
15+
}

0 commit comments

Comments
 (0)