fix reading float from a pointer

This commit is contained in:
Folkert 2023-05-02 20:57:30 +02:00
parent e4b0d77f2e
commit 9e8854614a
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 94 additions and 3 deletions

View file

@ -332,6 +332,19 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
);
fn mov_reg8_mem8_offset32(buf: &mut Vec<'_, u8>, dst: GeneralReg, src: GeneralReg, offset: i32);
fn mov_freg64_mem64_offset32(
buf: &mut Vec<'_, u8>,
dst: FloatReg,
src: GeneralReg,
offset: i32,
);
fn mov_freg32_mem32_offset32(
buf: &mut Vec<'_, u8>,
dst: FloatReg,
src: GeneralReg,
offset: i32,
);
// move from register to memory
fn mov_mem64_offset32_reg64(
buf: &mut Vec<'_, u8>,
@ -3204,9 +3217,13 @@ impl<
ASM::mov_reg8_mem8_offset32(buf, dst_reg, ptr_reg, 0);
}
},
Builtin::Float(_) => {
Builtin::Float(FloatWidth::F64) => {
let dst_reg = storage_manager.claim_float_reg(buf, &dst);
ASM::mov_freg64_freg64(buf, dst_reg, CC::FLOAT_RETURN_REGS[0]);
ASM::mov_freg64_mem64_offset32(buf, dst_reg, ptr_reg, 0);
}
Builtin::Float(FloatWidth::F32) => {
let dst_reg = storage_manager.claim_float_reg(buf, &dst);
ASM::mov_freg32_mem32_offset32(buf, dst_reg, ptr_reg, 0);
}
Builtin::Bool => {
// the same as an 8-bit integer