Add support for Float64

This commit is contained in:
Robert Zakrzewski 2024-06-21 22:10:52 +02:00
parent 2eaac2388d
commit dabf5faff0
3 changed files with 9 additions and 0 deletions

View File

@ -186,6 +186,7 @@ fn module_codegen(
// 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 @@ fn module_codegen(
target_info.supports_128bit_int(),
f16_type_supported,
f32_type_supported,
f64_type_supported,
f128_type_supported,
);

View File

@ -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 @@ pub fn new(
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 @@ pub fn new(
supports_128bit_integers,
supports_f16_type,
supports_f32_type,
supports_f64_type,
supports_f128_type,
float_type,

View File

@ -142,6 +142,10 @@ fn type_f32(&self) -> Type<'gcc> {
}
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
}