Skip to content

Commit

Permalink
Auto merge of #3688 - tgross35:float-cast-test-refactor, r=RalfJung
Browse files Browse the repository at this point in the history
Refactor float casting tests, add `f16` and `f128`

This is an attempt to remove the magic from a lot of the numbers tested, which makes things easier when adding `f16` and `f128`. A nice side effect is that these tests now cover all int <-> float conversions with the same amount of tests.
  • Loading branch information
bors committed Jul 4, 2024
2 parents 89c5442 + 561cd73 commit ddbbecb
Show file tree
Hide file tree
Showing 2 changed files with 458 additions and 188 deletions.
4 changes: 2 additions & 2 deletions src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
bug!("float_finite: non-float input type {}", x.layout.ty)
};
Ok(match fty {
FloatTy::F16 => unimplemented!("f16_f128"),
FloatTy::F16 => x.to_scalar().to_f16()?.is_finite(),
FloatTy::F32 => x.to_scalar().to_f32()?.is_finite(),
FloatTy::F64 => x.to_scalar().to_f64()?.is_finite(),
FloatTy::F128 => unimplemented!("f16_f128"),
FloatTy::F128 => x.to_scalar().to_f128()?.is_finite(),
})
};
match (float_finite(&a)?, float_finite(&b)?) {
Expand Down
Loading

0 comments on commit ddbbecb

Please sign in to comment.