Skip to content

Commit

Permalink
fix statusflags
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Dec 11, 2024
1 parent 6e8dcc2 commit 0a499b4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
25 changes: 15 additions & 10 deletions librz/arch/isa/xtensa/xtensa_il.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,16 +745,17 @@ static RzAnalysisLiftedILOp op_extw(XtensaContext *ctx) {

// statusflags: I
static RzAnalysisLiftedILOp op_float_s(XtensaContext *ctx) {
return SETG(REGN(0),
UNSIGNED(64,
F2BV(
INT2F(RZ_FLOAT_IEEE754_BIN_32, RZ_FLOAT_RMODE_RNA, DIV(IREG(1), U32(pow(2, -IMM(2))))))));
return SEQ3(SETL("fres", INT2F(RZ_FLOAT_IEEE754_BIN_32, RZ_FLOAT_RMODE_RNA, DIV(IREG(1), U32(pow(2, -IMM(2)))))),
SETG(REGN(0), UNSIGNED(64, F2BV(VARL("fres")))),
FSR_set(FSR_I, VARL("fres")));
}

// statusflags: VI
static RzAnalysisLiftedILOp op_floor_s(XtensaContext *ctx) {
return SETG(REGN(0),
F2SINT(32, RZ_FLOAT_RMODE_RNA, FMUL(RZ_FLOAT_RMODE_RNA, FLOATV32(IREG(1)), F32(pow(2, IMM(2))))));
return SEQ3(
SETL("fres", FMUL(RZ_FLOAT_RMODE_RNA, FLOATV32(IREG(1)), F32(pow(2, IMM(2))))),
SETG(REGN(0), F2SINT(32, RZ_FLOAT_RMODE_RNA, VARL("fres"))),
FSR_set(FSR_V | FSR_I, VARL("fres")));
}

static RzAnalysisLiftedILOp op_isync(XtensaContext *ctx) {
Expand Down Expand Up @@ -865,21 +866,23 @@ static RzAnalysisLiftedILOp op_lsxp(XtensaContext *ctx) {

// statusflags: VOUI
static RzAnalysisLiftedILOp op_madd_s(XtensaContext *ctx) {
return SEQ5(
return SEQ6(
SETL("fr", FLOATV32(IREG(0))),
SETL("fs", FLOATV32(IREG(1))),
SETL("ft", FLOATV32(IREG(2))),
SETL("fres", FADD(RZ_FLOAT_RMODE_RNA, VARL("fr"), FMUL(RZ_FLOAT_RMODE_RNA, VARL("fs"), VARL("ft")))),
FSR_set(FSR_V | FSR_O | FSR_U | FSR_I, VARL("fres")),
SETG(REGN(0), UNSIGNED(64, F2BV(VARL("fres")))));
}

// statusflags: VOUI
static RzAnalysisLiftedILOp op_msub_s(XtensaContext *ctx) {
return SEQ5(
return SEQ6(
SETL("fr", FLOATV32(IREG(0))),
SETL("fs", FLOATV32(IREG(1))),
SETL("ft", FLOATV32(IREG(2))),
SETL("fres", FSUB(RZ_FLOAT_RMODE_RNA, VARL("fr"), FMUL(RZ_FLOAT_RMODE_RNA, VARL("fs"), VARL("ft")))),
FSR_set(FSR_V | FSR_O | FSR_U | FSR_I, VARL("fres")),
SETG(REGN(0), UNSIGNED(64, F2BV(VARL("fres")))));
}

Expand Down Expand Up @@ -1036,10 +1039,12 @@ static RzAnalysisLiftedILOp op_mula_da_ldinc(XtensaContext *ctx) {

// statusflags: VOUI
static RzAnalysisLiftedILOp op_mul_s(XtensaContext *ctx) {
return SEQ3(
return SEQ5(
SETL("frs", FLOATV32(IREG(1))),
SETL("frt", FLOATV32(IREG(2))),
SETG(REGN(0), UNSIGNED(64, F2BV(FMUL(RZ_FLOAT_RMODE_RNA, VARL("frs"), VARL("frt"))))));
SETL("fres", FMUL(RZ_FLOAT_RMODE_RNA, VARL("frs"), VARL("frt"))),
FSR_set(FSR_V | FSR_O | FSR_U | FSR_I, VARL("fres")),
SETG(REGN(0), UNSIGNED(64, F2BV(VARL("fres")))));
}

static RzAnalysisLiftedILOp op_mul16s(XtensaContext *ctx) {
Expand Down
Loading

0 comments on commit 0a499b4

Please sign in to comment.