Skip to content

Commit

Permalink
Fix #889
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillou68310 authored and Narann committed Jul 27, 2021
1 parent a6d0490 commit a605261
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
29 changes: 20 additions & 9 deletions src/device/r4300/new_dynarec/x64/assem_x64.c
Original file line number Diff line number Diff line change
Expand Up @@ -3302,15 +3302,26 @@ static void shift_assemble_x64(int i,struct regstat *i_regs)
emit_cmovne_reg(th==ECX?shift:th,tl==ECX?shift:tl);
if(real_th>=0) emit_cmovne_reg(temp==ECX?shift:temp,th==ECX?shift:th);
}
if(shift!=ECX) {
if(i_regs->regmap[ECX]>=INVCP)
emit_xchg64(shift,ECX);
else
emit_xchg(shift,ECX);

if(real_tl==shift) {
emit_mov(sl,real_tl);
emit_popreg(sl);
if(real_tl==ECX&&sl!=ECX&&shift==real_tl) {
emit_mov(sl,real_tl);
emit_popreg(sl);
}
else if(th==ECX&&sh!=ECX&&shift==real_tl) {
emit_mov(sl,real_tl);
emit_popreg(sl);
}
else
{
if(shift!=ECX) {
if(i_regs->regmap[ECX]>=INVCP)
emit_xchg64(shift,ECX);
else
emit_xchg(shift,ECX);

if(real_tl==shift) {
emit_mov(sl,real_tl);
emit_popreg(sl);
}
}
}
}
Expand Down
21 changes: 16 additions & 5 deletions src/device/r4300/new_dynarec/x86/assem_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -2899,11 +2899,22 @@ static void shift_assemble_x86(int i,struct regstat *i_regs)
emit_cmovne_reg(th==ECX?shift:th,tl==ECX?shift:tl);
if(real_th>=0) emit_cmovne_reg(temp==ECX?shift:temp,th==ECX?shift:th);
}
if(shift!=ECX) {
emit_xchg(shift,ECX);
if(real_tl==shift) {
emit_mov(sl,real_tl);
emit_popreg(sl);
if(real_tl==ECX&&sl!=ECX&&shift==real_tl) {
emit_mov(sl,real_tl);
emit_popreg(sl);
}
else if(th==ECX&&sh!=ECX&&shift==real_tl) {
emit_mov(sl,real_tl);
emit_popreg(sl);
}
else
{
if(shift!=ECX) {
emit_xchg(shift,ECX);
if(real_tl==shift) {
emit_mov(sl,real_tl);
emit_popreg(sl);
}
}
}
}
Expand Down

0 comments on commit a605261

Please sign in to comment.