diff --git a/src/base.rs b/src/base.rs index ea2b0b791b7..e88fde8ebef 100644 --- a/src/base.rs +++ b/src/base.rs @@ -186,6 +186,7 @@ pub fn compile_codegen_unit( // context. let f16_type_supported = target_info.supports_target_dependent_type(CType::Float16); let f32_type_supported = target_info.supports_target_dependent_type(CType::Float32); + let f64_type_supported = target_info.supports_target_dependent_type(CType::Float64); let f128_type_supported = target_info.supports_target_dependent_type(CType::Float128); // TODO: improve this to avoid passing that many arguments. let cx = CodegenCx::new( @@ -195,6 +196,7 @@ pub fn compile_codegen_unit( target_info.supports_128bit_int(), f16_type_supported, f32_type_supported, + f64_type_supported, f128_type_supported, ); diff --git a/src/context.rs b/src/context.rs index 53a2b09217a..6beed91270b 100644 --- a/src/context.rs +++ b/src/context.rs @@ -70,6 +70,7 @@ pub struct CodegenCx<'gcc, 'tcx> { pub supports_128bit_integers: bool, pub supports_f16_type: bool, pub supports_f32_type: bool, + pub supports_f64_type: bool, pub supports_f128_type: bool, pub float_type: Type<'gcc>, @@ -135,6 +136,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { supports_128bit_integers: bool, supports_f16_type: bool, supports_f32_type: bool, + supports_f64_type: bool, supports_f128_type: bool, ) -> Self { let check_overflow = tcx.sess.overflow_checks(); @@ -313,6 +315,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { supports_128bit_integers, supports_f16_type, supports_f32_type, + supports_f64_type, supports_f128_type, float_type, diff --git a/src/type_.rs b/src/type_.rs index eaa16c44897..093ddbf8137 100644 --- a/src/type_.rs +++ b/src/type_.rs @@ -142,6 +142,10 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> { } fn type_f64(&self) -> Type<'gcc> { + #[cfg(feature = "master")] + if self.supports_f64_type { + return self.context.new_c_type(CType::Float64); + } self.double_type }