Skip to content

Commit 617c3f6

Browse files
committed
Refactor float Primitives to a separate Float type
1 parent 9a57c63 commit 617c3f6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/common.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_middle::ty::layout::{
77
use rustc_middle::ty::TypeFoldable;
88
use rustc_span::source_map::Spanned;
99
use rustc_target::abi::call::FnAbi;
10-
use rustc_target::abi::{Integer, Primitive};
10+
use rustc_target::abi::{Float, Integer, Primitive};
1111
use rustc_target::spec::{HasTargetSpec, Target};
1212

1313
use crate::constant::ConstantCx;
@@ -32,10 +32,12 @@ pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type {
3232
Integer::I64 => types::I64,
3333
Integer::I128 => types::I128,
3434
},
35-
Primitive::F16 => unimplemented!("f16_f128"),
36-
Primitive::F32 => types::F32,
37-
Primitive::F64 => types::F64,
38-
Primitive::F128 => unimplemented!("f16_f128"),
35+
Primitive::Float(float) => match float {
36+
Float::F16 => unimplemented!("f16_f128"),
37+
Float::F32 => types::F32,
38+
Float::F64 => types::F64,
39+
Float::F128 => unimplemented!("f16_f128"),
40+
},
3941
// FIXME(erikdesjardins): handle non-default addrspace ptr sizes
4042
Primitive::Pointer(_) => pointer_ty(tcx),
4143
}

0 commit comments

Comments
 (0)