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() {
|
let ty::Float(fty) = src.layout.ty.kind() else {
|
||||||
// f32
|
bug!("float_to_int_checked: non-float input type {}", src.layout.ty)
|
||||||
ty::Float(FloatTy::F32) =>
|
};
|
||||||
|
|
||||||
|
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),
|
float_to_int_inner::<Single>(this, src.to_scalar().to_f32()?, cast_to, round),
|
||||||
// f64
|
FloatTy::F64 =>
|
||||||
ty::Float(FloatTy::F64) =>
|
|
||||||
float_to_int_inner::<Double>(this, src.to_scalar().to_f64()?, cast_to, round),
|
float_to_int_inner::<Double>(this, src.to_scalar().to_f64()?, cast_to, round),
|
||||||
// Nothing else
|
FloatTy::F128 => unimplemented!("f16_f128"),
|
||||||
_ =>
|
|
||||||
span_bug!(
|
|
||||||
this.cur_span(),
|
|
||||||
"attempted float-to-int conversion with non-float input type {}",
|
|
||||||
src.layout.ty,
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if status.intersects(
|
if status.intersects(
|
||||||
|
|
|
@ -274,13 +274,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||||
_ => bug!(),
|
_ => bug!(),
|
||||||
};
|
};
|
||||||
let float_finite = |x: &ImmTy<'tcx, _>| -> InterpResult<'tcx, bool> {
|
let float_finite = |x: &ImmTy<'tcx, _>| -> InterpResult<'tcx, bool> {
|
||||||
Ok(match x.layout.ty.kind() {
|
let ty::Float(fty) = x.layout.ty.kind() else {
|
||||||
ty::Float(FloatTy::F32) => x.to_scalar().to_f32()?.is_finite(),
|
bug!("float_finite: non-float input type {}", x.layout.ty)
|
||||||
ty::Float(FloatTy::F64) => x.to_scalar().to_f64()?.is_finite(),
|
};
|
||||||
_ => bug!(
|
Ok(match fty {
|
||||||
"`{intrinsic_name}` called with non-float input type {ty:?}",
|
FloatTy::F16 => unimplemented!("f16_f128"),
|
||||||
ty = x.layout.ty,
|
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)?) {
|
match (float_finite(&a)?, float_finite(&b)?) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue