Skip to content

Commit

Permalink
Merge pull request #113 from pulp-platform/flexfloat-on-quad-ifdef
Browse files Browse the repository at this point in the history
Build __float128 in flexfloat only if it is actually used
  • Loading branch information
NBruschi authored Jan 28, 2022
2 parents 1fc3389 + 465ec9a commit 4d4ce6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tools/gvsoc/common/models/cpu/iss/flexfloat/flexfloat.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ INLINE void ff_init_longdouble(flexfloat_t *obj, long double value, flexfloat_de
flexfloat_sanitize(obj);
}

#ifdef FLEXFLOAT_ON_QUAD
INLINE void ff_init_float128(flexfloat_t *obj, __float128 value, flexfloat_desc_t desc) {
obj->value = (fp_t)value;
#ifdef FLEXFLOAT_TRACKING
Expand All @@ -391,6 +392,7 @@ INLINE void ff_init_float128(flexfloat_t *obj, __float128 value, flexfloat_desc_
obj->desc = desc;
flexfloat_sanitize(obj);
}
#endif

INLINE void ff_init_int(flexfloat_t *obj, int value, flexfloat_desc_t desc) {
obj->value = (fp_t)value;
Expand Down Expand Up @@ -447,9 +449,11 @@ INLINE long double ff_get_longdouble(const flexfloat_t *obj) {
return (long double)(*((const fp_t *)(&(obj->value))));
}

#ifdef FLEXFLOAT_ON_QUAD
INLINE __float128 ff_get_float128(const flexfloat_t *obj) {
return (__float128)(*((const fp_t *)(&(obj->value))));
}
#endif


// Arithmetics
Expand Down
8 changes: 6 additions & 2 deletions tools/gvsoc/common/models/cpu/iss/flexfloat/flexfloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ void ff_init(flexfloat_t *obj, flexfloat_desc_t desc);
void ff_init_float(flexfloat_t *obj, float value, flexfloat_desc_t desc);
void ff_init_double(flexfloat_t *obj, double value, flexfloat_desc_t desc);
void ff_init_longdouble(flexfloat_t *obj, long double value, flexfloat_desc_t desc);
void ff_init_float128(flexfloat_t *obj, __float128 value, flexfloat_desc_t desc);
#ifdef FLOAT_ON_QUAD
void ff_init_float128(flexfloat_t *obj, __float128 value, flexfloat_desc_t desc);
#endif
void ff_init_int(flexfloat_t *obj, int value, flexfloat_desc_t desc);
void ff_init_long(flexfloat_t *obj, long value, flexfloat_desc_t desc);
void ff_cast(flexfloat_t *obj, const flexfloat_t *source, flexfloat_desc_t desc);
Expand All @@ -217,7 +219,9 @@ void ff_cast(flexfloat_t *obj, const flexfloat_t *source, flexfloat_desc_t desc)
float ff_get_float(const flexfloat_t *obj);
double ff_get_double(const flexfloat_t *obj);
long double ff_get_longdouble(const flexfloat_t *obj);
__float128 ff_get_float128(const flexfloat_t *obj);
#ifdef FLOAT_ON_QUAD
__float128 ff_get_float128(const flexfloat_t *obj);
#endif


// Artihmetic operators
Expand Down

0 comments on commit 4d4ce6e

Please sign in to comment.