Refactor float Primitives to a separate Float type

This commit is contained in:
beetrees 2024-05-06 13:27:40 +01:00
parent 9a57c636e7
commit 617c3f6360

View File

@ -7,7 +7,7 @@
use rustc_middle::ty::TypeFoldable; use rustc_middle::ty::TypeFoldable;
use rustc_span::source_map::Spanned; use rustc_span::source_map::Spanned;
use rustc_target::abi::call::FnAbi; use rustc_target::abi::call::FnAbi;
use rustc_target::abi::{Integer, Primitive}; use rustc_target::abi::{Float, Integer, Primitive};
use rustc_target::spec::{HasTargetSpec, Target}; use rustc_target::spec::{HasTargetSpec, Target};
use crate::constant::ConstantCx; use crate::constant::ConstantCx;
@ -32,10 +32,12 @@ pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type {
Integer::I64 => types::I64, Integer::I64 => types::I64,
Integer::I128 => types::I128, Integer::I128 => types::I128,
}, },
Primitive::F16 => unimplemented!("f16_f128"), Primitive::Float(float) => match float {
Primitive::F32 => types::F32, Float::F16 => unimplemented!("f16_f128"),
Primitive::F64 => types::F64, Float::F32 => types::F32,
Primitive::F128 => unimplemented!("f16_f128"), Float::F64 => types::F64,
Float::F128 => unimplemented!("f16_f128"),
},
// FIXME(erikdesjardins): handle non-default addrspace ptr sizes // FIXME(erikdesjardins): handle non-default addrspace ptr sizes
Primitive::Pointer(_) => pointer_ty(tcx), Primitive::Pointer(_) => pointer_ty(tcx),
} }