Skip to content

Commit

Permalink
fixup! Add support of FMIN/MAX
Browse files Browse the repository at this point in the history
  • Loading branch information
2011eric committed Sep 8, 2022
1 parent 0dfef89 commit 1d5c1c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ static inline bool op_fp(struct riscv_t *rv, uint32_t insn)
}
case 0b0010100:
switch (rm) {
case 0b000: /* FMIN */
case 0b000: { /* FMIN */
/*
In IEEE754-201x, fmin(x, y) return
- min(x,y) if both numbers are not NaN
Expand Down Expand Up @@ -1107,8 +1107,9 @@ static inline bool op_fp(struct riscv_t *rv, uint32_t insn)
}
}
break;
case 0b001: /* FMAX */

}
case 0b001:{ /* FMAX */
uint32_t x, y;
memcpy(&x, rv->F + rs1, 4);
memcpy(&y, rv->F + rs2, 4);
if (is_nan(x) || is_nan(y)) {
Expand Down Expand Up @@ -1142,6 +1143,7 @@ static inline bool op_fp(struct riscv_t *rv, uint32_t insn)


break;
}
default:
rv_except_illegal_insn(rv, insn);
return false;
Expand Down

0 comments on commit 1d5c1c0

Please sign in to comment.