Skip to content

Commit

Permalink
improv(compiler) Fixed some mystakes (207 tests passes now, 0 failed)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Jan 14, 2022
1 parent acc9c91 commit a1088a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/compiler-singlepass/src/emitter_arm64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,7 @@ pub fn gen_import_call_trampoline_arm64(
if (offset > 0 && offset < 0xF8) || (offset > 0 && offset < 0x7FF8 && (offset & 7) == 0) {
offset
} else {
a.emit_mov_imm(Location::GPR(GPR::X16), offset as u64);
a.emit_mov_imm(Location::GPR(GPR::X16), (offset as i64) as u64);
a.emit_add(
Size::S64,
Location::GPR(GPR::X0),
Expand Down
47 changes: 26 additions & 21 deletions lib/compiler-singlepass/src/machine_arm64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ impl MachineARM64 {
temps.push(tmp.clone());
tmp
};
self.assembler.emit_mov_imm(Location::GPR(tmp), val as u64);
self.assembler
.emit_mov_imm(Location::GPR(tmp), (val as i64) as u64);
Location::GPR(tmp)
}
}
Expand Down Expand Up @@ -179,7 +180,8 @@ impl MachineARM64 {
if reg == tmp {
unreachable!();
}
self.assembler.emit_mov_imm(Location::GPR(tmp), val as u64);
self.assembler
.emit_mov_imm(Location::GPR(tmp), (val as i64) as u64);
self.assembler.emit_ldr(
sz,
Location::GPR(tmp),
Expand Down Expand Up @@ -231,7 +233,8 @@ impl MachineARM64 {
let gpr = self.acquire_temp_gpr().unwrap();
let tmp = self.acquire_temp_simd().unwrap();
temps.push(tmp.clone());
self.assembler.emit_mov_imm(Location::GPR(gpr), val as u64);
self.assembler
.emit_mov_imm(Location::GPR(gpr), (val as i64) as u64);
self.assembler
.emit_mov(sz, Location::GPR(gpr), Location::SIMD(tmp));
self.release_gpr(gpr);
Expand Down Expand Up @@ -271,7 +274,8 @@ impl MachineARM64 {
self.assembler.emit_ldur(sz, Location::SIMD(tmp), reg, val);
} else {
let gpr = self.acquire_temp_gpr().unwrap();
self.assembler.emit_mov_imm(Location::GPR(gpr), val as u64);
self.assembler
.emit_mov_imm(Location::GPR(gpr), (val as i64) as u64);
self.assembler.emit_ldr(
sz,
Location::SIMD(tmp),
Expand Down Expand Up @@ -383,7 +387,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_ldr(
Size::S64,
dest,
Expand Down Expand Up @@ -413,7 +417,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_ldr(
Size::S32,
dest,
Expand Down Expand Up @@ -441,7 +445,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_ldrsw(
Size::S64,
dest,
Expand Down Expand Up @@ -469,7 +473,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_ldrh(
Size::S32,
dest,
Expand Down Expand Up @@ -497,7 +501,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_ldrsh(
sz,
dest,
Expand Down Expand Up @@ -525,7 +529,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_ldrb(
Size::S32,
dest,
Expand Down Expand Up @@ -553,7 +557,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_ldrsb(
sz,
dest,
Expand Down Expand Up @@ -583,7 +587,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_str(
Size::S64,
dst,
Expand All @@ -610,7 +614,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_str(
Size::S32,
dst,
Expand All @@ -635,7 +639,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_strh(
Size::S32,
dst,
Expand All @@ -661,7 +665,7 @@ impl MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_strb(
Size::S32,
dst,
Expand Down Expand Up @@ -1440,7 +1444,7 @@ impl Machine for MachineARM64 {
5 => Location::GPR(GPR::X24),
6 => Location::GPR(GPR::X25),
7 => Location::GPR(GPR::X26),
_ => Location::Memory(GPR::X29, -(((idx - 3) * 8 + callee_saved_regs_size) as i32)),
_ => Location::Memory(GPR::X29, -(((idx - 7) * 8 + callee_saved_regs_size) as i32)),
}
}
// Move a local to the stack
Expand All @@ -1451,7 +1455,7 @@ impl Machine for MachineARM64 {
} else {
let tmp = GPR::X17;
self.assembler
.emit_mov_imm(Location::GPR(tmp), stack_offset as u64);
.emit_mov_imm(Location::GPR(tmp), (stack_offset as i64) as u64);
self.assembler.emit_sub(
Size::S64,
Location::GPR(GPR::X29),
Expand Down Expand Up @@ -1634,7 +1638,7 @@ impl Machine for MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_sub(
Size::S64,
Location::GPR(reg),
Expand All @@ -1656,7 +1660,7 @@ impl Machine for MachineARM64 {
} else {
let tmp = self.acquire_temp_gpr().unwrap();
self.assembler
.emit_mov_imm(Location::GPR(tmp), offset as u64);
.emit_mov_imm(Location::GPR(tmp), (offset as i64) as u64);
self.assembler.emit_add(
Size::S64,
Location::GPR(reg),
Expand Down Expand Up @@ -1773,7 +1777,8 @@ impl Machine for MachineARM64 {
}

fn emit_function_return_float(&mut self) {
self.move_location(Size::S64, Location::GPR(GPR::X0), Location::SIMD(NEON::V0));
self.assembler
.emit_mov(Size::S64, Location::GPR(GPR::X0), Location::SIMD(NEON::V0));
}

fn arch_supports_canonicalize_nan(&self) -> bool {
Expand Down Expand Up @@ -2037,7 +2042,7 @@ impl Machine for MachineARM64 {
},
_ => {
let mut temps = vec![];
let src = self.location_to_reg(sz_dst, src, &mut temps, ImmType::None, true, None);
let src = self.location_to_reg(sz_src, src, &mut temps, ImmType::None, true, None);
let dest =
self.location_to_reg(sz_dst, dst, &mut temps, ImmType::None, false, None);
match sz_src {
Expand Down

0 comments on commit a1088a9

Please sign in to comment.