Skip to content

Commit dabf5fa

Browse files
author
Robert Zakrzewski
committed
Add support for Float64
1 parent 2eaac23 commit dabf5fa

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/base.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ pub fn compile_codegen_unit(
186186
// context.
187187
let f16_type_supported = target_info.supports_target_dependent_type(CType::Float16);
188188
let f32_type_supported = target_info.supports_target_dependent_type(CType::Float32);
189+
let f64_type_supported = target_info.supports_target_dependent_type(CType::Float64);
189190
let f128_type_supported = target_info.supports_target_dependent_type(CType::Float128);
190191
// TODO: improve this to avoid passing that many arguments.
191192
let cx = CodegenCx::new(
@@ -195,6 +196,7 @@ pub fn compile_codegen_unit(
195196
target_info.supports_128bit_int(),
196197
f16_type_supported,
197198
f32_type_supported,
199+
f64_type_supported,
198200
f128_type_supported,
199201
);
200202

src/context.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ pub struct CodegenCx<'gcc, 'tcx> {
7070
pub supports_128bit_integers: bool,
7171
pub supports_f16_type: bool,
7272
pub supports_f32_type: bool,
73+
pub supports_f64_type: bool,
7374
pub supports_f128_type: bool,
7475

7576
pub float_type: Type<'gcc>,
@@ -135,6 +136,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
135136
supports_128bit_integers: bool,
136137
supports_f16_type: bool,
137138
supports_f32_type: bool,
139+
supports_f64_type: bool,
138140
supports_f128_type: bool,
139141
) -> Self {
140142
let check_overflow = tcx.sess.overflow_checks();
@@ -313,6 +315,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
313315
supports_128bit_integers,
314316
supports_f16_type,
315317
supports_f32_type,
318+
supports_f64_type,
316319
supports_f128_type,
317320

318321
float_type,

src/type_.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
142142
}
143143

144144
fn type_f64(&self) -> Type<'gcc> {
145+
#[cfg(feature = "master")]
146+
if self.supports_f64_type {
147+
return self.context.new_c_type(CType::Float64);
148+
}
145149
self.double_type
146150
}
147151

0 commit comments

Comments
 (0)