Add tests for #102403 and #113407

This commit is contained in:
Ralf Jung 2023-07-07 12:50:07 +02:00 committed by Wesley Wiser
parent 98dd81e4e3
commit 9d3e35ceaa
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,9 @@
// run-pass
// compile-flags: -O -Zmir-opt-level=3 -Cno-prepopulate-passes
// min-llvm-version: 16.0 (requires APFloat fixes in LLVM)
// Regression test for a broken MIR optimization (issue #113407).
pub fn main() {
let f = f64::from_bits(0x19873cc2) as f32;
assert_eq!(f.to_bits(), 0);
}

View File

@ -0,0 +1,15 @@
// run-pass
// compile-flags: -O -Zmir-opt-level=3 -Cno-prepopulate-passes
// Regression test for a broken MIR optimization (issue #102403).
pub fn f() -> f64 {
std::hint::black_box(-1.0) % std::hint::black_box(-1.0)
}
pub fn g() -> f64 {
-1.0 % -1.0
}
pub fn main() {
assert_eq!(f().signum(), g().signum());
}