diff mbox series

[RFC,5/8] fpu/softfloat: define brain floating-point types

Message ID 20200712234521.3972-6-zhiwei_liu@c-sky.com (mailing list archive)
State New, archived
Headers show
Series Implement blfoat16 in softfloat | expand

Commit Message

LIU Zhiwei July 12, 2020, 11:45 p.m. UTC
Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
---
 include/fpu/softfloat-types.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Richard Henderson July 13, 2020, 7:26 p.m. UTC | #1
On 7/12/20 4:45 PM, LIU Zhiwei wrote:
> Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
> ---
>  include/fpu/softfloat-types.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
> index 7680193ebc..8f8fdfeecf 100644
> --- a/include/fpu/softfloat-types.h
> +++ b/include/fpu/softfloat-types.h
> @@ -112,6 +112,14 @@ typedef struct {
>  #define make_float128(high_, low_) ((float128) { .high = high_, .low = low_ })
>  #define make_float128_init(high_, low_) { .high = high_, .low = low_ }
>  
> +/*
> + * Software brain floating-point types
> + */
> +typedef uint16_t bfloat16;
> +#define bfloat16_val(x) (x)
> +#define make_bfloat16(x) (x)
> +#define const_bfloat16(x) (x)

I do not like the val/make/const macros.  I've been meaning to get them everywhere.

The word "brain" is better translated as "neural-network" in english.


r~
LIU Zhiwei July 13, 2020, 8:22 p.m. UTC | #2
On 2020/7/14 3:26, Richard Henderson wrote:
> On 7/12/20 4:45 PM, LIU Zhiwei wrote:
>> Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
>> ---
>>   include/fpu/softfloat-types.h | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
>> index 7680193ebc..8f8fdfeecf 100644
>> --- a/include/fpu/softfloat-types.h
>> +++ b/include/fpu/softfloat-types.h
>> @@ -112,6 +112,14 @@ typedef struct {
>>   #define make_float128(high_, low_) ((float128) { .high = high_, .low = low_ })
>>   #define make_float128_init(high_, low_) { .high = high_, .low = low_ }
>>   
>> +/*
>> + * Software brain floating-point types
>> + */
>> +typedef uint16_t bfloat16;
>> +#define bfloat16_val(x) (x)
>> +#define make_bfloat16(x) (x)
>> +#define const_bfloat16(x) (x)
> I do not like the val/make/const macros.  I've been meaning to get them everywhere.
Yes, but they have been spread to everywhere.

Should we just make bfloat16 different or remove all other references?
> The word "brain" is better translated as "neural-network" in english.
Do you mean the comment here should be

+/*
+ * Software neural-network floating-point types
+ */

Zhiwei
>
> r~
Richard Henderson July 13, 2020, 9:48 p.m. UTC | #3
On 7/13/20 1:22 PM, LIU Zhiwei wrote:
> Should we just make bfloat16 different or remove all other references?

If you have time to do a global remove, I would be grateful.  Otherwise, let's
just make bfloat16 different.


>> The word "brain" is better translated as "neural-network" in english.
> Do you mean the comment here should be
> 
> +/*
> + * Software neural-network floating-point types
> + */

Yes, thanks.


r~
diff mbox series

Patch

diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
index 7680193ebc..8f8fdfeecf 100644
--- a/include/fpu/softfloat-types.h
+++ b/include/fpu/softfloat-types.h
@@ -112,6 +112,14 @@  typedef struct {
 #define make_float128(high_, low_) ((float128) { .high = high_, .low = low_ })
 #define make_float128_init(high_, low_) { .high = high_, .low = low_ }
 
+/*
+ * Software brain floating-point types
+ */
+typedef uint16_t bfloat16;
+#define bfloat16_val(x) (x)
+#define make_bfloat16(x) (x)
+#define const_bfloat16(x) (x)
+
 /*
  * Software IEC/IEEE floating-point underflow tininess-detection mode.
  */