Skip to content

Commit dcf217d

Browse files
authored
Merge pull request #266 from visitorckw/fix-softfloat-build-failure
Fix SoftFloat build failure
2 parents c9dda3f + 129aca2 commit dcf217d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/riscv.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
#include <stdbool.h>
88
#include <stdint.h>
99
#if RV32_HAS(EXT_F)
10+
#define float16_t softfloat_float16_t
11+
#define bfloat16_t softfloat_bfloat16_t
12+
#define float32_t softfloat_float32_t
13+
#define float64_t softfloat_float64_t
1014
#include "softfloat/softfloat.h"
15+
#undef float16_t
16+
#undef bfloat16_t
17+
#undef float32_t
18+
#undef float64_t
1119
#endif
1220

1321
#ifdef __cplusplus
@@ -93,7 +101,7 @@ typedef uint16_t riscv_half_t;
93101
typedef uint8_t riscv_byte_t;
94102
typedef uint32_t riscv_exception_t;
95103
#if RV32_HAS(EXT_F)
96-
typedef float32_t riscv_float_t;
104+
typedef softfloat_float32_t riscv_float_t;
97105
#endif
98106

99107
/* memory read handlers */

src/rv32_template.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ RVOP(fmadds, {
627627
/* FMSUB.S */
628628
RVOP(fmsubs, {
629629
set_rounding_mode(rv);
630-
float32_t tmp = rv->F[ir->rs3];
630+
riscv_float_t tmp = rv->F[ir->rs3];
631631
tmp.v ^= FMASK_SIGN;
632632
rv->F[ir->rd] = f32_mulAdd(rv->F[ir->rs1], rv->F[ir->rs2], tmp);
633633
set_fflag(rv);
@@ -636,7 +636,7 @@ RVOP(fmsubs, {
636636
/* FNMSUB.S */
637637
RVOP(fnmsubs, {
638638
set_rounding_mode(rv);
639-
float32_t tmp = rv->F[ir->rs1];
639+
riscv_float_t tmp = rv->F[ir->rs1];
640640
tmp.v ^= FMASK_SIGN;
641641
rv->F[ir->rd] = f32_mulAdd(tmp, rv->F[ir->rs2], rv->F[ir->rs3]);
642642
set_fflag(rv);
@@ -645,8 +645,8 @@ RVOP(fnmsubs, {
645645
/* FNMADD.S */
646646
RVOP(fnmadds, {
647647
set_rounding_mode(rv);
648-
float32_t tmp1 = rv->F[ir->rs1];
649-
float32_t tmp2 = rv->F[ir->rs3];
648+
riscv_float_t tmp1 = rv->F[ir->rs1];
649+
riscv_float_t tmp2 = rv->F[ir->rs3];
650650
tmp1.v ^= FMASK_SIGN;
651651
tmp2.v ^= FMASK_SIGN;
652652
rv->F[ir->rd] = f32_mulAdd(tmp1, rv->F[ir->rs2], tmp2);

0 commit comments

Comments
 (0)