Skip to contentSkip to conversation

softfloat: rename make_float[x80|128]_init to const_float[x80|128]

PATCH Superseded Laurent Vivier 3 participants 3 messages Sep 19, 2017 – Sep 20, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 softfloat: rename make_float[x80|128]_init to const_float[x80|128]

We already have const_float16(), const_float32() and const_float64(), so rename make_floatx80_init() and make_float128_init() as const_floatx80() and const_float128().

Redefine make_float16(), make_float32() and make_float64() as make_floatx80() and make_float128() using a cast.

---
v2: change float16(), make_float32() and make_float64()
instead of make_floatx80() and make_float128()

 include/fpu/softfloat.h  | 10 +++++-----
 target/m68k/fpu_helper.c | 44 ++++++++++++++++++++++----------------------
 2 files changed, 27 insertions(+), 27 deletions(-)
include/fpu/softfloat.h +5 -5
index 0f96a0edd1..cda6421b23 100644
@@ -113,20 +113,20 @@ typedef struct {
     uint16_t v;
 } float16;
 #define float16_val(x) (((float16)(x)).v)
-#define make_float16(x) __extension__ ({ float16 f16_val = {x}; f16_val; })
+#define make_float16(x) ((float16) { x })
 #define const_float16(x) { x }
 typedef struct {
     uint32_t v;
 } float32;
 /* The cast ensures an error if the wrong type is passed.  */
 #define float32_val(x) (((float32)(x)).v)
-#define make_float32(x) __extension__ ({ float32 f32_val = {x}; f32_val; })
+#define make_float32(x) ((float32) { x })
 #define const_float32(x) { x }
 typedef struct {
     uint64_t v;
 } float64;
 #define float64_val(x) (((float64)(x)).v)
-#define make_float64(x) __extension__ ({ float64 f64_val = {x}; f64_val; })
+#define make_float64(x) ((float64) { x })
 #define const_float64(x) { x }
 #else
 typedef uint16_t float16;
@@ -147,7 +147,7 @@ typedef struct {
     uint16_t high;
 } floatx80;
 #define make_floatx80(exp, mant) ((floatx80) { mant, exp })
-#define make_floatx80_init(exp, mant) { .low = mant, .high = exp }
+#define const_floatx80(exp, mant) { .low = mant, .high = exp }
 typedef struct {
 #ifdef HOST_WORDS_BIGENDIAN
     uint64_t high, low;
@@ -156,7 +156,7 @@ typedef struct {
 #endif
 } float128;
 #define make_float128(high_, low_) ((float128) { .high = high_, .low = low_ })
-#define make_float128_init(high_, low_) { .high = high_, .low = low_ }
+#define const_float128(high_, low_) { .high = high_, .low = low_ }
 
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE floating-point underflow tininess-detection mode.
target/m68k/fpu_helper.c +22 -22

50 lines not on this page · raw message

Signature · 1 line
2.13.5
#1 lore raw
Quoted 2 lines · Laurent Vivier

We already have const_float16(), const_float32() and const_float64(), so rename make_floatx80_init() and make_float128_init() as

s/as/to now be/

Quoted 1 line

const_floatx80() and const_float128().

s/\./, for consistency./

Quoted 2 lines

Redefine make_float16(), make_float32() and make_float64() as

s/as/to be like/

Quoted 1 line

make_floatx80() and make_float128() using a cast.

s/ using a cast/, by using a compound literal/

I almost wonder if splitting this patch into two parts makes more sense (one for the renaming of make_float[x80,128]_init, the other for the rewriting of make_float[16,32,64] from gcc extension to compound literal).

At any rate, the code itself looks fine.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by
#2 lore raw
Quoted 11 lines · Eric Blake
Quoted 2 lines · Laurent Vivier

We already have const_float16(), const_float32() and const_float64(), so rename make_floatx80_init() and make_float128_init() as

s/as/to now be/

Quoted 1 line

const_floatx80() and const_float128().

s/\./, for consistency./

Quoted 1 line
Quoted 7 lines
Quoted 1 line

Redefine make_float16(), make_float32() and make_float64() as

s/as/to be like/

Quoted 1 line

make_floatx80() and make_float128() using a cast.

s/ using a cast/, by using a compound literal/

I was about to make the same quibble.

Quoted 3 lines

I almost wonder if splitting this patch into two parts makes more sense (one for the renaming of make_float[x80,128]_init, the other for the rewriting of make_float[16,32,64] from gcc extension to compound literal).

I think the patch is fine as-is.

Fix the patch description and I'll give it

r~