Skip to content

Commit

Permalink
[RV64_DYNAREC] Fixed misused BNE_NEXT in emit_ro{l,r}32 (#1723)
Browse files Browse the repository at this point in the history
  • Loading branch information
xctan authored Aug 9, 2024
1 parent 649a65b commit c7d6395
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dynarec/rv64/dynarec_rv64_emit_shift.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,12 +988,13 @@ void emit_rol32(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int s2, int s
}
IFX(X_OF) {
// the OF flag is set to the exclusive OR of the CF bit (after the rotate) and the most-significant bit of the result.
ADDI(s3, xZR, 1);
BNE_NEXT(s2, s3);
ADDI(s3, s2, -1);
BNEZ_MARK(s3);
SRLIxw(s3, s1, rex.w?63:31);
XOR(s3, s3, s4); // s3: MSB, s4: CF bit
SLLI(s3, s3, F_OF2);
OR(xFlags, xFlags, s3);
MARK;
}
}

Expand Down Expand Up @@ -1044,14 +1045,15 @@ void emit_ror32(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int s2, int s
}
IFX(X_OF) {
// the OF flag is set to the exclusive OR of the two most-significant bits of the result
ADDI(s3, xZR, 1);
BNE_NEXT(s2, s3);
ADDI(s3, s2, -1);
BNEZ_MARK(s3);
SRLIxw(s3, s1, rex.w?63:31);
SRLIxw(s4, s1, rex.w?62:30);
XOR(s3, s3, s4);
ANDI(s3, s3, 1);
SLLI(s3, s3, F_OF2);
OR(xFlags, xFlags, s3);
MARK;
}
}

Expand Down

0 comments on commit c7d6395

Please sign in to comment.