make remaining FloatTy matches exhaustive
This commit is contained in:
parent
a5a843726c
commit
3c2318c0b2
2 changed files with 17 additions and 19 deletions
|
@ -1102,20 +1102,17 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
let (val, status) = match src.layout.ty.kind() {
|
||||
// f32
|
||||
ty::Float(FloatTy::F32) =>
|
||||
let ty::Float(fty) = src.layout.ty.kind() else {
|
||||
bug!("float_to_int_checked: non-float input type {}", src.layout.ty)
|
||||
};
|
||||
|
||||
let (val, status) = match fty {
|
||||
FloatTy::F16 => unimplemented!("f16_f128"),
|
||||
FloatTy::F32 =>
|
||||
float_to_int_inner::<Single>(this, src.to_scalar().to_f32()?, cast_to, round),
|
||||
// f64
|
||||
ty::Float(FloatTy::F64) =>
|
||||
FloatTy::F64 =>
|
||||
float_to_int_inner::<Double>(this, src.to_scalar().to_f64()?, cast_to, round),
|
||||
// Nothing else
|
||||
_ =>
|
||||
span_bug!(
|
||||
this.cur_span(),
|
||||
"attempted float-to-int conversion with non-float input type {}",
|
||||
src.layout.ty,
|
||||
),
|
||||
FloatTy::F128 => unimplemented!("f16_f128"),
|
||||
};
|
||||
|
||||
if status.intersects(
|
||||
|
|
|
@ -274,13 +274,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
_ => bug!(),
|
||||
};
|
||||
let float_finite = |x: &ImmTy<'tcx, _>| -> InterpResult<'tcx, bool> {
|
||||
Ok(match x.layout.ty.kind() {
|
||||
ty::Float(FloatTy::F32) => x.to_scalar().to_f32()?.is_finite(),
|
||||
ty::Float(FloatTy::F64) => x.to_scalar().to_f64()?.is_finite(),
|
||||
_ => bug!(
|
||||
"`{intrinsic_name}` called with non-float input type {ty:?}",
|
||||
ty = x.layout.ty,
|
||||
),
|
||||
let ty::Float(fty) = x.layout.ty.kind() else {
|
||||
bug!("float_finite: non-float input type {}", x.layout.ty)
|
||||
};
|
||||
Ok(match fty {
|
||||
FloatTy::F16 => unimplemented!("f16_f128"),
|
||||
FloatTy::F32 => x.to_scalar().to_f32()?.is_finite(),
|
||||
FloatTy::F64 => x.to_scalar().to_f64()?.is_finite(),
|
||||
FloatTy::F128 => unimplemented!("f16_f128"),
|
||||
})
|
||||
};
|
||||
match (float_finite(&a)?, float_finite(&b)?) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue