Skip to content

Commit

Permalink
Merge pull request #266 from visitorckw/fix-softfloat-build-failure
Browse files Browse the repository at this point in the history
Fix SoftFloat build failure
  • Loading branch information
jserv authored Nov 16, 2023
2 parents c9dda3f + 129aca2 commit dcf217d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/riscv.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
#include <stdbool.h>
#include <stdint.h>
#if RV32_HAS(EXT_F)
#define float16_t softfloat_float16_t
#define bfloat16_t softfloat_bfloat16_t
#define float32_t softfloat_float32_t
#define float64_t softfloat_float64_t
#include "softfloat/softfloat.h"
#undef float16_t
#undef bfloat16_t
#undef float32_t
#undef float64_t
#endif

#ifdef __cplusplus
Expand Down Expand Up @@ -93,7 +101,7 @@ typedef uint16_t riscv_half_t;
typedef uint8_t riscv_byte_t;
typedef uint32_t riscv_exception_t;
#if RV32_HAS(EXT_F)
typedef float32_t riscv_float_t;
typedef softfloat_float32_t riscv_float_t;
#endif

/* memory read handlers */
Expand Down
8 changes: 4 additions & 4 deletions src/rv32_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ RVOP(fmadds, {
/* FMSUB.S */
RVOP(fmsubs, {
set_rounding_mode(rv);
float32_t tmp = rv->F[ir->rs3];
riscv_float_t tmp = rv->F[ir->rs3];
tmp.v ^= FMASK_SIGN;
rv->F[ir->rd] = f32_mulAdd(rv->F[ir->rs1], rv->F[ir->rs2], tmp);
set_fflag(rv);
Expand All @@ -636,7 +636,7 @@ RVOP(fmsubs, {
/* FNMSUB.S */
RVOP(fnmsubs, {
set_rounding_mode(rv);
float32_t tmp = rv->F[ir->rs1];
riscv_float_t tmp = rv->F[ir->rs1];
tmp.v ^= FMASK_SIGN;
rv->F[ir->rd] = f32_mulAdd(tmp, rv->F[ir->rs2], rv->F[ir->rs3]);
set_fflag(rv);
Expand All @@ -645,8 +645,8 @@ RVOP(fnmsubs, {
/* FNMADD.S */
RVOP(fnmadds, {
set_rounding_mode(rv);
float32_t tmp1 = rv->F[ir->rs1];
float32_t tmp2 = rv->F[ir->rs3];
riscv_float_t tmp1 = rv->F[ir->rs1];
riscv_float_t tmp2 = rv->F[ir->rs3];
tmp1.v ^= FMASK_SIGN;
tmp2.v ^= FMASK_SIGN;
rv->F[ir->rd] = f32_mulAdd(tmp1, rv->F[ir->rs2], tmp2);
Expand Down

0 comments on commit dcf217d

Please sign in to comment.