softfloat updates (include tweaks, rm LIT64)
v3 cover softfloat updates (include tweaks, rm LIT64)
Hi,
Another iteration of updates for softfloat. Instead of moving the LIT64() macro from one file to another we convert the uses to the stdint.h macro. I did eliminate one of the uses by converting the squash_input_denormal functions to the new style code. However as you can see with the follow-up patch it bloated the code a little. I'd like to convert the x80 and 128bit FP functions to the new style but the challenge is seeing how we can get greater re-use of the common functions without bloating the generated code. However if we can do that we should eliminate a class of bugs in the current code.
There are a bunch of minor checkpatch complaints as all touched lines haven't been fully converted to the proper brace style but I avoided do that to make the patch more readable.
The following patches need review:
01 - fpu replace LIT64 usage with UINT64_C for special 02 - fpu convert float 16 32 64 _squash_denormal to ne 03 - fpu optimise float 16 32 64 _squash_denormal HACK 04 - fpu use min max values from stdint.h for integral 05 - fpu replace LIT64 with UINT64_C macros 06 - target m68k replace LIT64 with UINT64_C macros 07 - fpu remove the LIT64 macro
Alex Bennée (13):
fpu: replace LIT64 usage with UINT64_C for specialize constants
fpu: convert float[16/32/64]_squash_denormal to new modern style
fpu: optimise float[16/32/64]_squash_denormal (HACK?)
fpu: use min/max values from stdint.h for integral overflow
fpu: replace LIT64 with UINT64_C macros
target/m68k: replace LIT64 with UINT64_C macros
fpu: remove the LIT64 macro
fpu: move inline helpers into a separate header
fpu: make softfloat-macros "self-contained"
fpu: rename softfloat-specialize.h -> .inc.c target/mips: rationalise softfloat includes target/riscv: rationalise softfloat includes
targets (various): use softfloat-helpers.h where we can
...pecialize.h => softfloat-specialize.inc.c} | 26 +-
fpu/softfloat.c | 262 ++++++++----------
include/fpu/softfloat-helpers.h | 132 +++++++++
include/fpu/softfloat-macros.h | 8 +-
include/fpu/softfloat.h | 65 +----
linux-user/mips/cpu_loop.c | 1 +
target/alpha/helper.c | 2 +-
target/m68k/softfloat.c | 98 +++----
target/microblaze/cpu.c | 2 +-
target/mips/cpu.h | 8 +-
target/mips/internal.h | 7 +
target/mips/msa_helper.c | 1 +
target/mips/op_helper.c | 1 +
target/riscv/cpu.c | 1 +
target/riscv/cpu.h | 2 +-
target/riscv/fpu_helper.c | 1 +
target/s390x/cpu.c | 2 +-
target/sh4/cpu.c | 3 +-
target/tricore/helper.c | 2 +-
target/unicore32/cpu.c | 1 -
20 files changed, 342 insertions(+), 283 deletions(-)
rename fpu/{softfloat-specialize.h => softfloat-specialize.inc.c} (98%)
create mode 100644 include/fpu/softfloat-helpers.hSignature · 1 line
2.20.1
PATCH v3 1/13 fpu: replace LIT64 usage with UINT64_C for specialize constants
We have a wrapper that does the right thing from stdint.h so lets use it for our constants in softfloat-specialize.h
--- fpu/softfloat-specialize.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
fpu/softfloat-specialize.h +13 -13
@@ -196,11 +196,11 @@ floatx80 floatx80_default_nan(float_status *status)/* None of the targets that have snan_bit_is_one use floatx80. */ assert (!snan_bit_is_one (status));#if defined(TARGET_M68K ) - r.low =LIT64 (0xFFFFFFFFFFFFFFFF ); + r.low =UINT64_C (0xFFFFFFFFFFFFFFFF ); r.high =0x7FFF ;#else /* X86 */ - r.low =LIT64 (0xC000000000000000 ); + r.low =UINT64_C (0xC000000000000000 ); r.high =0xFFFF ;#endif return r;
@@ -212,9 +212,9 @@ floatx80 floatx80_default_nan(float_status *status)#define floatx80_infinity_high 0x7FFF#if defined(TARGET_M68K ) -#define floatx80_infinity_low LIT64(0x0000000000000000) +#define floatx80_infinity_low UINT64_C(0x0000000000000000)#else -#define floatx80_infinity_low LIT64(0x8000000000000000) +#define floatx80_infinity_low UINT64_C(0x8000000000000000)#endif const floatx80 floatx80_infinity
@@ -667,7 +667,7 @@ int float64_is_signaling_nan(float64 a_, float_status *status) return ((a << 1) >= 0xFFF0000000000000ULL); }else {return (((a >>51 ) &0xFFF ) ==0xFFE ) - && (a &LIT64 (0x0007FFFFFFFFFFFF )); + && (a &UINT64_C (0x0007FFFFFFFFFFFF )); }#endif }
@@ -707,7 +707,7 @@ static float64 commonNaNToFloat64(commonNaNT a, float_status *status)if (mantissa) {return make_float64 ( (((uint64_t ) a.sign) <<63 ) - |LIT64 (0x7FF0000000000000 ) + |UINT64_C (0x7FF0000000000000 ) | (a.high >>12 )); }else {return float64_default_nan (status);
@@ -790,7 +790,7 @@ int floatx80_is_quiet_nan(floatx80 a, float_status *status) && (a.low == aLow); }else {return ((a.high &0x7FFF ) ==0x7FFF ) - && (LIT64 (0x8000000000000000 ) <= ((uint64_t )(a.low <<1 ))); + && (UINT64_C (0x8000000000000000 ) <= ((uint64_t )(a.low <<1 ))); }#endif }
@@ -812,7 +812,7 @@ int floatx80_is_signaling_nan(floatx80 a, float_status *status) }else {uint64_t aLow; - aLow = a.low & ~LIT64 (0x4000000000000000 ); + aLow = a.low & ~UINT64_C (0x4000000000000000 );return ((a.high &0x7FFF ) ==0x7FFF ) && (uint64_t )(aLow <<1 ) && (a.low == aLow);
@@ -829,7 +829,7 @@ floatx80 floatx80_silence_nan(floatx80 a, float_status *status) {/* None of the targets that have snan_bit_is_one use floatx80. */ assert (!snan_bit_is_one (status)); - a.low |=LIT64 (0xC000000000000000 ); + a.low |=UINT64_C (0xC000000000000000 );return a; }
@@ -874,7 +874,7 @@ static floatx80 commonNaNToFloatx80(commonNaNT a, float_status *status) }if (a.high >>1 ) { - z.low =LIT64 (0x8000000000000000 ) | a.high >>1 ; + z.low =UINT64_C (0x8000000000000000 ) | a.high >>1 ; z.high = (((uint16_t )a.sign) <<15 ) |0x7FFF ; }else { z =floatx80_default_nan (status);
@@ -969,7 +969,7 @@ int float128_is_signaling_nan(float128 a, float_status *status) && (a.low || (a.high & 0x0000FFFFFFFFFFFFULL)); }else {return (((a.high >>47 ) &0xFFFF ) ==0xFFFE ) - && (a.low || (a.high &LIT64 (0x00007FFFFFFFFFFF ))); + && (a.low || (a.high &UINT64_C (0x00007FFFFFFFFFFF ))); }#endif }
@@ -987,7 +987,7 @@ float128 float128_silence_nan(float128 a, float_status *status)if (snan_bit_is_one (status)) {return float128_default_nan (status); }else { - a.high |=LIT64 (0x0000800000000000 ); + a.high |=UINT64_C (0x0000800000000000 );return a; }#endif
@@ -1025,7 +1025,7 @@ static float128 commonNaNToFloat128(commonNaNT a, float_status *status) }shift128Right (a.high, a.low,16 , &z.high, &z.low); - z.high |= (((uint64_t )a.sign) <<63 ) |LIT64 (0x7FFF000000000000 ); + z.high |= (((uint64_t )a.sign) <<63 ) |UINT64_C (0x7FFF000000000000 );return z; }
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 01/13] fpu: replace LIT64 usage with UINT64_C for specialize constants
Quoted 7 lines · Alex Bennée
We have a wrapper that does the right thing from
stdint.hso lets use it for our constants insoftfloat-specialize.hSigned-off-by Alex Bennée <[email protected]>--- fpu/softfloat-specialize.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
r~
PATCH v3 2/13 fpu: convert float[16/32/64]_squash_denormal to new modern style
In reply to Alex BennéeThis also allows us to remove the extractFloat16exp/frac helpers.
--- fpu/softfloat.c | 110 +++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 63 deletions(-)
fpu/softfloat.c +47 -63
@@ -414,24 +414,6 @@ float64_gen2(float64 xa, float64 xb, float_status *s,return soft (ua.s, ub.s, s); } -/*---------------------------------------------------------------------------- -| Returns the fraction bits of the half-precision floating-point value `a'. -*----------------------------------------------------------------------------*/ - -static inline uint32_t extractFloat16Frac (float16 a) -{ -return float16_val (a) &0x3ff ; -} - -/*---------------------------------------------------------------------------- -| Returns the exponent bits of the half-precision floating-point value `a'. -*----------------------------------------------------------------------------*/ - -static inline int extractFloat16Exp (float16 a) -{ -return (float16_val (a) >>10 ) &0x1f ; -} -/*---------------------------------------------------------------------------- | Returns the fraction bits of the single-precision floating-point value `a'. *----------------------------------------------------------------------------*/
@@ -3306,6 +3288,53 @@ float64 float64_silence_nan(float64 a, float_status *status)return float64_pack_raw (p); } + +/*---------------------------------------------------------------------------- +| If `a' is denormal and we are in flush-to-zero mode then set the +| input-denormal exception and return zero. Otherwise just return the value. +*----------------------------------------------------------------------------*/ + +static FloatParts parts_squash_denormal (FloatParts p,float_status *status) +{ +if (p.exp ==0 && p.frac !=0 ) { +float_raise (float_flag_input_denormal, status); + p.frac =0 ; + p.cls = float_class_zero; + } + +return p; +} + +float16 float16_squash_input_denormal (float16 a,float_status *status) +{ +if (status->flush_inputs_to_zero) { +FloatParts p =float16_unpack_raw (a); + p =parts_squash_denormal (p, status); +return float16_pack_raw (p); + } +return a; +} + +float32 float32_squash_input_denormal (float32 a,float_status *status) +{ +if (status->flush_inputs_to_zero) { +FloatParts p =float32_unpack_raw (a); + p =parts_squash_denormal (p, status); +return float32_pack_raw (p); + } +return a; +} + +float64 float64_squash_input_denormal (float64 a,float_status *status) +{ +if (status->flush_inputs_to_zero) { +FloatParts p =float64_unpack_raw (a); + p =parts_squash_denormal (p, status); +return float64_pack_raw (p); + } +return a; +} +/*---------------------------------------------------------------------------- | Takes a 64-bit fixed-point value `absZ' with binary point between bits 6 | and 7, and returns the properly rounded 32-bit integer corresponding to the
@@ -3482,21 +3511,6 @@ static int64_t roundAndPackUint64(flag zSign, uint64_t absZ0,return absZ0; } -/*---------------------------------------------------------------------------- -| If `a' is denormal and we are in flush-to-zero mode then set the -| input-denormal exception and return zero. Otherwise just return the value. -*----------------------------------------------------------------------------*/ -float32 float32_squash_input_denormal (float32 a,float_status *status) -{ -if (status->flush_inputs_to_zero) { -if (extractFloat32Exp (a) ==0 &&extractFloat32Frac (a) !=0 ) { -float_raise (float_flag_input_denormal, status); -return make_float32 (float32_val (a) &0x80000000 ); - } - } -return a; -} -/*---------------------------------------------------------------------------- | Normalizes the subnormal single-precision floating-point value represented | by the denormalized significand `aSig'. The normalized exponent and
@@ -3635,21 +3649,6 @@ static float32 } -/*---------------------------------------------------------------------------- -| If `a' is denormal and we are in flush-to-zero mode then set the -| input-denormal exception and return zero. Otherwise just return the value. -*----------------------------------------------------------------------------*/ -float64 float64_squash_input_denormal (float64 a,float_status *status) -{ -if (status->flush_inputs_to_zero) { -if (extractFloat64Exp (a) ==0 &&extractFloat64Frac (a) !=0 ) { -float_raise (float_flag_input_denormal, status); -return make_float64 (float64_val (a) & (1ULL <<63 )); - } - } -return a; -} -/*---------------------------------------------------------------------------- | Normalizes the subnormal double-precision floating-point value represented | by the denormalized significand `aSig'. The normalized exponent and
@@ -4981,21 +4980,6 @@ int float32_unordered_quiet(float32 a, float32 b, float_status *status)return 0 ; } -/*---------------------------------------------------------------------------- -| If `a' is denormal and we are in flush-to-zero mode then set the -| input-denormal exception and return zero. Otherwise just return the value. -*----------------------------------------------------------------------------*/ -float16 float16_squash_input_denormal (float16 a,float_status *status) -{ -if (status->flush_inputs_to_zero) { -if (extractFloat16Exp (a) ==0 &&extractFloat16Frac (a) !=0 ) { -float_raise (float_flag_input_denormal, status); -return make_float16 (float16_val (a) &0x8000 ); - } - } -return a; -} -/*---------------------------------------------------------------------------- | Returns the result of converting the double-precision floating-point value | `a' to the extended double-precision floating-point format. The conversion
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 02/13] fpu: convert float[16/32/64]_squash_denormal to new modern style
Quoted 10 lines · Alex Bennée
fpu/softfloat.c +10
-0+static FloatParts parts_squash_denormal (FloatParts p,float_status *status) +{ +if (p.exp ==0 && p.frac !=0 ) { +float_raise (float_flag_input_denormal, status); + p.frac =0 ; + p.cls = float_class_zero; + } + +return p; +}
fpu/softfloat.c float64 float64_silence_nan(float64 a, float_status *status) · line 3316
Quoted 10 lines
fpu/softfloat.c +10
-0+ +float16 float16_squash_input_denormal (float16 a,float_status *status) +{ +if (status->flush_inputs_to_zero) { +FloatParts p =float16_unpack_raw (a); + p =parts_squash_denormal (p, status); +return float16_pack_raw (p); + } +return a; +}
Hmm. Maybe avoid the re-pack in the likely chance that we can?
static bool parts_squash_denormal(FloatParts p, float_status *status)
{
if (p.exp == 0 && p.frac != 0) {
float_raise(float_flag_input_denormal, status);
return true;
}
return false;
}float16 float16_squash_input_denormal(float16 a, float_status *status)
{
if (status->flush_inputs_to_zero) {
FloatParts p = float16_unpack_raw(a);
if (parts_squash_denormal(p, status)) {
return float16_set_sign(float16_zero, p.sign);
}
}
return a;
}Re: [Qemu-devel] [PATCH v3 02/13] fpu: convert float[16/32/64]_squash_denormal to new modern style
Quoted 33 lines · Richard Henderson
Quoted 10 lines · Alex Bennée
fpu/softfloat.c +10
-0+static FloatParts parts_squash_denormal (FloatParts p,float_status *status) +{ +if (p.exp ==0 && p.frac !=0 ) { +float_raise (float_flag_input_denormal, status); + p.frac =0 ; + p.cls = float_class_zero; + } + +return p; +}fpu/softfloat.c float64 float64_silence_nan(float64 a, float_status *status) · line 3316
Quoted 10 lines
fpu/softfloat.c +10
-0+ +float16 float16_squash_input_denormal (float16 a,float_status *status) +{ +if (status->flush_inputs_to_zero) { +FloatParts p =float16_unpack_raw (a); + p =parts_squash_denormal (p, status); +return float16_pack_raw (p); + } +return a; +}Hmm. Maybe avoid the re-pack in the likely chance that we can?
static bool
parts_squash_denormal(FloatParts p, float_status *status){ if (p.exp == 0 && p.frac != 0) { float_raise(float_flag_input_denormal, status); return true; } return false; }
Quoted 7 lines
float16
float16_squash_input_denormal(float16 a, float_status *status){ if (status->flush_inputs_to_zero) { FloatParts p = float16_unpack_raw(a); if (parts_squash_denormal(p, status)) { return float16_set_sign(float16_zero, p.sign); }
I'll squash with the next patch and use the set_sign rather than make_float and see if it's the same.
Quoted 3 lines
}
return a;
}--
Alex Bennée
PATCH v3 3/13 fpu: optimise float[16/32/64]_squash_denormal (HACK?)
In reply to Alex BennéeUsing the floatXX_pack_raw functions is slight overkill for basically just masking out all but the top bit of the number. This makes the final code exactly the same as pre-conversion.
TODO: is this worth it, can the compiler do better with make_float?
--- fpu/softfloat.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
fpu/softfloat.c +12 -10
@@ -3294,23 +3294,23 @@ float64 float64_silence_nan(float64 a, float_status *status)| input-denormal exception and return zero. Otherwise just return the value. *----------------------------------------------------------------------------*/ -static FloatParts parts_squash_denormal (FloatParts p,float_status *status) +static bool parts_squash_denormal (FloatParts p,float_status *status) {if (p.exp ==0 && p.frac !=0 ) {float_raise (float_flag_input_denormal, status); - p.frac =0 ; - p.cls = float_class_zero; +return true; } -return p; +return false; }float16 float16_squash_input_denormal (float16 a,float_status *status) {if (status->flush_inputs_to_zero) {FloatParts p =float16_unpack_raw (a); - p =parts_squash_denormal (p, status); -return float16_pack_raw (p); +if (parts_squash_denormal (p, status)) { + a =make_float16 (float16_val (a) &0x8000 ); + } }return a; }
@@ -3319,8 +3319,9 @@ float32 float32_squash_input_denormal(float32 a, float_status *status) {if (status->flush_inputs_to_zero) {FloatParts p =float32_unpack_raw (a); - p =parts_squash_denormal (p, status); -return float32_pack_raw (p); +if (parts_squash_denormal (p, status)) { + a =make_float32 (float32_val (a) &0x80000000 ); + } }return a; }
@@ -3329,8 +3330,9 @@ float64 float64_squash_input_denormal(float64 a, float_status *status) {if (status->flush_inputs_to_zero) {FloatParts p =float64_unpack_raw (a); - p =parts_squash_denormal (p, status); -return float64_pack_raw (p); +if (parts_squash_denormal (p, status)) { + a =make_float64 (float64_val (a) & (1ULL <<63 )); + } }return a; }
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 03/13] fpu: optimise float[16/32/64]_squash_denormal (HACK?)
Quoted 10 lines · Alex Bennée
Using the
floatXX_pack_rawfunctions is slight overkill for basically just masking out all but the top bit of the number. This makes the final code exactly the same as pre-conversion.TODO: is this worth it, can the compiler do better with
make_float?Signed-off-by Alex Bennée <[email protected]>--- fpu/softfloat.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
Hah. I just suggested something similar vs patch 2.
r~
PATCH v3 4/13 fpu: use min/max values from stdint.h for integral overflow
In reply to Alex BennéeRemove some more use of LIT64 while making the meaning more clear. We also avoid the need of casts as the results by definition fit into the return type.
--- fpu/softfloat.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
fpu/softfloat.c +14 -16
@@ -3444,9 +3444,7 @@ static int64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1,if ( z && ( ( z <0 ) ^ zSign ) ) { overflow:float_raise (float_flag_invalid, status); -return - zSign ? (int64_t )LIT64 (0x8000000000000000 ) - :LIT64 (0x7FFFFFFFFFFFFFFF ); +return zSign ?INT64_MIN :INT64_MAX ; }if (absZ1) { status->float_exception_flags |= float_flag_inexact;
@@ -3497,7 +3495,7 @@ static int64_t roundAndPackUint64(flag zSign, uint64_t absZ0, ++absZ0;if (absZ0 ==0 ) {float_raise (float_flag_invalid, status); -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; } absZ0 &= ~(((uint64_t )(absZ1<<1 ) ==0 ) & roundNearestEven); }
@@ -5518,9 +5516,9 @@ int64_t floatx80_to_int64(floatx80 a, float_status *status)if ( shiftCount ) {float_raise (float_flag_invalid, status);if (!aSign ||floatx80_is_any_nan (a)) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; } aSigExtra =0 ; }
@@ -5561,10 +5559,10 @@ int64_t floatx80_to_int64_round_to_zero(floatx80 a, float_status *status)if ( ( a.high !=0xC03E ) || aSig ) {float_raise (float_flag_invalid, status);if ( ! aSign || ( ( aExp ==0x7FFF ) && aSig ) ) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; }else if ( aExp <0x3FFF ) {if (aExp | aSig) {
@@ -6623,7 +6621,7 @@ int32_t float128_to_int32_round_to_zero(float128 a, float_status *status)if ( ( z <0 ) ^ aSign ) { invalid:float_raise (float_flag_invalid, status); -return aSign ? (int32_t )0x80000000 :0x7FFFFFFF ; +return aSign ?INT32_MIN :INT32_MAX ; }if ( ( aSig0<<shiftCount ) != savedASig ) { status->float_exception_flags |= float_flag_inexact;
@@ -6662,9 +6660,9 @@ int64_t float128_to_int64(float128 a, float_status *status) && ( aSig1 || ( aSig0 != LIT64( 0x0001000000000000 ) ) ) ) ) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; }shortShift128Left ( aSig0, aSig1, - shiftCount, &aSig0, &aSig1 ); }
@@ -6710,10 +6708,10 @@ int64_t float128_to_int64_round_to_zero(float128 a, float_status *status)else {float_raise (float_flag_invalid, status);if ( ! aSign || ( ( aExp ==0x7FFF ) && ( aSig0 | aSig1 ) ) ) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; } z = ( aSig0<<shiftCount ) | ( aSig1>>( ( - shiftCount ) &63 ) );if ( (uint64_t ) ( aSig1<<shiftCount ) ) {
@@ -6764,19 +6762,19 @@ uint64_t float128_to_uint64(float128 a, float_status *status)if (aSign && (aExp >0x3FFE )) {float_raise (float_flag_invalid, status);if (float128_is_any_nan (a)) { -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; }else {return 0 ; } }if (aExp) { - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 ); } shiftCount =0x402F - aExp;if (shiftCount <=0 ) {if (0x403E < aExp) {float_raise (float_flag_invalid, status); -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; }shortShift128Left (aSig0, aSig1, -shiftCount, &aSig0, &aSig1); }else {
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 04/13] fpu: use min/max values from stdint.h for integral overflow
Quoted 8 lines · Alex Bennée
Remove some more use of LIT64 while making the meaning more clear. We also avoid the need of casts as the results by definition fit into the return type.
Signed-off-by Alex Bennée <[email protected]>--- fpu/softfloat.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
r~
Re: [Qemu-devel] [PATCH v3 04/13] fpu: use min/max values from stdint.h for integral overflow
In reply to Alex Bennée13.08.2019. 14.52, "Alex Bennée" <[email protected]> је написао/ла:
fpu/softfloat.c static int64_t roundAndPackInt64(flag zSign,
Quoted 15 lines
Remove some more use of LIT64 while making the meaning more clear. We also avoid the need of casts as the results by definition fit into the return type.
Signed-off-by Alex Bennée <[email protected]>--- fpu/softfloat.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)fpu/softfloat.c +0
-0@@ -3444,9 +3444,7 @@ static int64_t roundAndPackInt64(flag zSign,
uint64_t absZ0, uint64_t absZ1,
fpu/softfloat.c static int64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, · line 3448
Quoted 8 lines
fpu/softfloat.c +1
-3if ( z && ( ( z <0 ) ^ zSign ) ) { overflow:float_raise (float_flag_invalid, status); -return - zSign ? (int64_t )LIT64 (0x8000000000000000 ) - :LIT64 (0x7FFFFFFFFFFFFFFF ); +return zSign ?INT64_MIN :INT64_MAX ; }
In function roundAndPavkInt32 tgere is a following segment:
if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
float_raise(float_flag_invalid, status);
return zSign ? (int32_t) 0x80000000 : 0x7FFFFFFF;
}Perhaps replace these constants with INT32_MIN, INT32_MAX, for similar reasons, in the same or a separate patch?
Aleksandar
fpu/softfloat.c static int64_t roundAndPackUint64(flag zSign,
Quoted 3 lines
fpu/softfloat.c +0
-0if (absZ1) { status->float_exception_flags |= float_flag_inexact;@@ -3497,7 +3495,7 @@ static int64_t roundAndPackUint64(flag zSign,
uint64_t absZ0,
fpu/softfloat.c int64_t floatx80_to_int64(floatx80 a, float_status
Quoted 9 lines
fpu/softfloat.c +1
-1++absZ0;if (absZ0 ==0 ) {float_raise (float_flag_invalid, status); -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; } absZ0 &= ~(((uint64_t )(absZ1<<1 ) ==0 ) & roundNearestEven); }@@ -5518,9 +5516,9 @@ int64_t floatx80_to_int64(floatx80 a, float_status
*status)
fpu/softfloat.c int64_t floatx80_to_int64_round_to_zero(floatx80
Quoted 12 lines
fpu/softfloat.c +2
-2if ( shiftCount ) {float_raise (float_flag_invalid, status);if (!aSign ||floatx80_is_any_nan (a)) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; } aSigExtra =0 ; }@@ -5561,10 +5559,10 @@ int64_t floatx80_to_int64_round_to_zero(floatx80
a, float_status *status)
fpu/softfloat.c int32_t float128_to_int32_round_to_zero(float128 a,
Quoted 13 lines
fpu/softfloat.c +2
-2if ( ( a.high !=0xC03E ) || aSig ) {float_raise (float_flag_invalid, status);if ( ! aSign || ( ( aExp ==0x7FFF ) && aSig ) ) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; }else if ( aExp <0x3FFF ) {if (aExp | aSig) {@@ -6623,7 +6621,7 @@ int32_t float128_to_int32_round_to_zero(float128 a,
float_status *status)
fpu/softfloat.c int64_t float128_to_int64(float128 a, float_status
Quoted 9 lines
fpu/softfloat.c +1
-1if ( ( z <0 ) ^ aSign ) { invalid:float_raise (float_flag_invalid, status); -return aSign ? (int32_t )0x80000000 :0x7FFFFFFF ; +return aSign ?INT32_MIN :INT32_MAX ; }if ( ( aSig0<<shiftCount ) != savedASig ) { status->float_exception_flags |= float_flag_inexact;@@ -6662,9 +6660,9 @@ int64_t float128_to_int64(float128 a, float_status
*status)
fpu/softfloat.c int64_t float128_to_int64(float128 a, float_status · line 6660
Quoted 1 line
fpu/softfloat.c +0
-0&& ( aSig1 || ( aSig0 != LIT64( 0x0001000000000000
) ) )
fpu/softfloat.c int64_t float128_to_int64_round_to_zero(float128
Quoted 11 lines
fpu/softfloat.c +2
-2) ) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; }shortShift128Left ( aSig0, aSig1, - shiftCount, &aSig0, &aSig1 ); }@@ -6710,10 +6708,10 @@ int64_t float128_to_int64_round_to_zero(float128
a, float_status *status)
fpu/softfloat.c int64_t float128_to_int64_round_to_zero(float128 a, float_status *status)
Quoted 3 lines
fpu/softfloat.c +0
-0else {float_raise (float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0x7FFF ) && ( aSig0 | aSig1
) ) ) {
fpu/softfloat.c uint64_t float128_to_uint64(float128 a,
Quoted 10 lines
fpu/softfloat.c +2
-2-return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; } z = ( aSig0<<shiftCount ) | ( aSig1>>( ( - shiftCount ) &63 ) );if ( (uint64_t ) ( aSig1<<shiftCount ) ) {@@ -6764,19 +6762,19 @@ uint64_t float128_to_uint64(float128 a,
float_status *status)
Quoted 26 lines
fpu/softfloat.c +3
-4if (aSign && (aExp >0x3FFE )) {float_raise (float_flag_invalid, status);if (float128_is_any_nan (a)) { -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; }else {return 0 ; } }if (aExp) { - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 ); } shiftCount =0x402F - aExp;if (shiftCount <=0 ) {if (0x403E < aExp) {float_raise (float_flag_invalid, status); -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; }shortShift128Left (aSig0, aSig1, -shiftCount, &aSig0, &aSig1); }else { --2.20.1
Re: [Qemu-devel] [PATCH v3 04/13] fpu: use min/max values from stdint.h for integral overflow
Quoted 28 lines · Aleksandar Markovic
13.08.2019. 14.52, "Alex Bennée" <[email protected]> је написао/ла:
fpu/softfloat.c static int64_t roundAndPackInt64(flag zSign,
Quoted 15 lines
Remove some more use of LIT64 while making the meaning more clear. We also avoid the need of casts as the results by definition fit into the return type.
Signed-off-by Alex Bennée <[email protected]>--- fpu/softfloat.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)fpu/softfloat.c +0
-0@@ -3444,9 +3444,7 @@ static int64_t roundAndPackInt64(flag zSign,
uint64_tabsZ0,uint64_tabsZ1,fpu/softfloat.c static int64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, · line 3448
Quoted 8 lines
fpu/softfloat.c +1
-3if ( z && ( ( z <0 ) ^ zSign ) ) { overflow:float_raise (float_flag_invalid, status); -return - zSign ? (int64_t )LIT64 (0x8000000000000000 ) - :LIT64 (0x7FFFFFFFFFFFFFFF ); +return zSign ?INT64_MIN :INT64_MAX ; }In function roundAndPavkInt32 tgere is a following segment:
Quoted 7 lines
if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) { float_raise(float_flag_invalid, status); return zSign ? (int32_t) 0x80000000 : 0x7FFFFFFF; }Perhaps replace these constants with
INT32_MIN,INT32_MAX, for similar reasons, in the same or a separate patch?
Yeah that was missed seeing as I picked up one of the INT32 cases later on.
Quoted 73 lines
Aleksandar
fpu/softfloat.c static int64_t roundAndPackUint64(flag zSign,
Quoted 3 lines
fpu/softfloat.c +0
-0if (absZ1) { status->float_exception_flags |= float_flag_inexact;@@ -3497,7 +3495,7 @@ static int64_t roundAndPackUint64(flag zSign,
uint64_tabsZ0,fpu/softfloat.c int64_t floatx80_to_int64(floatx80 a, float_status
Quoted 9 lines
fpu/softfloat.c +1
-1++absZ0;if (absZ0 ==0 ) {float_raise (float_flag_invalid, status); -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; } absZ0 &= ~(((uint64_t )(absZ1<<1 ) ==0 ) & roundNearestEven); }@@ -5518,9 +5516,9 @@ int64_t floatx80_to_int64(floatx80 a, float_status*status)
fpu/softfloat.c int64_t floatx80_to_int64_round_to_zero(floatx80
Quoted 12 lines
fpu/softfloat.c +2
-2if ( shiftCount ) {float_raise (float_flag_invalid, status);if (!aSign ||floatx80_is_any_nan (a)) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; } aSigExtra =0 ; }@@ -5561,10 +5559,10 @@ int64_t floatx80_to_int64_round_to_zero(floatx80a,
float_status*status)fpu/softfloat.c int32_t float128_to_int32_round_to_zero(float128 a,
Quoted 13 lines
fpu/softfloat.c +2
-2if ( ( a.high !=0xC03E ) || aSig ) {float_raise (float_flag_invalid, status);if ( ! aSign || ( ( aExp ==0x7FFF ) && aSig ) ) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; }else if ( aExp <0x3FFF ) {if (aExp | aSig) {@@ -6623,7 +6621,7 @@ int32_t float128_to_int32_round_to_zero(float128 a,
float_status*status)fpu/softfloat.c int64_t float128_to_int64(float128 a, float_status
Quoted 9 lines
fpu/softfloat.c +1
-1if ( ( z <0 ) ^ aSign ) { invalid:float_raise (float_flag_invalid, status); -return aSign ? (int32_t )0x80000000 :0x7FFFFFFF ; +return aSign ?INT32_MIN :INT32_MAX ; }if ( ( aSig0<<shiftCount ) != savedASig ) { status->float_exception_flags |= float_flag_inexact;@@ -6662,9 +6660,9 @@ int64_t float128_to_int64(float128 a, float_status*status)
fpu/softfloat.c int64_t float128_to_int64(float128 a, float_status · line 6660
Quoted 1 line
fpu/softfloat.c +0
-0&& ( aSig1 || ( aSig0 != LIT64( 0x0001000000000000) ) )
fpu/softfloat.c int64_t float128_to_int64_round_to_zero(float128
Quoted 11 lines
fpu/softfloat.c +2
-2) ) { -return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; }shortShift128Left ( aSig0, aSig1, - shiftCount, &aSig0, &aSig1 ); }@@ -6710,10 +6708,10 @@ int64_t float128_to_int64_round_to_zero(float128a,
float_status*status)fpu/softfloat.c int64_t float128_to_int64_round_to_zero(float128 a, float_status *status)
Quoted 3 lines
fpu/softfloat.c +0
-0else {float_raise (float_flag_invalid, status); if ( ! aSign || ( ( aExp == 0x7FFF ) && ( aSig0 | aSig1) ) ) {
Quoted 37 lines
fpu/softfloat.c uint64_t float128_to_uint64(float128 a,
Quoted 10 lines
fpu/softfloat.c +2
-2-return LIT64 (0x7FFFFFFFFFFFFFFF ); +return INT64_MAX ; } } -return (int64_t )LIT64 (0x8000000000000000 ); +return INT64_MIN ; } z = ( aSig0<<shiftCount ) | ( aSig1>>( ( - shiftCount ) &63 ) );if ( (uint64_t ) ( aSig1<<shiftCount ) ) {@@ -6764,19 +6762,19 @@ uint64_t float128_to_uint64(float128 a,
float_status*status)Quoted 26 lines
fpu/softfloat.c +3
-4if (aSign && (aExp >0x3FFE )) {float_raise (float_flag_invalid, status);if (float128_is_any_nan (a)) { -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; }else {return 0 ; } }if (aExp) { - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 ); } shiftCount =0x402F - aExp;if (shiftCount <=0 ) {if (0x403E < aExp) {float_raise (float_flag_invalid, status); -return LIT64 (0xFFFFFFFFFFFFFFFF ); +return UINT64_MAX ; }shortShift128Left (aSig0, aSig1, -shiftCount, &aSig0, &aSig1); }else { --2.20.1
--
Alex Bennée
PATCH v3 5/13 fpu: replace LIT64 with UINT64_C macros
In reply to Alex BennéeIn our quest to eliminate the home rolled LIT64 macro we fixup usage inside the softfloat code. While we are at it we remove some of the extraneous spaces to closer fit the house style.
--- fpu/softfloat.c | 118 ++++++++++++++++----------------- include/fpu/softfloat-macros.h | 6 +- 2 files changed, 62 insertions(+), 62 deletions(-)
fpu/softfloat.c +59 -59
@@ -447,7 +447,7 @@ static inline flag extractFloat32Sign(float32 a)static inline uint64_t extractFloat64Frac (float64 a) { -return float64_val (a) &LIT64 (0x000FFFFFFFFFFFFF ); +return float64_val (a) &UINT64_C (0x000FFFFFFFFFFFFF ); }/*----------------------------------------------------------------------------
@@ -3251,7 +3251,7 @@ float128 float128_default_nan(float_status *status)*/ r.low = -(p.frac &1 ); r.high = p.frac >> (DECOMPOSED_BINARY_POINT -48 ); - r.high |=LIT64 (0x7FFF000000000000 ); + r.high |=UINT64_C (0x7FFF000000000000 ); r.high |= (uint64_t )p.sign <<63 ;return r;
@@ -3758,7 +3758,7 @@ static float64 roundAndPackFloat64(flag zSign, int zExp, uint64_t zSig, (status->float_detect_tininess == float_tininess_before_rounding) || ( zExp <-1 ) - || ( zSig + roundIncrement <LIT64 (0x8000000000000000 ) ); + || ( zSig + roundIncrement <UINT64_C (0x8000000000000000 ) );shift64RightJamming ( zSig, - zExp, &zSig ); zExp =0 ; roundBits = zSig &0x3FF ;
@@ -3858,12 +3858,12 @@ floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign, roundNearestEven = ( roundingMode == float_round_nearest_even );if ( roundingPrecision ==80 ) goto precision80;if ( roundingPrecision ==64 ) { - roundIncrement =LIT64 (0x0000000000000400 ); - roundMask =LIT64 (0x00000000000007FF ); + roundIncrement =UINT64_C (0x0000000000000400 ); + roundMask =UINT64_C (0x00000000000007FF ); }else if ( roundingPrecision ==32 ) { - roundIncrement =LIT64 (0x0000008000000000 ); - roundMask =LIT64 (0x000000FFFFFFFFFF ); + roundIncrement =UINT64_C (0x0000008000000000 ); + roundMask =UINT64_C (0x000000FFFFFFFFFF ); }else { goto precision80;
@@ -3927,7 +3927,7 @@ floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign, zSig0 += roundIncrement;if ( zSig0 < roundIncrement ) { ++zExp; - zSig0 =LIT64 (0x8000000000000000 ); + zSig0 =UINT64_C (0x8000000000000000 ); } roundIncrement = roundMask +1 ;if ( roundNearestEven && ( roundBits<<1 == roundIncrement ) ) {
@@ -3957,7 +3957,7 @@ floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign,if (0x7FFD <= (uint32_t ) ( zExp -1 ) ) {if ( (0x7FFE < zExp ) || ( ( zExp ==0x7FFE ) - && ( zSig0 ==LIT64 (0xFFFFFFFFFFFFFFFF ) ) + && ( zSig0 ==UINT64_C (0xFFFFFFFFFFFFFFFF ) ) && increment ) ) {
@@ -3980,7 +3980,7 @@ floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign, == float_tininess_before_rounding) || ( zExp <0 ) || ! increment - || ( zSig0 <LIT64 (0xFFFFFFFFFFFFFFFF ) ); + || ( zSig0 <UINT64_C (0xFFFFFFFFFFFFFFFF ) );shift64ExtraRightJamming ( zSig0, zSig1,1 - zExp, &zSig0, &zSig1 ); zExp =0 ;if (isTiny && zSig1) {
@@ -4022,7 +4022,7 @@ floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign, ++zSig0;if ( zSig0 ==0 ) { ++zExp; - zSig0 =LIT64 (0x8000000000000000 ); + zSig0 =UINT64_C (0x8000000000000000 ); }else { zSig0 &= ~ ( ( (uint64_t ) ( zSig1<<1 ) ==0 ) & roundNearestEven );
@@ -4084,7 +4084,7 @@ static inline uint64_t extractFloat128Frac1( float128 a )static inline uint64_t extractFloat128Frac0 (float128 a ) { -return a.high &LIT64 (0x0000FFFFFFFFFFFF ); +return a.high &UINT64_C (0x0000FFFFFFFFFFFF ); }
@@ -4230,8 +4230,8 @@ static float128 roundAndPackFloat128(flag zSign, int32_t zExp, if ( ( 0x7FFD < zExp ) || ( ( zExp == 0x7FFD ) && eq128( - LIT64( 0x0001FFFFFFFFFFFF ), - LIT64( 0xFFFFFFFFFFFFFFFF ), + UINT64_C(0x0001FFFFFFFFFFFF), + UINT64_C(0xFFFFFFFFFFFFFFFF), zSig0, zSig1 )
@@ -4248,8 +4248,8 @@ static float128 roundAndPackFloat128(flag zSign, int32_t zExp,packFloat128 ( zSign,0x7FFE , -LIT64 (0x0000FFFFFFFFFFFF ), -LIT64 (0xFFFFFFFFFFFFFFFF ) +UINT64_C (0x0000FFFFFFFFFFFF ), +UINT64_C (0xFFFFFFFFFFFFFFFF ) ); }return packFloat128 ( zSign,0x7FFF ,0 ,0 );
@@ -4267,8 +4267,8 @@ static float128 roundAndPackFloat128(flag zSign, int32_t zExp, || lt128( zSig0, zSig1, -LIT64 (0x0001FFFFFFFFFFFF ), -LIT64 (0xFFFFFFFFFFFFFFFF ) +UINT64_C (0x0001FFFFFFFFFFFF ), +UINT64_C (0xFFFFFFFFFFFFFFFF ) );shift128ExtraRightJamming ( zSig0, zSig1, zSig2, - zExp, &zSig0, &zSig1, &zSig2 );
@@ -5011,7 +5011,7 @@ floatx80 float64_to_floatx80(float64 a, float_status *status) }return packFloatx80 ( - aSign, aExp +0x3C00 , ( aSig |LIT64 (0x0010000000000000 ) )<<11 ); + aSign, aExp +0x3C00 , (aSig |UINT64_C (0x0010000000000000 )) <<11 ); }
@@ -5095,8 +5095,8 @@ float64 float64_rem(float64 a, float64 b, float_status *status)normalizeFloat64Subnormal ( aSig, &aExp, &aSig ); } expDiff = aExp - bExp; - aSig = ( aSig |LIT64 (0x0010000000000000 ) )<<11 ; - bSig = ( bSig |LIT64 (0x0010000000000000 ) )<<11 ; + aSig = (aSig |UINT64_C (0x0010000000000000 )) <<11 ; + bSig = (bSig |UINT64_C (0x0010000000000000 )) <<11 ;if ( expDiff <0 ) {if ( expDiff <-1 )return a; aSig >>=1 ;
@@ -5169,13 +5169,13 @@ float64 float64_log2(float64 a, float_status *status) } aExp -=0x3FF ; - aSig |=LIT64 (0x0010000000000000 ); + aSig |=UINT64_C (0x0010000000000000 ); zSign = aExp <0 ; zSig = (uint64_t )aExp <<52 ;for (i =1LL <<51 ; i >0 ; i >>=1 ) {mul64To128 ( aSig, aSig, &aSig0, &aSig1 ); aSig = ( aSig0 <<12 ) | ( aSig1 >>52 ); -if ( aSig &LIT64 (0x0020000000000000 ) ) { +if ( aSig &UINT64_C (0x0020000000000000 ) ) { aSig >>=1 ; zSig |= i; }
@@ -5555,7 +5555,7 @@ int64_t floatx80_to_int64_round_to_zero(floatx80 a, float_status *status) aSign =extractFloatx80Sign ( a ); shiftCount = aExp -0x403E ;if (0 <= shiftCount ) { - aSig &=LIT64 (0x7FFFFFFFFFFFFFFF ); + aSig &=UINT64_C (0x7FFFFFFFFFFFFFFF );if ( ( a.high !=0xC03E ) || aSig ) {float_raise (float_flag_invalid, status);if ( ! aSign || ( ( aExp ==0x7FFF ) && aSig ) ) {
@@ -5724,23 +5724,23 @@ floatx80 floatx80_round_to_int(floatx80 a, float_status *status)if ( ( aExp ==0x3FFE ) && (uint64_t ) (extractFloatx80Frac ( a )<<1 ) ) {return -packFloatx80 ( aSign,0x3FFF ,LIT64 (0x8000000000000000 ) ); +packFloatx80 ( aSign,0x3FFF ,UINT64_C (0x8000000000000000 )); }break ;case float_round_ties_away:if (aExp ==0x3FFE ) { -return packFloatx80 (aSign,0x3FFF ,LIT64 (0x8000000000000000 )); +return packFloatx80 (aSign,0x3FFF ,UINT64_C (0x8000000000000000 )); }break ;case float_round_down:return aSign ? -packFloatx80 (1 ,0x3FFF ,LIT64 (0x8000000000000000 ) ) +packFloatx80 (1 ,0x3FFF ,UINT64_C (0x8000000000000000 )) :packFloatx80 (0 ,0 ,0 );case float_round_up:return aSign ?packFloatx80 (1 ,0 ,0 ) - :packFloatx80 (0 ,0x3FFF ,LIT64 (0x8000000000000000 ) ); + :packFloatx80 (0 ,0x3FFF ,UINT64_C (0x8000000000000000 )); }return packFloatx80 ( aSign,0 ,0 ); }
@@ -5776,7 +5776,7 @@ floatx80 floatx80_round_to_int(floatx80 a, float_status *status) z.low &= ~ roundBitsMask;if ( z.low ==0 ) { ++z.high; - z.low =LIT64 (0x8000000000000000 ); + z.low =UINT64_C (0x8000000000000000 ); }if (z.low != a.low) { status->float_exception_flags |= float_flag_inexact;
@@ -5849,7 +5849,7 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign,if ( (int64_t ) zSig0 <0 ) goto roundAndPack; shiftRight1:shift64ExtraRightJamming ( zSig0, zSig1,1 , &zSig0, &zSig1 ); - zSig0 |=LIT64 (0x8000000000000000 ); + zSig0 |=UINT64_C (0x8000000000000000 ); ++zExp; roundAndPack: return roundAndPackFloatx80(status->floatx80_rounding_precision,
@@ -6171,7 +6171,7 @@ floatx80 floatx80_rem(floatx80 a, floatx80 b, float_status *status)if ( (uint64_t ) ( aSig0<<1 ) ==0 )return a;normalizeFloatx80Subnormal ( aSig0, &aExp, &aSig0 ); } - bSig |=LIT64 (0x8000000000000000 ); + bSig |=UINT64_C (0x8000000000000000 ); zSign = aSign; expDiff = aExp - bExp; aSig1 =0 ;
@@ -6273,7 +6273,7 @@ floatx80 floatx80_sqrt(floatx80 a, float_status *status)add128 ( rem0, rem1, zSig0>>63 , doubleZSig0 |1 , &rem0, &rem1 ); } zSig1 =estimateDiv128To64 ( rem1,0 , doubleZSig0 ); -if ( ( zSig1 &LIT64 (0x3FFFFFFFFFFFFFFF ) ) <=5 ) { +if ( ( zSig1 &UINT64_C (0x3FFFFFFFFFFFFFFF ) ) <=5 ) {if ( zSig1 ==0 ) zSig1 =1 ;mul64To128 ( doubleZSig0, zSig1, &term1, &term2 );sub128 ( rem1,0 , term1, term2, &rem1, &rem2 );
@@ -6572,7 +6572,7 @@ int32_t float128_to_int32(float128 a, float_status *status) aExp =extractFloat128Exp ( a ); aSign =extractFloat128Sign ( a );if ( ( aExp ==0x7FFF ) && ( aSig0 | aSig1 ) ) aSign =0 ; -if ( aExp ) aSig0 |=LIT64 (0x0001000000000000 ); +if ( aExp ) aSig0 |=UINT64_C (0x0001000000000000 ); aSig0 |= ( aSig1 !=0 ); shiftCount =0x4028 - aExp;if (0 < shiftCount )shift64RightJamming ( aSig0, shiftCount, &aSig0 );
@@ -6612,7 +6612,7 @@ int32_t float128_to_int32_round_to_zero(float128 a, float_status *status) }return 0 ; } - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 ); shiftCount =0x402F - aExp; savedASig = aSig0; aSig0 >>= shiftCount;
@@ -6650,14 +6650,14 @@ int64_t float128_to_int64(float128 a, float_status *status) aSig0 =extractFloat128Frac0 ( a ); aExp =extractFloat128Exp ( a ); aSign =extractFloat128Sign ( a ); -if ( aExp ) aSig0 |=LIT64 (0x0001000000000000 ); +if ( aExp ) aSig0 |=UINT64_C (0x0001000000000000 ); shiftCount =0x402F - aExp;if ( shiftCount <=0 ) {if (0x403E < aExp ) {float_raise (float_flag_invalid, status);if ( ! aSign || ( ( aExp ==0x7FFF ) - && ( aSig1 || ( aSig0 !=LIT64 (0x0001000000000000 ) ) ) + && ( aSig1 || ( aSig0 !=UINT64_C (0x0001000000000000 ) ) ) ) ) {return INT64_MAX ;
@@ -6694,13 +6694,13 @@ int64_t float128_to_int64_round_to_zero(float128 a, float_status *status) aSig0 =extractFloat128Frac0 ( a ); aExp =extractFloat128Exp ( a ); aSign =extractFloat128Sign ( a ); -if ( aExp ) aSig0 |=LIT64 (0x0001000000000000 ); +if ( aExp ) aSig0 |=UINT64_C (0x0001000000000000 ); shiftCount = aExp -0x402F ;if (0 < shiftCount ) {if (0x403E <= aExp ) { - aSig0 &=LIT64 (0x0000FFFFFFFFFFFF ); -if ( ( a.high ==LIT64 (0xC03E000000000000 ) ) - && ( aSig1 <LIT64 (0x0002000000000000 ) ) ) { + aSig0 &=UINT64_C (0x0000FFFFFFFFFFFF ); +if ( ( a.high ==UINT64_C (0xC03E000000000000 ) ) + && ( aSig1 <UINT64_C (0x0002000000000000 ) ) ) {if (aSig1) { status->float_exception_flags |= float_flag_inexact; }
@@ -6913,7 +6913,7 @@ float64 float128_to_float64(float128 a, float_status *status)shortShift128Left ( aSig0, aSig1,14 , &aSig0, &aSig1 ); aSig0 |= ( aSig1 !=0 );if ( aExp || aSig0 ) { - aSig0 |=LIT64 (0x4000000000000000 ); + aSig0 |=UINT64_C (0x4000000000000000 ); aExp -=0x3C01 ; }return roundAndPackFloat64 (aSign, aExp, aSig0, status);
@@ -6949,7 +6949,7 @@ floatx80 float128_to_floatx80(float128 a, float_status *status)normalizeFloat128Subnormal ( aSig0, aSig1, &aExp, &aSig0, &aSig1 ); }else { - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 ); }shortShift128Left ( aSig0, aSig1,15 , &aSig0, &aSig1 );return roundAndPackFloatx80 (80 , aSign, aExp, aSig0, aSig1, status);
@@ -7145,7 +7145,7 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign, --expDiff; }else { - bSig0 |=LIT64 (0x0001000000000000 ); + bSig0 |=UINT64_C (0x0001000000000000 ); }shift128ExtraRightJamming ( bSig0, bSig1,0 , expDiff, &bSig0, &bSig1, &zSig2 );
@@ -7162,7 +7162,7 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign, ++expDiff; }else { - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 ); }shift128ExtraRightJamming ( aSig0, aSig1,0 , - expDiff, &aSig0, &aSig1, &zSig2 );
@@ -7186,14 +7186,14 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign,return packFloat128 ( zSign,0 , zSig0, zSig1 ); } zSig2 =0 ; - zSig0 |=LIT64 (0x0002000000000000 ); + zSig0 |=UINT64_C (0x0002000000000000 ); zExp = aExp; goto shiftRight1; } - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 );add128 ( aSig0, aSig1, bSig0, bSig1, &zSig0, &zSig1 ); --zExp; -if ( zSig0 <LIT64 (0x0002000000000000 ) ) goto roundAndPack; +if ( zSig0 <UINT64_C (0x0002000000000000 ) ) goto roundAndPack; ++zExp; shiftRight1: shift128ExtraRightJamming(
@@ -7257,10 +7257,10 @@ static float128 subFloat128Sigs(float128 a, float128 b, flag zSign, ++expDiff; }else { - aSig0 |=LIT64 (0x4000000000000000 ); + aSig0 |=UINT64_C (0x4000000000000000 ); }shift128RightJamming ( aSig0, aSig1, - expDiff, &aSig0, &aSig1 ); - bSig0 |=LIT64 (0x4000000000000000 ); + bSig0 |=UINT64_C (0x4000000000000000 ); bBigger:sub128 ( bSig0, bSig1, aSig0, aSig1, &zSig0, &zSig1 ); zExp = bExp;
@@ -7277,10 +7277,10 @@ static float128 subFloat128Sigs(float128 a, float128 b, flag zSign, --expDiff; }else { - bSig0 |=LIT64 (0x4000000000000000 ); + bSig0 |=UINT64_C (0x4000000000000000 ); }shift128RightJamming ( bSig0, bSig1, expDiff, &bSig0, &bSig1 ); - aSig0 |=LIT64 (0x4000000000000000 ); + aSig0 |=UINT64_C (0x4000000000000000 ); aBigger:sub128 ( aSig0, aSig1, bSig0, bSig1, &zSig0, &zSig1 ); zExp = aExp;
@@ -7382,12 +7382,12 @@ float128 float128_mul(float128 a, float128 b, float_status *status)normalizeFloat128Subnormal ( bSig0, bSig1, &bExp, &bSig0, &bSig1 ); } zExp = aExp + bExp -0x4000 ; - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 );shortShift128Left ( bSig0, bSig1,16 , &bSig0, &bSig1 );mul128To256 ( aSig0, aSig1, bSig0, bSig1, &zSig0, &zSig1, &zSig2, &zSig3 );add128 ( zSig0, zSig1, aSig0, aSig1, &zSig0, &zSig1 ); zSig2 |= ( zSig3 !=0 ); -if (LIT64 (0x0002000000000000 ) <= zSig0 ) { +if (UINT64_C (0x0002000000000000 ) <= zSig0 ) {shift128ExtraRightJamming ( zSig0, zSig1, zSig2,1 , &zSig0, &zSig1, &zSig2 ); ++zExp;
@@ -7454,9 +7454,9 @@ float128 float128_div(float128 a, float128 b, float_status *status) } zExp = aExp - bExp +0x3FFD ;shortShift128Left ( - aSig0 |LIT64 (0x0001000000000000 ), aSig1,15 , &aSig0, &aSig1 ); + aSig0 |UINT64_C (0x0001000000000000 ), aSig1,15 , &aSig0, &aSig1 );shortShift128Left ( - bSig0 |LIT64 (0x0001000000000000 ), bSig1,15 , &bSig0, &bSig1 ); + bSig0 |UINT64_C (0x0001000000000000 ), bSig1,15 , &bSig0, &bSig1 );if (le128 ( bSig0, bSig1, aSig0, aSig1 ) ) {shift128Right ( aSig0, aSig1,1 , &aSig0, &aSig1 ); ++zExp;
@@ -7532,14 +7532,14 @@ float128 float128_rem(float128 a, float128 b, float_status *status) expDiff = aExp - bExp;if ( expDiff <-1 )return a;shortShift128Left ( - aSig0 |LIT64 (0x0001000000000000 ), + aSig0 |UINT64_C (0x0001000000000000 ), aSig1,15 - ( expDiff <0 ), &aSig0, &aSig1 );shortShift128Left ( - bSig0 |LIT64 (0x0001000000000000 ), bSig1,15 , &bSig0, &bSig1 ); + bSig0 |UINT64_C (0x0001000000000000 ), bSig1,15 , &bSig0, &bSig1 ); q =le128 ( bSig0, bSig1, aSig0, aSig1 );if ( q )sub128 ( aSig0, aSig1, bSig0, bSig1, &aSig0, &aSig1 ); expDiff -=64 ;
@@ -7625,7 +7625,7 @@ float128 float128_sqrt(float128 a, float_status *status)normalizeFloat128Subnormal ( aSig0, aSig1, &aExp, &aSig0, &aSig1 ); } zExp = ( ( aExp -0x3FFF )>>1 ) +0x3FFE ; - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 ); zSig0 =estimateSqrt32 ( aExp, aSig0>>17 );shortShift128Left ( aSig0, aSig1,13 - ( aExp &1 ), &aSig0, &aSig1 ); zSig0 =estimateDiv128To64 ( aSig0, aSig1, zSig0<<32 ) + ( zSig0<<30 );
@@ -8046,7 +8046,7 @@ float128 float128_scalbn(float128 a, int n, float_status *status)return a; }if (aExp !=0 ) { - aSig0 |=LIT64 (0x0001000000000000 ); + aSig0 |=UINT64_C (0x0001000000000000 ); }else if (aSig0 ==0 && aSig1 ==0 ) {return a; }else {
include/fpu/softfloat-macros.h +3 -3
@@ -616,13 +616,13 @@ static inline uint64_t estimateDiv128To64(uint64_t a0, uint64_t a1, uint64_t b)uint64_t rem0, rem1, term0, term1;uint64_t z; -if ( b <= a0 )return LIT64 (0xFFFFFFFFFFFFFFFF ); +if ( b <= a0 )return UINT64_C (0xFFFFFFFFFFFFFFFF ); b0 = b>>32 ; - z = ( b0<<32 <= a0 ) ?LIT64 (0xFFFFFFFF00000000 ) : ( a0 / b0 )<<32 ; + z = ( b0<<32 <= a0 ) ?UINT64_C (0xFFFFFFFF00000000 ) : ( a0 / b0 )<<32 ;mul64To128 ( b, z, &term0, &term1 );sub128 ( a0, a1, term0, term1, &rem0, &rem1 );while ( ( (int64_t ) rem0 ) <0 ) { - z -=LIT64 (0x100000000 ); + z -=UINT64_C (0x100000000 ); b1 = b<<32 ;add128 ( rem0, rem1, b0, b1, &rem0, &rem1 ); }
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 05/13] fpu: replace LIT64 with UINT64_C macros
Quoted 9 lines · Alex Bennée
In our quest to eliminate the home rolled LIT64 macro we fixup usage inside the softfloat code. While we are at it we remove some of the extraneous spaces to closer fit the house style.
Signed-off-by Alex Bennée <[email protected]>--- fpu/softfloat.c | 118 ++++++++++++++++----------------- include/fpu/softfloat-macros.h | 6 +- 2 files changed, 62 insertions(+), 62 deletions(-)
r~
PATCH v3 6/13 target/m68k: replace LIT64 with UINT64_C macros
In reply to Alex BennéeIn our quest to eliminate the home rolled LIT64 macro we fixup usage inside for m68k's many constants.
--- target/m68k/softfloat.c | 98 ++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 49 deletions(-)
target/m68k/softfloat.c +49 -49
@@ -26,7 +26,7 @@#define pi_exp 0x4000#define piby2_exp 0x3FFF -#define pi_sig LIT64(0xc90fdaa22168c235) +#define pi_sig UINT64_C(0xc90fdaa22168c235)static floatx80 propagateFloatx80NaNOneArg (floatx80 a,float_status *status) {
@@ -87,7 +87,7 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status) }normalizeFloatx80Subnormal (aSig0, &aExp, &aSig0); } - bSig |=LIT64 (0x8000000000000000 ); + bSig |=UINT64_C (0x8000000000000000 ); zSign = aSign; expDiff = aExp - bExp; aSig1 =0 ;
@@ -289,7 +289,7 @@ floatx80 floatx80_move(floatx80 a, float_status *status)*/ #define one_exp 0x3FFF -#define one_sig LIT64(0x8000000000000000) +#define one_sig UINT64_C(0x8000000000000000)/* * Function for compactifying extended double-precision floating point values.
@@ -373,7 +373,7 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status) k = aExp -0x3FFF ; fp1 =int32_to_floatx80 (k, status); - fSig = (aSig &LIT64 (0xFE00000000000000 )) |LIT64 (0x0100000000000000 ); + fSig = (aSig &UINT64_C (0xFE00000000000000 )) |UINT64_C (0x0100000000000000 ); j = (fSig >>56 ) &0x7E ;/* DISPLACEMENT FOR 1/F */ f =packFloatx80 (0 ,0x3FFF , fSig);/* F */
@@ -384,7 +384,7 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status) lp1cont1:/* LP1CONT1 */ fp0 =floatx80_mul (fp0, log_tbl[j], status);/* FP0 IS U = (Y-F)/F */ - logof2 =packFloatx80 (0 ,0x3FFE ,LIT64 (0xB17217F7D1CF79AC )); + logof2 =packFloatx80 (0 ,0x3FFE ,UINT64_C (0xB17217F7D1CF79AC )); klog2 =floatx80_mul (fp1, logof2, status);/* FP1 IS K*LOG2 */ fp2 =floatx80_mul (fp0, fp0, status);/* FP2 IS V=U*U */
@@ -431,7 +431,7 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status) }else if (compact <0x3FFEF07D || compact >0x3FFF8841 ) {/* |X| < 1/16 or |X| > -1/16 */ /* LP1CARE */ - fSig = (aSig &LIT64 (0xFE00000000000000 )) |LIT64 (0x0100000000000000 ); + fSig = (aSig &UINT64_C (0xFE00000000000000 )) |UINT64_C (0x0100000000000000 ); f =packFloatx80 (0 ,0x3FFF , fSig);/* F */ j = (fSig >>56 ) &0x7E ;/* DISPLACEMENT FOR 1/F */
@@ -562,7 +562,7 @@ floatx80 floatx80_logn(floatx80 a, float_status *status) k += adjk; fp1 =int32_to_floatx80 (k, status); - fSig = (aSig &LIT64 (0xFE00000000000000 )) |LIT64 (0x0100000000000000 ); + fSig = (aSig &UINT64_C (0xFE00000000000000 )) |UINT64_C (0x0100000000000000 ); j = (fSig >>56 ) &0x7E ;/* DISPLACEMENT FOR 1/F */ f =packFloatx80 (0 ,0x3FFF , fSig);/* F */
@@ -572,7 +572,7 @@ floatx80 floatx80_logn(floatx80 a, float_status *status)/* LP1CONT1 */ fp0 =floatx80_mul (fp0, log_tbl[j], status);/* FP0 IS U = (Y-F)/F */ - logof2 =packFloatx80 (0 ,0x3FFE ,LIT64 (0xB17217F7D1CF79AC )); + logof2 =packFloatx80 (0 ,0x3FFE ,UINT64_C (0xB17217F7D1CF79AC )); klog2 =floatx80_mul (fp1, logof2, status);/* FP1 IS K*LOG2 */ fp2 =floatx80_mul (fp0, fp0, status);/* FP2 IS V=U*U */
@@ -712,7 +712,7 @@ floatx80 floatx80_log10(floatx80 a, float_status *status) status->floatx80_rounding_precision =80 ; fp0 =floatx80_logn (a, status); - fp1 =packFloatx80 (0 ,0x3FFD ,LIT64 (0xDE5BD8A937287195 ));/* INV_L10 */ + fp1 =packFloatx80 (0 ,0x3FFD ,UINT64_C (0xDE5BD8A937287195 ));/* INV_L10 */ status->float_rounding_mode = user_rnd_mode; status->floatx80_rounding_precision = user_rnd_prec;
@@ -778,7 +778,7 @@ floatx80 floatx80_log2(floatx80 a, float_status *status) a =int32_to_floatx80 (aExp -0x3FFF , status); }else { fp0 =floatx80_logn (a, status); - fp1 =packFloatx80 (0 ,0x3FFF ,LIT64 (0xB8AA3B295C17F0BC ));/* INV_L2 */ + fp1 =packFloatx80 (0 ,0x3FFF ,UINT64_C (0xB8AA3B295C17F0BC ));/* INV_L2 */ status->float_rounding_mode = user_rnd_mode; status->floatx80_rounding_precision = user_rnd_prec;
@@ -862,7 +862,7 @@ floatx80 floatx80_etox(floatx80 a, float_status *status) fp0 =floatx80_mul (fp0,float32_to_floatx80 (make_float32 (0xBC317218 ), status), status);/* N * L1, L1 = lead(-log2/64) */ - l2 =packFloatx80 (0 ,0x3FDC ,LIT64 (0x82E308654361C4C6 )); + l2 =packFloatx80 (0 ,0x3FDC ,UINT64_C (0x82E308654361C4C6 )); fp2 =floatx80_mul (fp2, l2, status);/* N * L2, L1+L2 = -log2/64 */ fp0 =floatx80_add (fp0, fp1, status);/* X + N*L1 */ fp0 =floatx80_add (fp0, fp2, status);/* R */
@@ -1082,7 +1082,7 @@ floatx80 floatx80_twotox(floatx80 a, float_status *status) make_float32(0x3C800000), status), status); /* (1/64)*N */ fp0 =floatx80_sub (fp0, fp1, status);/* X - (1/64)*INT(64 X) */ - fp2 =packFloatx80 (0 ,0x3FFE ,LIT64 (0xB17217F7D1CF79AC ));/* LOG2 */ + fp2 =packFloatx80 (0 ,0x3FFE ,UINT64_C (0xB17217F7D1CF79AC ));/* LOG2 */ fp0 =floatx80_mul (fp0, fp2, status);/* R */ /* EXPR */
@@ -1233,11 +1233,11 @@ floatx80 floatx80_tentox(floatx80 a, float_status *status) fp1 =floatx80_mul (fp1,float64_to_floatx80 (make_float64 (0x3F734413509F8000 ), status), status);/* N*(LOG2/64LOG10)_LEAD */ - fp3 =packFloatx80 (1 ,0x3FCD ,LIT64 (0xC0219DC1DA994FD2 )); + fp3 =packFloatx80 (1 ,0x3FCD ,UINT64_C (0xC0219DC1DA994FD2 )); fp2 =floatx80_mul (fp2, fp3, status);/* N*(LOG2/64LOG10)_TRAIL */ fp0 =floatx80_sub (fp0, fp1, status);/* X - N L_LEAD */ fp0 =floatx80_sub (fp0, fp2, status);/* X - N L_TRAIL */ - fp2 =packFloatx80 (0 ,0x4000 ,LIT64 (0x935D8DDDAAA8AC17 ));/* LOG10 */ + fp2 =packFloatx80 (0 ,0x4000 ,UINT64_C (0x935D8DDDAAA8AC17 ));/* LOG10 */ fp0 =floatx80_mul (fp0, fp2, status);/* R */ /* EXPR */
@@ -1329,9 +1329,9 @@ floatx80 floatx80_tan(floatx80 a, float_status *status) fp1 =packFloatx80 (0 ,0 ,0 );if (compact ==0x7FFEFFFF ) { twopi1 =packFloatx80 (aSign ^1 ,0x7FFE , -LIT64 (0xC90FDAA200000000 )); +UINT64_C (0xC90FDAA200000000 )); twopi2 =packFloatx80 (aSign ^1 ,0x7FDC , -LIT64 (0x85A308D300000000 )); +UINT64_C (0x85A308D300000000 )); fp0 =floatx80_add (fp0, twopi1, status); fp1 = fp0; fp0 =floatx80_add (fp0, twopi2, status);
@@ -1350,9 +1350,9 @@ floatx80 floatx80_tan(floatx80 a, float_status *status) endflag =0 ; } invtwopi =packFloatx80 (0 ,0x3FFE - l, -LIT64 (0xA2F9836E4E44152A ));/* INVTWOPI */ - twopi1 =packFloatx80 (0 ,0x3FFF + l,LIT64 (0xC90FDAA200000000 )); - twopi2 =packFloatx80 (0 ,0x3FDD + l,LIT64 (0x85A308D300000000 )); +UINT64_C (0xA2F9836E4E44152A ));/* INVTWOPI */ + twopi1 =packFloatx80 (0 ,0x3FFF + l,UINT64_C (0xC90FDAA200000000 )); + twopi2 =packFloatx80 (0 ,0x3FDD + l,UINT64_C (0x85A308D300000000 ));/* SIGN(INARG)*2^63 IN SGL */ twoto63 =packFloat32 (xSign,0xBE ,0 );
@@ -1415,17 +1415,17 @@ floatx80 floatx80_tan(floatx80 a, float_status *status) fp3 =floatx80_add (fp3,float64_to_floatx80 (make_float64 (0xBF346F59B39BA65F ), status), status);/* Q3+SQ4 */ - fp4 =packFloatx80 (0 ,0x3FF6 ,LIT64 (0xE073D3FC199C4A00 )); + fp4 =packFloatx80 (0 ,0x3FF6 ,UINT64_C (0xE073D3FC199C4A00 )); fp2 =floatx80_add (fp2, fp4, status);/* P2+SP3 */ fp3 =floatx80_mul (fp3, fp0, status);/* S(Q3+SQ4) */ fp2 =floatx80_mul (fp2, fp0, status);/* S(P2+SP3) */ - fp4 =packFloatx80 (0 ,0x3FF9 ,LIT64 (0xD23CD68415D95FA1 )); + fp4 =packFloatx80 (0 ,0x3FF9 ,UINT64_C (0xD23CD68415D95FA1 )); fp3 =floatx80_add (fp3, fp4, status);/* Q2+S(Q3+SQ4) */ - fp4 =packFloatx80 (1 ,0x3FFC ,LIT64 (0x8895A6C5FB423BCA )); + fp4 =packFloatx80 (1 ,0x3FFC ,UINT64_C (0x8895A6C5FB423BCA )); fp2 =floatx80_add (fp2, fp4, status);/* P1+S(P2+SP3) */ fp3 =floatx80_mul (fp3, fp0, status);/* S(Q2+S(Q3+SQ4)) */ fp2 =floatx80_mul (fp2, fp0, status);/* S(P1+S(P2+SP3)) */ - fp4 =packFloatx80 (1 ,0x3FFD ,LIT64 (0xEEF57E0DA84BC8CE )); + fp4 =packFloatx80 (1 ,0x3FFD ,UINT64_C (0xEEF57E0DA84BC8CE )); fp3 =floatx80_add (fp3, fp4, status);/* Q1+S(Q2+S(Q3+SQ4)) */ fp2 =floatx80_mul (fp2, fp1, status);/* RS(P1+S(P2+SP3)) */ fp0 =floatx80_mul (fp0, fp3, status);/* S(Q1+S(Q2+S(Q3+SQ4))) */
@@ -1459,17 +1459,17 @@ floatx80 floatx80_tan(floatx80 a, float_status *status) fp3 =floatx80_add (fp3,float64_to_floatx80 (make_float64 (0xBF346F59B39BA65F ), status), status);/* Q3+SQ4 */ - fp4 =packFloatx80 (0 ,0x3FF6 ,LIT64 (0xE073D3FC199C4A00 )); + fp4 =packFloatx80 (0 ,0x3FF6 ,UINT64_C (0xE073D3FC199C4A00 )); fp2 =floatx80_add (fp2, fp4, status);/* P2+SP3 */ fp3 =floatx80_mul (fp3, fp1, status);/* S(Q3+SQ4) */ fp2 =floatx80_mul (fp2, fp1, status);/* S(P2+SP3) */ - fp4 =packFloatx80 (0 ,0x3FF9 ,LIT64 (0xD23CD68415D95FA1 )); + fp4 =packFloatx80 (0 ,0x3FF9 ,UINT64_C (0xD23CD68415D95FA1 )); fp3 =floatx80_add (fp3, fp4, status);/* Q2+S(Q3+SQ4) */ - fp4 =packFloatx80 (1 ,0x3FFC ,LIT64 (0x8895A6C5FB423BCA )); + fp4 =packFloatx80 (1 ,0x3FFC ,UINT64_C (0x8895A6C5FB423BCA )); fp2 =floatx80_add (fp2, fp4, status);/* P1+S(P2+SP3) */ fp3 =floatx80_mul (fp3, fp1, status);/* S(Q2+S(Q3+SQ4)) */ fp2 =floatx80_mul (fp2, fp1, status);/* S(P1+S(P2+SP3)) */ - fp4 =packFloatx80 (1 ,0x3FFD ,LIT64 (0xEEF57E0DA84BC8CE )); + fp4 =packFloatx80 (1 ,0x3FFD ,UINT64_C (0xEEF57E0DA84BC8CE )); fp3 =floatx80_add (fp3, fp4, status);/* Q1+S(Q2+S(Q3+SQ4)) */ fp2 =floatx80_mul (fp2, fp0, status);/* RS(P1+S(P2+SP3)) */ fp1 =floatx80_mul (fp1, fp3, status);/* S(Q1+S(Q2+S(Q3+SQ4))) */
@@ -1539,9 +1539,9 @@ floatx80 floatx80_sin(floatx80 a, float_status *status) fp1 =packFloatx80 (0 ,0 ,0 );if (compact ==0x7FFEFFFF ) { twopi1 =packFloatx80 (aSign ^1 ,0x7FFE , -LIT64 (0xC90FDAA200000000 )); +UINT64_C (0xC90FDAA200000000 )); twopi2 =packFloatx80 (aSign ^1 ,0x7FDC , -LIT64 (0x85A308D300000000 )); +UINT64_C (0x85A308D300000000 )); fp0 =floatx80_add (fp0, twopi1, status); fp1 = fp0; fp0 =floatx80_add (fp0, twopi2, status);
@@ -1560,9 +1560,9 @@ floatx80 floatx80_sin(floatx80 a, float_status *status) endflag =0 ; } invtwopi =packFloatx80 (0 ,0x3FFE - l, -LIT64 (0xA2F9836E4E44152A ));/* INVTWOPI */ - twopi1 =packFloatx80 (0 ,0x3FFF + l,LIT64 (0xC90FDAA200000000 )); - twopi2 =packFloatx80 (0 ,0x3FDD + l,LIT64 (0x85A308D300000000 )); +UINT64_C (0xA2F9836E4E44152A ));/* INVTWOPI */ + twopi1 =packFloatx80 (0 ,0x3FFF + l,UINT64_C (0xC90FDAA200000000 )); + twopi2 =packFloatx80 (0 ,0x3FDD + l,UINT64_C (0x85A308D300000000 ));/* SIGN(INARG)*2^63 IN SGL */ twoto63 =packFloat32 (xSign,0xBE ,0 );
@@ -1650,11 +1650,11 @@ floatx80 floatx80_sin(floatx80 a, float_status *status) fp2 =floatx80_add (fp2,float64_to_floatx80 (make_float64 (0x3EFA01A01A01D423 ), status), status);/* B4+T(B6+TB8) */ - fp4 =packFloatx80 (1 ,0x3FF5 ,LIT64 (0xB60B60B60B61D438 )); + fp4 =packFloatx80 (1 ,0x3FF5 ,UINT64_C (0xB60B60B60B61D438 )); fp3 =floatx80_add (fp3, fp4, status);/* B3+T(B5+TB7) */ fp2 =floatx80_mul (fp2, fp1, status);/* T(B4+T(B6+TB8)) */ fp1 =floatx80_mul (fp1, fp3, status);/* T(B3+T(B5+TB7)) */ - fp4 =packFloatx80 (0 ,0x3FFA ,LIT64 (0xAAAAAAAAAAAAAB5E )); + fp4 =packFloatx80 (0 ,0x3FFA ,UINT64_C (0xAAAAAAAAAAAAAB5E )); fp2 =floatx80_add (fp2, fp4, status);/* B2+T(B4+T(B6+TB8)) */ fp1 = floatx80_add(fp1, float32_to_floatx80( make_float32(0xBF000000), status),
@@ -1702,11 +1702,11 @@ floatx80 floatx80_sin(floatx80 a, float_status *status) fp3 =floatx80_add (fp3,float64_to_floatx80 (make_float64 (0xBF2A01A01A018B59 ), status), status);/* A3+T(A5+TA7) */ - fp4 =packFloatx80 (0 ,0x3FF8 ,LIT64 (0x88888888888859AF )); + fp4 =packFloatx80 (0 ,0x3FF8 ,UINT64_C (0x88888888888859AF )); fp2 =floatx80_add (fp2, fp4, status);/* A2+T(A4+TA6) */ fp1 =floatx80_mul (fp1, fp3, status);/* T(A3+T(A5+TA7)) */ fp2 =floatx80_mul (fp2, fp0, status);/* S(A2+T(A4+TA6)) */ - fp4 =packFloatx80 (1 ,0x3FFC ,LIT64 (0xAAAAAAAAAAAAAA99 )); + fp4 =packFloatx80 (1 ,0x3FFC ,UINT64_C (0xAAAAAAAAAAAAAA99 )); fp1 =floatx80_add (fp1, fp4, status);/* A1+T(A3+T(A5+TA7)) */ fp1 =floatx80_add (fp1, fp2, status);/* [A1+T(A3+T(A5+TA7))]+
@@ -1778,9 +1778,9 @@ floatx80 floatx80_cos(floatx80 a, float_status *status) fp1 =packFloatx80 (0 ,0 ,0 );if (compact ==0x7FFEFFFF ) { twopi1 =packFloatx80 (aSign ^1 ,0x7FFE , -LIT64 (0xC90FDAA200000000 )); +UINT64_C (0xC90FDAA200000000 )); twopi2 =packFloatx80 (aSign ^1 ,0x7FDC , -LIT64 (0x85A308D300000000 )); +UINT64_C (0x85A308D300000000 )); fp0 =floatx80_add (fp0, twopi1, status); fp1 = fp0; fp0 =floatx80_add (fp0, twopi2, status);
@@ -1799,9 +1799,9 @@ floatx80 floatx80_cos(floatx80 a, float_status *status) endflag =0 ; } invtwopi =packFloatx80 (0 ,0x3FFE - l, -LIT64 (0xA2F9836E4E44152A ));/* INVTWOPI */ - twopi1 =packFloatx80 (0 ,0x3FFF + l,LIT64 (0xC90FDAA200000000 )); - twopi2 =packFloatx80 (0 ,0x3FDD + l,LIT64 (0x85A308D300000000 )); +UINT64_C (0xA2F9836E4E44152A ));/* INVTWOPI */ + twopi1 =packFloatx80 (0 ,0x3FFF + l,UINT64_C (0xC90FDAA200000000 )); + twopi2 =packFloatx80 (0 ,0x3FDD + l,UINT64_C (0x85A308D300000000 ));/* SIGN(INARG)*2^63 IN SGL */ twoto63 =packFloat32 (xSign,0xBE ,0 );
@@ -1890,11 +1890,11 @@ floatx80 floatx80_cos(floatx80 a, float_status *status) fp2 =floatx80_add (fp2,float64_to_floatx80 (make_float64 (0x3EFA01A01A01D423 ), status), status);/* B4+T(B6+TB8) */ - fp4 =packFloatx80 (1 ,0x3FF5 ,LIT64 (0xB60B60B60B61D438 )); + fp4 =packFloatx80 (1 ,0x3FF5 ,UINT64_C (0xB60B60B60B61D438 )); fp3 =floatx80_add (fp3, fp4, status);/* B3+T(B5+TB7) */ fp2 =floatx80_mul (fp2, fp1, status);/* T(B4+T(B6+TB8)) */ fp1 =floatx80_mul (fp1, fp3, status);/* T(B3+T(B5+TB7)) */ - fp4 =packFloatx80 (0 ,0x3FFA ,LIT64 (0xAAAAAAAAAAAAAB5E )); + fp4 =packFloatx80 (0 ,0x3FFA ,UINT64_C (0xAAAAAAAAAAAAAB5E )); fp2 =floatx80_add (fp2, fp4, status);/* B2+T(B4+T(B6+TB8)) */ fp1 = floatx80_add(fp1, float32_to_floatx80( make_float32(0xBF000000), status),
@@ -1941,11 +1941,11 @@ floatx80 floatx80_cos(floatx80 a, float_status *status) fp3 =floatx80_add (fp3,float64_to_floatx80 (make_float64 (0xBF2A01A01A018B59 ), status), status);/* A3+T(A5+TA7) */ - fp4 =packFloatx80 (0 ,0x3FF8 ,LIT64 (0x88888888888859AF )); + fp4 =packFloatx80 (0 ,0x3FF8 ,UINT64_C (0x88888888888859AF )); fp2 =floatx80_add (fp2, fp4, status);/* A2+T(A4+TA6) */ fp1 =floatx80_mul (fp1, fp3, status);/* T(A3+T(A5+TA7)) */ fp2 =floatx80_mul (fp2, fp0, status);/* S(A2+T(A4+TA6)) */ - fp4 =packFloatx80 (1 ,0x3FFC ,LIT64 (0xAAAAAAAAAAAAAA99 )); + fp4 =packFloatx80 (1 ,0x3FFC ,UINT64_C (0xAAAAAAAAAAAAAA99 )); fp1 =floatx80_add (fp1, fp4, status);/* A1+T(A3+T(A5+TA7)) */ fp1 =floatx80_add (fp1, fp2, status);/* [A1+T(A3+T(A5+TA7))]+[S(A2+T(A4+TA6))] */
@@ -2114,8 +2114,8 @@ floatx80 floatx80_atan(floatx80 a, float_status *status) } } }else { - aSig &=LIT64 (0xF800000000000000 ); - aSig |=LIT64 (0x0400000000000000 ); + aSig &=UINT64_C (0xF800000000000000 ); + aSig |=UINT64_C (0x0400000000000000 ); xsave =packFloatx80 (aSign, aExp, aSig);/* F */ fp0 = a; fp1 = a;/* X */
@@ -2430,7 +2430,7 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status) fp0 =floatx80_mul (fp0,float32_to_floatx80 (make_float32 (0xBC317218 ), status), status);/* N * L1, L1 = lead(-log2/64) */ - l2 =packFloatx80 (0 ,0x3FDC ,LIT64 (0x82E308654361C4C6 )); + l2 =packFloatx80 (0 ,0x3FDC ,UINT64_C (0x82E308654361C4C6 )); fp2 =floatx80_mul (fp2, l2, status);/* N * L2, L1+L2 = -log2/64 */ fp0 =floatx80_add (fp0, fp1, status);/* X + N*L1 */ fp0 =floatx80_add (fp0, fp2, status);/* R */
@@ -2562,7 +2562,7 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status) fp2 =floatx80_add (fp2,float64_to_floatx80 (make_float64 (0x3FA5555555555555 ), status), status);/* B3 */ - fp3 =packFloatx80 (0 ,0x3FFC ,LIT64 (0xAAAAAAAAAAAAAAAB )); + fp3 =packFloatx80 (0 ,0x3FFC ,UINT64_C (0xAAAAAAAAAAAAAAAB )); fp1 =floatx80_add (fp1, fp3, status);/* B2 */ fp2 =floatx80_mul (fp2, fp0, status); fp1 =floatx80_mul (fp1, fp0, status);
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 06/13] target/m68k: replace LIT64 with UINT64_C macros
Quoted 7 lines · Alex Bennée
In our quest to eliminate the home rolled LIT64 macro we fixup usage inside for m68k's many constants.
Signed-off-by Alex Bennée <[email protected]>--- target/m68k/softfloat.c | 98 ++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 49 deletions(-)
r~
PATCH v3 7/13 fpu: remove the LIT64 macro
In reply to Alex BennéeNow the rest of the code has been cleaned up we can remove this.
--- include/fpu/softfloat.h | 2 -- 1 file changed, 2 deletions(-)
include/fpu/softfloat.h +0 -2
@@ -82,8 +82,6 @@ this code that are retained.#ifndef SOFTFLOAT_H #define SOFTFLOAT_H -#define LIT64 ( a ) a##LL -/*---------------------------------------------------------------------------- | Software IEC/IEEE floating-point ordering relations *----------------------------------------------------------------------------*/
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 07/13] fpu: remove the LIT64 macro
Quoted 6 lines · Alex Bennée
Now the rest of the code has been cleaned up we can remove this.
Signed-off-by Alex Bennée <[email protected]>--- include/fpu/softfloat.h | 2 -- 1 file changed, 2 deletions(-)
r~
PATCH v3 8/13 fpu: move inline helpers into a separate header
In reply to Alex BennéeThere are a bunch of users of the inline helpers who do not need access to the entire softfloat API. Move those inline helpers into a new header file which can be included without bringing in the rest of the world.
---
v2
- don't squash up quite so much
--- include/fpu/softfloat-helpers.h | 132 ++++++++++++++++++++++++++++++++ include/fpu/softfloat.h | 63 +-------------- 2 files changed, 133 insertions(+), 62 deletions(-) create mode 100644 include/fpu/softfloat-helpers.h
include/fpu/softfloat-helpers.h new file +132 -0
@@ -0,0 +1,132 @@ +/* +* QEMU float support - standalone helpers +* +* This is provided for files that don't need the access to the full +* set of softfloat functions. Typically this is cpu initialisation +* code which wants to set default rounding and exceptions modes. +* +* The code in this source file is derived from release 2a of the SoftFloat +* IEC/IEEE Floating-point Arithmetic Package. Those parts of the code (and +* some later contributions) are provided under that license, as detailed below. +* It has subsequently been modified by contributors to the QEMU Project, +* so some portions are provided under: +* the SoftFloat-2a license +* the BSD license +* GPL-v2-or-later +* +* Any future contributions to this file after December 1st 2014 will be +* taken to be licensed under the Softfloat-2a license unless specifically +* indicated otherwise. +*/ + +/* +=============================================================================== +This C header file is part of the SoftFloat IEC/IEEE Floating-point +Arithmetic Package, Release 2a. + +Written by John R. Hauser. This work was made possible in part by the +International Computer Science Institute, located at Suite 600, 1947 Center +Street, Berkeley, California 94704. Funding was partially provided by the +National Science Foundation under grant MIP-9311980. The original version +of this code was written as part of a project to build a fixed-point vector +processor in collaboration with the University of California at Berkeley, +overseen by Profs. Nelson Morgan and John Wawrzynek. More information +is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/ +arithmetic/SoftFloat.html'. + +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. + +Derivative works are acceptable, even for commercial purposes, so long as +(1) they include prominent notice that the work is derivative, and (2) they +include prominent notice akin to these four paragraphs for those parts of +this code that are retained. + +=============================================================================== +*/ + +#ifndef _SOFTFLOAT_HELPERS_H_ +#define _SOFTFLOAT_HELPERS_H_ + +#include "fpu/softfloat-types.h" + +static inline void set_float_detect_tininess (int val,float_status *status) +{ + status->float_detect_tininess = val; +} + +static inline void set_float_rounding_mode (int val,float_status *status) +{ + status->float_rounding_mode = val; +} + +static inline void set_float_exception_flags (int val,float_status *status) +{ + status->float_exception_flags = val; +} + +static inline void set_floatx80_rounding_precision (int val, +float_status *status) +{ + status->floatx80_rounding_precision = val; +} + +static inline void set_flush_to_zero (flag val,float_status *status) +{ + status->flush_to_zero = val; +} + +static inline void set_flush_inputs_to_zero (flag val,float_status *status) +{ + status->flush_inputs_to_zero = val; +} + +static inline void set_default_nan_mode (flag val,float_status *status) +{ + status->default_nan_mode = val; +} + +static inline void set_snan_bit_is_one (flag val,float_status *status) +{ + status->snan_bit_is_one = val; +} + +static inline int get_float_detect_tininess (float_status *status) +{ +return status->float_detect_tininess; +} + +static inline int get_float_rounding_mode (float_status *status) +{ +return status->float_rounding_mode; +} + +static inline int get_float_exception_flags (float_status *status) +{ +return status->float_exception_flags; +} + +static inline int get_floatx80_rounding_precision (float_status *status) +{ +return status->floatx80_rounding_precision; +} + +static inline flag get_flush_to_zero (float_status *status) +{ +return status->flush_to_zero; +} + +static inline flag get_flush_inputs_to_zero (float_status *status) +{ +return status->flush_inputs_to_zero; +} + +static inline flag get_default_nan_mode (float_status *status) +{ +return status->default_nan_mode; +} + +#endif /* _SOFTFLOAT_HELPERS_H_ */
include/fpu/softfloat.h +1 -62
69 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v3 9/13 fpu: make softfloat-macros "self-contained"
In reply to Alex BennéeThe macros use the "flags" type and to be consistent if anyone just needs the macros we should bring in the header we need. There is an outstanding TODO to audit the use of "flags" and replace with bool at which point this include could be dropped.
--- include/fpu/softfloat-macros.h | 2 ++ 1 file changed, 2 insertions(+)
include/fpu/softfloat-macros.h +2 -0
@@ -82,6 +82,8 @@ this code that are retained.#ifndef FPU_SOFTFLOAT_MACROS_H #define FPU_SOFTFLOAT_MACROS_H +#include "fpu/softfloat-types.h" +/*---------------------------------------------------------------------------- | Shifts `a' right by the number of bits given in `count'. If any nonzero | bits are shifted off, they are ``jammed'' into the least significant bit of
Signature · 1 line
2.20.1
PATCH v3 10/13 fpu: rename softfloat-specialize.h -> .inc.c
In reply to Alex BennéeThis is not a normal header and should only be included in the main softfloat.c file to bring in the various target specific specialisations. Indeed as it contains non-inlined C functions it is not even a legal header. Rename it to match our included C convention.
---
fpu/{softfloat-specialize.h => softfloat-specialize.inc.c} | 0
fpu/softfloat.c | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename fpu/{softfloat-specialize.h => softfloat-specialize.inc.c} (100%)fpu/softfloat-specialize.inc.c renamed from fpu/softfloat-specialize.h +0 -0
fpu/softfloat.c +1 -1
@@ -634,7 +634,7 @@ static inline float64 float64_pack_raw(FloatParts p)| are propagated from function inputs to output. These details are target- | specific. *----------------------------------------------------------------------------*/ -#include "softfloat-specialize.h" +#include "softfloat-specialize.inc.c" /* Canonicalize EXP and FRAC, setting CLS. */ static FloatParts sf_canonicalize(FloatParts part, const FloatFmt *parm,
Signature · 1 line
2.20.1
PATCH v3 11/13 target/mips: rationalise softfloat includes
In reply to Alex BennéeWe should avoid including the whole of softfloat headers in cpu.h and explicitly include it only where we will be calling softfloat functions. We can use the -types.h in cpu.h for the few bits that are global. We also move the restore_snan_bit_mode into internal.h and include -helpers.h there.
---
v2
- move restore_snan_bit_mode to internal.h
--- linux-user/mips/cpu_loop.c | 1 + target/mips/cpu.h | 8 +------- target/mips/internal.h | 7 +++++++ target/mips/msa_helper.c | 1 + target/mips/op_helper.c | 1 + 5 files changed, 11 insertions(+), 7 deletions(-)
linux-user/mips/cpu_loop.c +1 -0
@@ -22,6 +22,7 @@#include "qemu.h" #include "cpu_loop-common.h" #include "elf.h" +#include "internal.h" # ifdef TARGET_ABI_MIPSO32 # define MIPS_SYS (name, args) args,
target/mips/cpu.h +1 -7
@@ -5,7 +5,7 @@#include "cpu-qom.h" #include "exec/cpu-defs.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-types.h" #include "mips-defs.h" #define TCG_GUEST_DEFAULT_MO (0)
@@ -1195,12 +1195,6 @@ void itc_reconfigure(struct MIPSITUState *tag);/* helper.c */ target_ulong exception_resume_pc (CPUMIPSState *env); -static inline void restore_snan_bit_mode (CPUMIPSState *env) -{ -set_snan_bit_is_one ((env->active_fpu.fcr31 & (1 <<FCR31_NAN2008 )) ==0 , - &env->active_fpu.fp_status); -} -static inline void cpu_get_tb_cpu_state (CPUMIPSState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *flags) {
target/mips/internal.h +7 -0
@@ -7,6 +7,7 @@#ifndef MIPS_INTERNAL_H #define MIPS_INTERNAL_H +#include "fpu/softfloat-helpers.h" /* MMU types, the first four entries have the same layout as the CP0C0_MT field. */
@@ -226,6 +227,12 @@ static inline void restore_flush_mode(CPUMIPSState *env) &env->active_fpu.fp_status); } +static inline void restore_snan_bit_mode (CPUMIPSState *env) +{ +set_snan_bit_is_one ((env->active_fpu.fcr31 & (1 <<FCR31_NAN2008 )) ==0 , + &env->active_fpu.fp_status); +} +static inline void restore_fp_status (CPUMIPSState *env) {restore_rounding_mode (env);
target/mips/msa_helper.c +1 -0
@@ -22,6 +22,7 @@#include "internal.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" +#include "fpu/softfloat.h" /* Data format min and max values */ #define DF_BITS (df) (1 << ((df) + 3))
target/mips/op_helper.c +1 -0
@@ -25,6 +25,7 @@#include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "sysemu/kvm.h" +#include "fpu/softfloat.h" /*****************************************************************************/ /* Exceptions processing helpers */
Signature · 1 line
2.20.1
PATCH v3 12/13 target/riscv: rationalise softfloat includes
In reply to Alex BennéeWe should avoid including the whole of softfloat headers in cpu.h and explicitly include it only where we will be calling softfloat functions. We can use the -types.h and -helpers.h in cpu.h for the few bits that are global.
--- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 2 +- target/riscv/fpu_helper.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
target/riscv/cpu.c +1 -0
@@ -27,6 +27,7 @@#include "qemu/error-report.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" +#include "fpu/softfloat-helpers.h" /* RISC-V CPU definitions */
target/riscv/cpu.h +1 -1
@@ -22,7 +22,7 @@#include "qom/cpu.h" #include "exec/cpu-defs.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-types.h" #define TCG_GUEST_DEFAULT_MO 0
target/riscv/fpu_helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/host-utils.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" +#include "fpu/softfloat.h" target_ulong riscv_cpu_get_fflags (CPURISCVState *env) {
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 12/13] target/riscv: rationalise softfloat includes
Quoted 8 lines · Alex Bennée
We should avoid including the whole of softfloat headers in
cpu.hand explicitly include it only where we will be calling softfloat functions. We can use the-types.hand-helpers.hincpu.hfor the few bits that are global.Signed-off-by Alex Bennée <[email protected]>Reviewed-by Richard Henderson <[email protected]>Reviewed-by Alistair Francis <[email protected]>
Quoted 44 lines
--- target/riscv/cpu.c | 1 + target/riscv/cpu.h | 2 +- target/riscv/fpu_helper.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)target/riscv/cpu.c +1
-0@@ -27,6 +27,7 @@#include "qemu/error-report.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" +#include "fpu/softfloat-helpers.h" /* RISC-V CPU definitions */ target/riscv/cpu.h +1
-1@@ -22,7 +22,7 @@#include "qom/cpu.h" #include "exec/cpu-defs.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-types.h" #define TCG_GUEST_DEFAULT_MO 0target/riscv/fpu_helper.c +1
-0@@ -21,6 +21,7 @@#include "qemu/host-utils.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" +#include "fpu/softfloat.h" target_ulong riscv_cpu_get_fflags (CPURISCVState *env) {
PATCH v3 13/13 targets (various): use softfloat-helpers.h where we can
In reply to Alex BennéeGenerally the cpu and non-FP helper files just want to manipulate the softfloat flags. For this they can just use the -helpers.h include which brings in a minimal number of inline helpers.
--- target/alpha/helper.c | 2 +- target/microblaze/cpu.c | 2 +- target/s390x/cpu.c | 2 +- target/sh4/cpu.c | 3 +-- target/tricore/helper.c | 2 +- target/unicore32/cpu.c | 1 - 6 files changed, 5 insertions(+), 7 deletions(-)
target/alpha/helper.c +1 -1
@@ -21,7 +21,7 @@#include "cpu.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-types.h" #include "exec/helper-proto.h" #include "qemu/qemu-print.h"
target/microblaze/cpu.c +1 -1
@@ -28,7 +28,7 @@#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-helpers.h" static const struct { const char *name;
target/s390x/cpu.c +1 -1
@@ -42,7 +42,7 @@#include "sysemu/sysemu.h" #include "sysemu/tcg.h" #endif -#include "fpu/softfloat.h" +#include "fpu/softfloat-helpers.h" #define CR0_RESET 0xE0UL#define CR14_RESET 0xC2000000UL;
target/sh4/cpu.c +1 -2
@@ -25,8 +25,7 @@#include "cpu.h" #include "migration/vmstate.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" - +#include "fpu/softfloat-helpers.h" static void superh_cpu_set_pc (CPUState *cs,vaddr value) {
target/tricore/helper.c +1 -1
@@ -19,7 +19,7 @@#include "cpu.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-helpers.h" #include "qemu/qemu-print.h" enum {
target/unicore32/cpu.c +0 -1
@@ -17,7 +17,6 @@#include "cpu.h" #include "migration/vmstate.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" static void uc32_cpu_set_pc (CPUState *cs,vaddr value) {
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v3 13/13] targets (various): use softfloat-helpers.h where we can
Quoted 87 lines · Alex Bennée
Generally the cpu and non-FP helper files just want to manipulate the softfloat flags. For this they can just use the
-helpers.hinclude which brings in a minimal number of inline helpers.Signed-off-by Alex Bennée <[email protected]>Reviewed-by Richard Henderson <[email protected]>Reviewed-by David Hildenbrand <[email protected]>--- target/alpha/helper.c | 2 +- target/microblaze/cpu.c | 2 +- target/s390x/cpu.c | 2 +- target/sh4/cpu.c | 3 +-- target/tricore/helper.c | 2 +- target/unicore32/cpu.c | 1 - 6 files changed, 5 insertions(+), 7 deletions(-)target/alpha/helper.c +1
-1@@ -21,7 +21,7 @@#include "cpu.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-types.h" #include "exec/helper-proto.h" #include "qemu/qemu-print.h" target/microblaze/cpu.c +1
-1@@ -28,7 +28,7 @@#include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-helpers.h" static const struct { const char *name;target/s390x/cpu.c +1
-1@@ -42,7 +42,7 @@#include "sysemu/sysemu.h" #include "sysemu/tcg.h" #endif -#include "fpu/softfloat.h" +#include "fpu/softfloat-helpers.h" #define CR0_RESET 0xE0UL#define CR14_RESET 0xC2000000UL;target/sh4/cpu.c +1
-2@@ -25,8 +25,7 @@#include "cpu.h" #include "migration/vmstate.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" - +#include "fpu/softfloat-helpers.h" static void superh_cpu_set_pc (CPUState *cs,vaddr value) {target/tricore/helper.c +1
-1@@ -19,7 +19,7 @@#include "cpu.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h" +#include "fpu/softfloat-helpers.h" #include "qemu/qemu-print.h" enum {target/unicore32/cpu.c +0
-0
target/unicore32/cpu.c line 20
Quoted 4 lines
target/unicore32/cpu.c +0
-1@@ -17,7 +17,6 @@#include "cpu.h" #include "migration/vmstate.h" #include "exec/exec-all.h" -#include "fpu/softfloat.h"
target/unicore32/cpu.h has to include "fpu/softfloat-types.h" (use of float_status).
Quoted 4 lines
target/unicore32/cpu.c +0
-0static void uc32_cpu_set_pc (CPUState *cs,vaddr value) {
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH v3 00/13] softfloat updates (include tweaks, rm LIT64)
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
968ff69..02db1be master -> master - [tag update] patchew/1564502498-805893-1-git-send-email-andrey.shinkevich@virtuozzo.com -> patchew/1564502498-805893-1-git-send-email-andrey.shinkevich@virtuozzo.com - [tag update] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected]
Submodule 'capstone' (https://git.qemu.org/git/capstone.git) registered for path 'capstone'
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Submodule 'roms/QemuMacDrivers' (https://git.qemu.org/git/QemuMacDrivers.git) registered for path 'roms/QemuMacDrivers' Submodule 'roms/SLOF' (https://git.qemu.org/git/SLOF.git) registered for path 'roms/SLOF'
Submodule 'roms/edk2' (https://git.qemu.org/git/edk2.git) registered for path 'roms/edk2'
Submodule 'roms/ipxe' (https://git.qemu.org/git/ipxe.git) registered for path 'roms/ipxe'
Submodule 'roms/openbios' (https://git.qemu.org/git/openbios.git) registered for path 'roms/openbios'
Submodule 'roms/openhackware' (https://git.qemu.org/git/openhackware.git) registered for path 'roms/openhackware'
Submodule 'roms/opensbi' (https://git.qemu.org/git/opensbi.git) registered for path 'roms/opensbi'
Submodule 'roms/qemu-palcode' (https://git.qemu.org/git/qemu-palcode.git) registered for path 'roms/qemu-palcode'
Submodule 'roms/seabios' (https://git.qemu.org/git/seabios.git/) registered for path 'roms/seabios'
Submodule 'roms/seabios-hppa' (https://git.qemu.org/git/seabios-hppa.git) registered for path 'roms/seabios-hppa'
Submodule 'roms/sgabios' (https://git.qemu.org/git/sgabios.git) registered for path 'roms/sgabios'
Submodule 'roms/skiboot' (https://git.qemu.org/git/skiboot.git) registered for path 'roms/skiboot'
Submodule 'roms/u-boot' (https://git.qemu.org/git/u-boot.git) registered for path 'roms/u-boot'
Submodule 'roms/u-boot-sam460ex' (https://git.qemu.org/git/u-boot-sam460ex.git) registered for path 'roms/u-boot-sam460ex' Submodule 'slirp' (https://git.qemu.org/git/libslirp.git) registered for path 'slirp'
Submodule 'tests/fp/berkeley-softfloat-3' (https://git.qemu.org/git/berkeley-softfloat-3.git) registered for path 'tests/fp/berkeley-softfloat-3' Submodule 'tests/fp/berkeley-testfloat-3' (https://git.qemu.org/git/berkeley-testfloat-3.git) registered for path 'tests/fp/berkeley-testfloat-3' Submodule 'ui/keycodemapdb' (https://git.qemu.org/git/keycodemapdb.git) registered for path 'ui/keycodemapdb'
Cloning into 'capstone'...
Submodule path 'capstone': checked out '22ead3e0bfdb87516656453336160e0a37b066bf'
Cloning into 'dtc'...
Submodule path 'dtc': checked out '88f18909db731a627456f26d779445f84e449536'
Cloning into 'roms/QemuMacDrivers'...
Submodule path 'roms/QemuMacDrivers': checked out '90c488d5f4a407342247b9ea869df1c2d9c8e266'
Cloning into 'roms/SLOF'...
Submodule path 'roms/SLOF': checked out 'ba1ab360eebe6338bb8d7d83a9220ccf7e213af3'
Cloning into 'roms/edk2'...
Submodule path 'roms/edk2': checked out '20d2e5a125e34fc8501026613a71549b2a1a3e54'
Submodule 'SoftFloat' (https://github.com/ucb-bar/berkeley-softfloat-3.git) registered for path 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3' Submodule 'CryptoPkg/Library/OpensslLib/openssl' (https://github.com/openssl/openssl) registered for path 'CryptoPkg/Library/OpensslLib/openssl' Cloning into 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3'...
Submodule path 'roms/edk2/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037' Cloning into 'CryptoPkg/Library/OpensslLib/openssl'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl': checked out '50eaac9f3337667259de725451f201e784599687' Submodule 'boringssl' (https://boringssl.googlesource.com/boringssl) registered for path 'boringssl'
Submodule 'krb5' (https://github.com/krb5/krb5) registered for path 'krb5'
Submodule 'pyca.cryptography' (https://github.com/pyca/cryptography.git) registered for path 'pyca-cryptography'
Cloning into 'boringssl'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl': checked out '2070f8ad9151dc8f3a73bffaa146b5e6937a583f' Cloning into 'krb5'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5': checked out 'b9ad6c49505c96a088326b62a52568e3484f2168' Cloning into 'pyca-cryptography'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/pyca-cryptography': checked out '09403100de2f6f1cdd0d484dcb8e620f1c335c8f' Cloning into 'roms/ipxe'...
Submodule path 'roms/ipxe': checked out 'de4565cbe76ea9f7913a01f331be3ee901bb6e17'
Cloning into 'roms/openbios'...
Submodule path 'roms/openbios': checked out 'c79e0ecb84f4f1ee3f73f521622e264edd1bf174'
Cloning into 'roms/openhackware'...
Submodule path 'roms/openhackware': checked out 'c559da7c8eec5e45ef1f67978827af6f0b9546f5'
Cloning into 'roms/opensbi'...
Submodule path 'roms/opensbi': checked out 'ce228ee0919deb9957192d723eecc8aaae2697c6'
Cloning into 'roms/qemu-palcode'...
Submodule path 'roms/qemu-palcode': checked out 'bf0e13698872450164fa7040da36a95d2d4b326f'
Cloning into 'roms/seabios'...
Submodule path 'roms/seabios': checked out 'a5cab58e9a3fb6e168aba919c5669bea406573b4'
Cloning into 'roms/seabios-hppa'...
Submodule path 'roms/seabios-hppa': checked out '0f4fe84658165e96ce35870fd19fc634e182e77b'
Cloning into 'roms/sgabios'...
Submodule path 'roms/sgabios': checked out 'cbaee52287e5f32373181cff50a00b6c4ac9015a'
Cloning into 'roms/skiboot'...
Submodule path 'roms/skiboot': checked out '261ca8e779e5138869a45f174caa49be6a274501'
Cloning into 'roms/u-boot'...
Submodule path 'roms/u-boot': checked out 'd3689267f92c5956e09cc7d1baa4700141662bff'
Cloning into 'roms/u-boot-sam460ex'...
Submodule path 'roms/u-boot-sam460ex': checked out '60b3916f33e617a815973c5a6df77055b2e3a588'
Cloning into 'slirp'...
Submodule path 'slirp': checked out '126c04acbabd7ad32c2b018fe10dfac2a3bc1210'
Cloning into 'tests/fp/berkeley-softfloat-3'...
Submodule path 'tests/fp/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037'
Cloning into 'tests/fp/berkeley-testfloat-3'...
Submodule path 'tests/fp/berkeley-testfloat-3': checked out '5a59dcec19327396a011a17fd924aed4fec416b3'
Cloning into 'ui/keycodemapdb'...
Submodule path 'ui/keycodemapdb': checked out '6b3d716e2b6472eb7189d3220552280ef3d832ce'
Switched to a new branch 'test'
7063801 targets (various): use softfloat-helpers.h where we can
74065c6 target/riscv: rationalise softfloat includes
d4059b7 target/mips: rationalise softfloat includes
41534bb fpu: rename softfloat-specialize.h -> .inc.c
c594bca fpu: make softfloat-macros "self-contained"
78228a5 fpu: move inline helpers into a separate header
ef5083f fpu: remove the LIT64 macro
441d110 target/m68k: replace LIT64 with UINT64_C macros
434b949 fpu: replace LIT64 with UINT64_C macros
bf6b8fe fpu: use min/max values from stdint.h for integral overflow
1523c3b fpu: optimise float[16/32/64]_squash_denormal (HACK?)
3cbf2ff fpu: convert float[16/32/64]_squash_denormal to new modern style
8b4729a fpu: replace LIT64 usage with UINT64_C for specialize constants
=== OUTPUT BEGIN ===
1/13 Checking commit 8b4729ae905b (fpu: replace LIT64 usage with UINT64_C for specialize constants) 2/13 Checking commit 3cbf2ff0d926 (fpu: convert float[16/32/64]_squash_denormal to new modern style)
WARNING: Block comments use a leading /* on a separate line
#46: FILE: fpu/softfloat.c:3292:
+/*----------------------------------------------------------------------------
WARNING: Block comments use * on subsequent lines
#47: FILE: fpu/softfloat.c:3293:
+/*---------------------------------------------------------------------------- +| If `a' is denormal and we are in flush-to-zero mode then set the
WARNING: Block comments use a trailing */ on a separate line
#49: FILE: fpu/softfloat.c:3295:
+*----------------------------------------------------------------------------*/
total: 0 errors, 3 warnings, 140 lines checked
Patch 2/13 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/13 Checking commit 1523c3bdb4c0 (fpu: optimise float[16/32/64]_squash_denormal (HACK?)) 4/13 Checking commit bf6b8fe7eb8a (fpu: use min/max values from stdint.h for integral overflow) 5/13 Checking commit 434b9493c9d8 (fpu: replace LIT64 with UINT64_C macros)
ERROR: space prohibited after that open parenthesis '('
#41: FILE: fpu/softfloat.c:3761:
+ || ( zSig + roundIncrement < UINT64_C(0x8000000000000000) );
ERROR: space prohibited before that close parenthesis ')' #41: FILE: fpu/softfloat.c:3761:
+ || ( zSig + roundIncrement < UINT64_C(0x8000000000000000) );
ERROR: space prohibited after that open parenthesis '(' #76: FILE: fpu/softfloat.c:3960:
+ && ( zSig0 == UINT64_C(0xFFFFFFFFFFFFFFFF) )
ERROR: space prohibited before that close parenthesis ')' #76: FILE: fpu/softfloat.c:3960:
+ && ( zSig0 == UINT64_C(0xFFFFFFFFFFFFFFFF) )
ERROR: space prohibited after that open parenthesis '(' #85: FILE: fpu/softfloat.c:3983:
+ || ( zSig0 < UINT64_C(0xFFFFFFFFFFFFFFFF) );
ERROR: space prohibited before that close parenthesis ')' #85: FILE: fpu/softfloat.c:3983:
+ || ( zSig0 < UINT64_C(0xFFFFFFFFFFFFFFFF) );
ERROR: space prohibited after that open parenthesis '(' #172: FILE: fpu/softfloat.c:5178:
+ if ( aSig & UINT64_C(0x0020000000000000) ) {
ERROR: space prohibited before that close parenthesis ')' #172: FILE: fpu/softfloat.c:5178:
+ if ( aSig & UINT64_C(0x0020000000000000) ) {
ERROR: space prohibited after that open parenthesis '(' #190: FILE: fpu/softfloat.c:5727:
+ packFloatx80( aSign, 0x3FFF, UINT64_C(0x8000000000000000));
WARNING: line over 80 characters
#196: FILE: fpu/softfloat.c:5732:
+ return packFloatx80(aSign, 0x3FFF, UINT64_C(0x8000000000000000));
ERROR: space prohibited after that open parenthesis '(' #203: FILE: fpu/softfloat.c:5738:
+ packFloatx80( 1, 0x3FFF, UINT64_C(0x8000000000000000))
ERROR: space prohibited after that open parenthesis '(' #209: FILE: fpu/softfloat.c:5743:
+ : packFloatx80( 0, 0x3FFF, UINT64_C(0x8000000000000000));
ERROR: space prohibited after that open parenthesis '(' #245: FILE: fpu/softfloat.c:6276:
+ if ( ( zSig1 & UINT64_C(0x3FFFFFFFFFFFFFFF) ) <= 5 ) {
ERROR: space prohibited before that close parenthesis ')' #245: FILE: fpu/softfloat.c:6276:
+ if ( ( zSig1 & UINT64_C(0x3FFFFFFFFFFFFFFF) ) <= 5 ) {
ERROR: space prohibited after that open parenthesis '(' #254: FILE: fpu/softfloat.c:6575:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: space prohibited before that close parenthesis ')' #254: FILE: fpu/softfloat.c:6575:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: trailing statements should be on next line
#254: FILE: fpu/softfloat.c:6575:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: braces {} are necessary for all arms of this statement #254: FILE: fpu/softfloat.c:6575:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
[...]
ERROR: space prohibited after that open parenthesis '(' #272: FILE: fpu/softfloat.c:6653:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: space prohibited before that close parenthesis ')' #272: FILE: fpu/softfloat.c:6653:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: trailing statements should be on next line
#272: FILE: fpu/softfloat.c:6653:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: braces {} are necessary for all arms of this statement #272: FILE: fpu/softfloat.c:6653:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
[...]
ERROR: space prohibited after that open parenthesis '(' #280: FILE: fpu/softfloat.c:6660:
+ && ( aSig1 || ( aSig0 != UINT64_C(0x0001000000000000) ) )
ERROR: space prohibited before that close parenthesis ')' #280: FILE: fpu/softfloat.c:6660:
+ && ( aSig1 || ( aSig0 != UINT64_C(0x0001000000000000) ) )
ERROR: space prohibited after that open parenthesis '(' #289: FILE: fpu/softfloat.c:6697:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: space prohibited before that close parenthesis ')' #289: FILE: fpu/softfloat.c:6697:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: trailing statements should be on next line
#289: FILE: fpu/softfloat.c:6697:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: braces {} are necessary for all arms of this statement #289: FILE: fpu/softfloat.c:6697:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
[...]
ERROR: space prohibited after that open parenthesis '(' #297: FILE: fpu/softfloat.c:6702:
+ if ( ( a.high == UINT64_C(0xC03E000000000000) )
ERROR: space prohibited before that close parenthesis ')' #297: FILE: fpu/softfloat.c:6702:
+ if ( ( a.high == UINT64_C(0xC03E000000000000) )
ERROR: space prohibited after that open parenthesis '(' #298: FILE: fpu/softfloat.c:6703:
+ && ( aSig1 < UINT64_C(0x0002000000000000) ) ) {
ERROR: space prohibited before that close parenthesis ')' #298: FILE: fpu/softfloat.c:6703:
+ && ( aSig1 < UINT64_C(0x0002000000000000) ) ) {
ERROR: space prohibited after that open parenthesis '(' #352: FILE: fpu/softfloat.c:7196:
+ if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;
ERROR: space prohibited before that close parenthesis ')' #352: FILE: fpu/softfloat.c:7196:
+ if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;
ERROR: trailing statements should be on next line
#352: FILE: fpu/softfloat.c:7196:
+ if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;
ERROR: braces {} are necessary for all arms of this statement #352: FILE: fpu/softfloat.c:7196:
+ if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;
[...]
ERROR: space prohibited after that open parenthesis '(' #393: FILE: fpu/softfloat.c:7390:
+ if (UINT64_C( 0x0002000000000000) <= zSig0 ) {
ERROR: space prohibited before that close parenthesis ')' #393: FILE: fpu/softfloat.c:7390:
+ if (UINT64_C( 0x0002000000000000) <= zSig0 ) {
ERROR: space prohibited before that close parenthesis ')' #402: FILE: fpu/softfloat.c:7457:
+ aSig0 | UINT64_C(0x0001000000000000), aSig1, 15, &aSig0, &aSig1 );
ERROR: space prohibited before that close parenthesis ')' #405: FILE: fpu/softfloat.c:7459:
+ bSig0 | UINT64_C(0x0001000000000000), bSig1, 15, &bSig0, &bSig1 );
ERROR: space prohibited before that close parenthesis ')' #422: FILE: fpu/softfloat.c:7542:
+ bSig0 | UINT64_C(0x0001000000000000), bSig1, 15, &bSig0, &bSig1 );
ERROR: space prohibited after that open parenthesis '(' #453: FILE: include/fpu/softfloat-macros.h:619:
+ if ( b <= a0 ) return UINT64_C(0xFFFFFFFFFFFFFFFF);
ERROR: space prohibited before that close parenthesis ')' #453: FILE: include/fpu/softfloat-macros.h:619:
+ if ( b <= a0 ) return UINT64_C(0xFFFFFFFFFFFFFFFF);
ERROR: trailing statements should be on next line
#453: FILE: include/fpu/softfloat-macros.h:619:
+ if ( b <= a0 ) return UINT64_C(0xFFFFFFFFFFFFFFFF);
ERROR: braces {} are necessary for all arms of this statement #453: FILE: include/fpu/softfloat-macros.h:619:
+ if ( b <= a0 ) return UINT64_C(0xFFFFFFFFFFFFFFFF);
[...]
ERROR: spaces required around that '<<' (ctx:VxV)
#456: FILE: include/fpu/softfloat-macros.h:621:
+ z = ( b0<<32 <= a0 ) ? UINT64_C(0xFFFFFFFF00000000) : ( a0 / b0 )<<32;
^ERROR: spaces required around that '<<' (ctx:VxV)
#456: FILE: include/fpu/softfloat-macros.h:621:
+ z = ( b0<<32 <= a0 ) ? UINT64_C(0xFFFFFFFF00000000) : ( a0 / b0 )<<32;
^ERROR: space prohibited after that open parenthesis '(' #456: FILE: include/fpu/softfloat-macros.h:621:
+ z = ( b0<<32 <= a0 ) ? UINT64_C(0xFFFFFFFF00000000) : ( a0 / b0 )<<32;
ERROR: space prohibited before that close parenthesis ')' #456: FILE: include/fpu/softfloat-macros.h:621:
+ z = ( b0<<32 <= a0 ) ? UINT64_C(0xFFFFFFFF00000000) : ( a0 / b0 )<<32;
total: 48 errors, 1 warnings, 405 lines checked
Patch 5/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
6/13 Checking commit 441d11031283 (target/m68k: replace LIT64 with UINT64_C macros)
WARNING: line over 80 characters
#49: FILE: target/m68k/softfloat.c:376:
+ fSig = (aSig & UINT64_C(0xFE00000000000000)) | UINT64_C(0x0100000000000000);
WARNING: line over 80 characters
#67: FILE: target/m68k/softfloat.c:434:
+ fSig = (aSig & UINT64_C(0xFE00000000000000)) | UINT64_C(0x0100000000000000);
WARNING: line over 80 characters
#76: FILE: target/m68k/softfloat.c:565:
+ fSig = (aSig & UINT64_C(0xFE00000000000000)) | UINT64_C(0x0100000000000000);
WARNING: line over 80 characters
#103: FILE: target/m68k/softfloat.c:781:
+ fp1 = packFloatx80(0, 0x3FFF, UINT64_C(0xB8AA3B295C17F0BC)); /* INV_L2 */
WARNING: line over 80 characters
#158: FILE: target/m68k/softfloat.c:1353:
+ UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
WARNING: line over 80 characters
#227: FILE: target/m68k/softfloat.c:1563:
+ UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
WARNING: line over 80 characters
#280: FILE: target/m68k/softfloat.c:1802:
+ UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
total: 0 errors, 7 warnings, 298 lines checked
Patch 6/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
7/13 Checking commit ef5083f185d0 (fpu: remove the LIT64 macro)
8/13 Checking commit 78228a5adc13 (fpu: move inline helpers into a separate header)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #19:
new file mode 100644
WARNING: Block comments use * on subsequent lines
#46: FILE: include/fpu/softfloat-helpers.h:23:
+/*
+===============================================================================
total: 0 errors, 2 warnings, 201 lines checked
Patch 8/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
9/13 Checking commit c594bca84c66 (fpu: make softfloat-macros "self-contained") 10/13 Checking commit 41534bbd6e70 (fpu: rename softfloat-specialize.h -> .inc.c)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #19:
rename from fpu/softfloat-specialize.h
total: 0 errors, 1 warnings, 8 lines checked
Patch 10/13 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/13 Checking commit d4059b754d5d (target/mips: rationalise softfloat includes) 12/13 Checking commit 74065c61cac3 (target/riscv: rationalise softfloat includes) 13/13 Checking commit 7063801ac57b (targets (various): use softfloat-helpers.h where we can) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH v3 00/13] softfloat updates (include tweaks, rm LIT64)
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected]
Submodule 'capstone' (https://git.qemu.org/git/capstone.git) registered for path 'capstone'
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Submodule 'roms/QemuMacDrivers' (https://git.qemu.org/git/QemuMacDrivers.git) registered for path 'roms/QemuMacDrivers' Submodule 'roms/SLOF' (https://git.qemu.org/git/SLOF.git) registered for path 'roms/SLOF'
Submodule 'roms/edk2' (https://git.qemu.org/git/edk2.git) registered for path 'roms/edk2'
Submodule 'roms/ipxe' (https://git.qemu.org/git/ipxe.git) registered for path 'roms/ipxe'
Submodule 'roms/openbios' (https://git.qemu.org/git/openbios.git) registered for path 'roms/openbios'
Submodule 'roms/openhackware' (https://git.qemu.org/git/openhackware.git) registered for path 'roms/openhackware'
Submodule 'roms/opensbi' (https://git.qemu.org/git/opensbi.git) registered for path 'roms/opensbi'
Submodule 'roms/qemu-palcode' (https://git.qemu.org/git/qemu-palcode.git) registered for path 'roms/qemu-palcode'
Submodule 'roms/seabios' (https://git.qemu.org/git/seabios.git/) registered for path 'roms/seabios'
Submodule 'roms/seabios-hppa' (https://git.qemu.org/git/seabios-hppa.git) registered for path 'roms/seabios-hppa'
Submodule 'roms/sgabios' (https://git.qemu.org/git/sgabios.git) registered for path 'roms/sgabios'
Submodule 'roms/skiboot' (https://git.qemu.org/git/skiboot.git) registered for path 'roms/skiboot'
Submodule 'roms/u-boot' (https://git.qemu.org/git/u-boot.git) registered for path 'roms/u-boot'
Submodule 'roms/u-boot-sam460ex' (https://git.qemu.org/git/u-boot-sam460ex.git) registered for path 'roms/u-boot-sam460ex' Submodule 'slirp' (https://git.qemu.org/git/libslirp.git) registered for path 'slirp'
Submodule 'tests/fp/berkeley-softfloat-3' (https://git.qemu.org/git/berkeley-softfloat-3.git) registered for path 'tests/fp/berkeley-softfloat-3' Submodule 'tests/fp/berkeley-testfloat-3' (https://git.qemu.org/git/berkeley-testfloat-3.git) registered for path 'tests/fp/berkeley-testfloat-3' Submodule 'ui/keycodemapdb' (https://git.qemu.org/git/keycodemapdb.git) registered for path 'ui/keycodemapdb'
Cloning into 'capstone'...
Submodule path 'capstone': checked out '22ead3e0bfdb87516656453336160e0a37b066bf'
Cloning into 'dtc'...
Submodule path 'dtc': checked out '88f18909db731a627456f26d779445f84e449536'
Cloning into 'roms/QemuMacDrivers'...
Submodule path 'roms/QemuMacDrivers': checked out '90c488d5f4a407342247b9ea869df1c2d9c8e266'
Cloning into 'roms/SLOF'...
Submodule path 'roms/SLOF': checked out 'ba1ab360eebe6338bb8d7d83a9220ccf7e213af3'
Cloning into 'roms/edk2'...
Submodule path 'roms/edk2': checked out '20d2e5a125e34fc8501026613a71549b2a1a3e54'
Submodule 'SoftFloat' (https://github.com/ucb-bar/berkeley-softfloat-3.git) registered for path 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3' Submodule 'CryptoPkg/Library/OpensslLib/openssl' (https://github.com/openssl/openssl) registered for path 'CryptoPkg/Library/OpensslLib/openssl' Cloning into 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3'...
Submodule path 'roms/edk2/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037' Cloning into 'CryptoPkg/Library/OpensslLib/openssl'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl': checked out '50eaac9f3337667259de725451f201e784599687' Submodule 'boringssl' (https://boringssl.googlesource.com/boringssl) registered for path 'boringssl'
Submodule 'krb5' (https://github.com/krb5/krb5) registered for path 'krb5'
Submodule 'pyca.cryptography' (https://github.com/pyca/cryptography.git) registered for path 'pyca-cryptography'
Cloning into 'boringssl'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl': checked out '2070f8ad9151dc8f3a73bffaa146b5e6937a583f' Cloning into 'krb5'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5': checked out 'b9ad6c49505c96a088326b62a52568e3484f2168' Cloning into 'pyca-cryptography'...
Submodule path 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/pyca-cryptography': checked out '09403100de2f6f1cdd0d484dcb8e620f1c335c8f' Cloning into 'roms/ipxe'...
Submodule path 'roms/ipxe': checked out 'de4565cbe76ea9f7913a01f331be3ee901bb6e17'
Cloning into 'roms/openbios'...
Submodule path 'roms/openbios': checked out 'c79e0ecb84f4f1ee3f73f521622e264edd1bf174'
Cloning into 'roms/openhackware'...
Submodule path 'roms/openhackware': checked out 'c559da7c8eec5e45ef1f67978827af6f0b9546f5'
Cloning into 'roms/opensbi'...
Submodule path 'roms/opensbi': checked out 'ce228ee0919deb9957192d723eecc8aaae2697c6'
Cloning into 'roms/qemu-palcode'...
Submodule path 'roms/qemu-palcode': checked out 'bf0e13698872450164fa7040da36a95d2d4b326f'
Cloning into 'roms/seabios'...
Submodule path 'roms/seabios': checked out 'a5cab58e9a3fb6e168aba919c5669bea406573b4'
Cloning into 'roms/seabios-hppa'...
Submodule path 'roms/seabios-hppa': checked out '0f4fe84658165e96ce35870fd19fc634e182e77b'
Cloning into 'roms/sgabios'...
Submodule path 'roms/sgabios': checked out 'cbaee52287e5f32373181cff50a00b6c4ac9015a'
Cloning into 'roms/skiboot'...
Submodule path 'roms/skiboot': checked out '261ca8e779e5138869a45f174caa49be6a274501'
Cloning into 'roms/u-boot'...
Submodule path 'roms/u-boot': checked out 'd3689267f92c5956e09cc7d1baa4700141662bff'
Cloning into 'roms/u-boot-sam460ex'...
Submodule path 'roms/u-boot-sam460ex': checked out '60b3916f33e617a815973c5a6df77055b2e3a588'
Cloning into 'slirp'...
Submodule path 'slirp': checked out '126c04acbabd7ad32c2b018fe10dfac2a3bc1210'
Cloning into 'tests/fp/berkeley-softfloat-3'...
Submodule path 'tests/fp/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037'
Cloning into 'tests/fp/berkeley-testfloat-3'...
Submodule path 'tests/fp/berkeley-testfloat-3': checked out '5a59dcec19327396a011a17fd924aed4fec416b3'
Cloning into 'ui/keycodemapdb'...
Submodule path 'ui/keycodemapdb': checked out '6b3d716e2b6472eb7189d3220552280ef3d832ce'
Switched to a new branch 'test'
70c28bf targets (various): use softfloat-helpers.h where we can
ae30427 target/riscv: rationalise softfloat includes
bdae873 target/mips: rationalise softfloat includes
d671f81 fpu: rename softfloat-specialize.h -> .inc.c
09bf19e fpu: make softfloat-macros "self-contained"
5377596 fpu: move inline helpers into a separate header
7c1124e fpu: remove the LIT64 macro
a1af5f2 target/m68k: replace LIT64 with UINT64_C macros
2d7b9b6 fpu: replace LIT64 with UINT64_C macros
e939c11 fpu: use min/max values from stdint.h for integral overflow
d4b8e9d fpu: optimise float[16/32/64]_squash_denormal (HACK?)
665259f fpu: convert float[16/32/64]_squash_denormal to new modern style
41b39a9 fpu: replace LIT64 usage with UINT64_C for specialize constants
=== OUTPUT BEGIN ===
1/13 Checking commit 41b39a99715c (fpu: replace LIT64 usage with UINT64_C for specialize constants) 2/13 Checking commit 665259f926b4 (fpu: convert float[16/32/64]_squash_denormal to new modern style)
WARNING: Block comments use a leading /* on a separate line
#46: FILE: fpu/softfloat.c:3292:
+/*----------------------------------------------------------------------------
WARNING: Block comments use * on subsequent lines
#47: FILE: fpu/softfloat.c:3293:
+/*---------------------------------------------------------------------------- +| If `a' is denormal and we are in flush-to-zero mode then set the
WARNING: Block comments use a trailing */ on a separate line
#49: FILE: fpu/softfloat.c:3295:
+*----------------------------------------------------------------------------*/
total: 0 errors, 3 warnings, 140 lines checked
Patch 2/13 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/13 Checking commit d4b8e9d8d5ee (fpu: optimise float[16/32/64]_squash_denormal (HACK?)) 4/13 Checking commit e939c11d06ea (fpu: use min/max values from stdint.h for integral overflow) 5/13 Checking commit 2d7b9b6ca83c (fpu: replace LIT64 with UINT64_C macros)
ERROR: space prohibited after that open parenthesis '('
#41: FILE: fpu/softfloat.c:3761:
+ || ( zSig + roundIncrement < UINT64_C(0x8000000000000000) );
ERROR: space prohibited before that close parenthesis ')' #41: FILE: fpu/softfloat.c:3761:
+ || ( zSig + roundIncrement < UINT64_C(0x8000000000000000) );
ERROR: space prohibited after that open parenthesis '(' #76: FILE: fpu/softfloat.c:3960:
+ && ( zSig0 == UINT64_C(0xFFFFFFFFFFFFFFFF) )
ERROR: space prohibited before that close parenthesis ')' #76: FILE: fpu/softfloat.c:3960:
+ && ( zSig0 == UINT64_C(0xFFFFFFFFFFFFFFFF) )
ERROR: space prohibited after that open parenthesis '(' #85: FILE: fpu/softfloat.c:3983:
+ || ( zSig0 < UINT64_C(0xFFFFFFFFFFFFFFFF) );
ERROR: space prohibited before that close parenthesis ')' #85: FILE: fpu/softfloat.c:3983:
+ || ( zSig0 < UINT64_C(0xFFFFFFFFFFFFFFFF) );
ERROR: space prohibited after that open parenthesis '(' #172: FILE: fpu/softfloat.c:5178:
+ if ( aSig & UINT64_C(0x0020000000000000) ) {
ERROR: space prohibited before that close parenthesis ')' #172: FILE: fpu/softfloat.c:5178:
+ if ( aSig & UINT64_C(0x0020000000000000) ) {
ERROR: space prohibited after that open parenthesis '(' #190: FILE: fpu/softfloat.c:5727:
+ packFloatx80( aSign, 0x3FFF, UINT64_C(0x8000000000000000));
WARNING: line over 80 characters
#196: FILE: fpu/softfloat.c:5732:
+ return packFloatx80(aSign, 0x3FFF, UINT64_C(0x8000000000000000));
ERROR: space prohibited after that open parenthesis '(' #203: FILE: fpu/softfloat.c:5738:
+ packFloatx80( 1, 0x3FFF, UINT64_C(0x8000000000000000))
ERROR: space prohibited after that open parenthesis '(' #209: FILE: fpu/softfloat.c:5743:
+ : packFloatx80( 0, 0x3FFF, UINT64_C(0x8000000000000000));
ERROR: space prohibited after that open parenthesis '(' #245: FILE: fpu/softfloat.c:6276:
+ if ( ( zSig1 & UINT64_C(0x3FFFFFFFFFFFFFFF) ) <= 5 ) {
ERROR: space prohibited before that close parenthesis ')' #245: FILE: fpu/softfloat.c:6276:
+ if ( ( zSig1 & UINT64_C(0x3FFFFFFFFFFFFFFF) ) <= 5 ) {
ERROR: space prohibited after that open parenthesis '(' #254: FILE: fpu/softfloat.c:6575:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: space prohibited before that close parenthesis ')' #254: FILE: fpu/softfloat.c:6575:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: trailing statements should be on next line
#254: FILE: fpu/softfloat.c:6575:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: braces {} are necessary for all arms of this statement #254: FILE: fpu/softfloat.c:6575:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
[...]
ERROR: space prohibited after that open parenthesis '(' #272: FILE: fpu/softfloat.c:6653:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: space prohibited before that close parenthesis ')' #272: FILE: fpu/softfloat.c:6653:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: trailing statements should be on next line
#272: FILE: fpu/softfloat.c:6653:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: braces {} are necessary for all arms of this statement #272: FILE: fpu/softfloat.c:6653:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
[...]
ERROR: space prohibited after that open parenthesis '(' #280: FILE: fpu/softfloat.c:6660:
+ && ( aSig1 || ( aSig0 != UINT64_C(0x0001000000000000) ) )
ERROR: space prohibited before that close parenthesis ')' #280: FILE: fpu/softfloat.c:6660:
+ && ( aSig1 || ( aSig0 != UINT64_C(0x0001000000000000) ) )
ERROR: space prohibited after that open parenthesis '(' #289: FILE: fpu/softfloat.c:6697:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: space prohibited before that close parenthesis ')' #289: FILE: fpu/softfloat.c:6697:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: trailing statements should be on next line
#289: FILE: fpu/softfloat.c:6697:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
ERROR: braces {} are necessary for all arms of this statement #289: FILE: fpu/softfloat.c:6697:
+ if ( aExp ) aSig0 |= UINT64_C(0x0001000000000000);
[...]
ERROR: space prohibited after that open parenthesis '(' #297: FILE: fpu/softfloat.c:6702:
+ if ( ( a.high == UINT64_C(0xC03E000000000000) )
ERROR: space prohibited before that close parenthesis ')' #297: FILE: fpu/softfloat.c:6702:
+ if ( ( a.high == UINT64_C(0xC03E000000000000) )
ERROR: space prohibited after that open parenthesis '(' #298: FILE: fpu/softfloat.c:6703:
+ && ( aSig1 < UINT64_C(0x0002000000000000) ) ) {
ERROR: space prohibited before that close parenthesis ')' #298: FILE: fpu/softfloat.c:6703:
+ && ( aSig1 < UINT64_C(0x0002000000000000) ) ) {
ERROR: space prohibited after that open parenthesis '(' #352: FILE: fpu/softfloat.c:7196:
+ if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;
ERROR: space prohibited before that close parenthesis ')' #352: FILE: fpu/softfloat.c:7196:
+ if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;
ERROR: trailing statements should be on next line
#352: FILE: fpu/softfloat.c:7196:
+ if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;
ERROR: braces {} are necessary for all arms of this statement #352: FILE: fpu/softfloat.c:7196:
+ if ( zSig0 < UINT64_C(0x0002000000000000) ) goto roundAndPack;
[...]
ERROR: space prohibited after that open parenthesis '(' #393: FILE: fpu/softfloat.c:7390:
+ if (UINT64_C( 0x0002000000000000) <= zSig0 ) {
ERROR: space prohibited before that close parenthesis ')' #393: FILE: fpu/softfloat.c:7390:
+ if (UINT64_C( 0x0002000000000000) <= zSig0 ) {
ERROR: space prohibited before that close parenthesis ')' #402: FILE: fpu/softfloat.c:7457:
+ aSig0 | UINT64_C(0x0001000000000000), aSig1, 15, &aSig0, &aSig1 );
ERROR: space prohibited before that close parenthesis ')' #405: FILE: fpu/softfloat.c:7459:
+ bSig0 | UINT64_C(0x0001000000000000), bSig1, 15, &bSig0, &bSig1 );
ERROR: space prohibited before that close parenthesis ')' #422: FILE: fpu/softfloat.c:7542:
+ bSig0 | UINT64_C(0x0001000000000000), bSig1, 15, &bSig0, &bSig1 );
ERROR: space prohibited after that open parenthesis '(' #453: FILE: include/fpu/softfloat-macros.h:619:
+ if ( b <= a0 ) return UINT64_C(0xFFFFFFFFFFFFFFFF);
ERROR: space prohibited before that close parenthesis ')' #453: FILE: include/fpu/softfloat-macros.h:619:
+ if ( b <= a0 ) return UINT64_C(0xFFFFFFFFFFFFFFFF);
ERROR: trailing statements should be on next line
#453: FILE: include/fpu/softfloat-macros.h:619:
+ if ( b <= a0 ) return UINT64_C(0xFFFFFFFFFFFFFFFF);
ERROR: braces {} are necessary for all arms of this statement #453: FILE: include/fpu/softfloat-macros.h:619:
+ if ( b <= a0 ) return UINT64_C(0xFFFFFFFFFFFFFFFF);
[...]
ERROR: spaces required around that '<<' (ctx:VxV)
#456: FILE: include/fpu/softfloat-macros.h:621:
+ z = ( b0<<32 <= a0 ) ? UINT64_C(0xFFFFFFFF00000000) : ( a0 / b0 )<<32;
^ERROR: spaces required around that '<<' (ctx:VxV)
#456: FILE: include/fpu/softfloat-macros.h:621:
+ z = ( b0<<32 <= a0 ) ? UINT64_C(0xFFFFFFFF00000000) : ( a0 / b0 )<<32;
^ERROR: space prohibited after that open parenthesis '(' #456: FILE: include/fpu/softfloat-macros.h:621:
+ z = ( b0<<32 <= a0 ) ? UINT64_C(0xFFFFFFFF00000000) : ( a0 / b0 )<<32;
ERROR: space prohibited before that close parenthesis ')' #456: FILE: include/fpu/softfloat-macros.h:621:
+ z = ( b0<<32 <= a0 ) ? UINT64_C(0xFFFFFFFF00000000) : ( a0 / b0 )<<32;
total: 48 errors, 1 warnings, 405 lines checked
Patch 5/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
6/13 Checking commit a1af5f2bd817 (target/m68k: replace LIT64 with UINT64_C macros)
WARNING: line over 80 characters
#49: FILE: target/m68k/softfloat.c:376:
+ fSig = (aSig & UINT64_C(0xFE00000000000000)) | UINT64_C(0x0100000000000000);
WARNING: line over 80 characters
#67: FILE: target/m68k/softfloat.c:434:
+ fSig = (aSig & UINT64_C(0xFE00000000000000)) | UINT64_C(0x0100000000000000);
WARNING: line over 80 characters
#76: FILE: target/m68k/softfloat.c:565:
+ fSig = (aSig & UINT64_C(0xFE00000000000000)) | UINT64_C(0x0100000000000000);
WARNING: line over 80 characters
#103: FILE: target/m68k/softfloat.c:781:
+ fp1 = packFloatx80(0, 0x3FFF, UINT64_C(0xB8AA3B295C17F0BC)); /* INV_L2 */
WARNING: line over 80 characters
#158: FILE: target/m68k/softfloat.c:1353:
+ UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
WARNING: line over 80 characters
#227: FILE: target/m68k/softfloat.c:1563:
+ UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
WARNING: line over 80 characters
#280: FILE: target/m68k/softfloat.c:1802:
+ UINT64_C(0xA2F9836E4E44152A)); /* INVTWOPI */
total: 0 errors, 7 warnings, 298 lines checked
Patch 6/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
7/13 Checking commit 7c1124e1cfdf (fpu: remove the LIT64 macro)
8/13 Checking commit 53775963b2da (fpu: move inline helpers into a separate header)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #19:
new file mode 100644
WARNING: Block comments use * on subsequent lines
#46: FILE: include/fpu/softfloat-helpers.h:23:
+/*
+===============================================================================
total: 0 errors, 2 warnings, 201 lines checked
Patch 8/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
9/13 Checking commit 09bf19e0c651 (fpu: make softfloat-macros "self-contained") 10/13 Checking commit d671f81e85cc (fpu: rename softfloat-specialize.h -> .inc.c)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #19:
rename from fpu/softfloat-specialize.h
total: 0 errors, 1 warnings, 8 lines checked
Patch 10/13 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/13 Checking commit bdae8730537e (target/mips: rationalise softfloat includes) 12/13 Checking commit ae304271ae4d (target/riscv: rationalise softfloat includes) 13/13 Checking commit 70c28bf97b42 (targets (various): use softfloat-helpers.h where we can) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Quoted 16 lines · Alex Bennée
Hi,
Another iteration of updates for softfloat. Instead of moving the
LIT64()macro from one file to another we convert the uses to thestdint.hmacro. I did eliminate one of the uses by converting thesquash_input_denormalfunctions to the new style code. However as you can see with the follow-up patch it bloated the code a little. I'd like to convert the x80 and 128bit FP functions to the new style but the challenge is seeing how we can get greater re-use of the common functions without bloating the generated code. However if we can do that we should eliminate a class of bugs in the current code.There are a bunch of minor checkpatch complaints as all touched lines haven't been fully converted to the proper brace style but I avoided do that to make the patch more readable.
Quoted 8 lines
The following patches need review:
01 - fpu replace LIT64 usage withUINT64_Cfor special 02 - fpu convert float 16 32 64_squash_denormalto ne 03 - fpu optimise float 16 32 64_squash_denormalHACK 04 - fpu use min max values fromstdint.hfor integral 05 - fpu replace LIT64 withUINT64_Cmacros 06 - target m68k replace LIT64 withUINT64_Cmacros 07 - fpu remove the LIT64 macro
Richard had comments on PATCH 02+03. Should I expect v4?
I'm asking because my '[PATCH v4 00/29] Tame a few "touch this, recompile the world" headers' is ready, and I want to post the pull request before it goes stale. If this series is also ready, I can do both together. Else, it'll needs a rebase onto mine (one conflict, resolving it necessitates a commit message update).
Quoted 27 lines · Markus Armbruster
Quoted 16 lines · Alex Bennée
Hi,
Another iteration of updates for softfloat. Instead of moving the
LIT64()macro from one file to another we convert the uses to thestdint.hmacro. I did eliminate one of the uses by converting thesquash_input_denormalfunctions to the new style code. However as you can see with the follow-up patch it bloated the code a little. I'd like to convert the x80 and 128bit FP functions to the new style but the challenge is seeing how we can get greater re-use of the common functions without bloating the generated code. However if we can do that we should eliminate a class of bugs in the current code.There are a bunch of minor checkpatch complaints as all touched lines haven't been fully converted to the proper brace style but I avoided do that to make the patch more readable.
Quoted 8 lines
The following patches need review:
01 - fpu replace LIT64 usage withUINT64_Cfor special 02 - fpu convert float 16 32 64_squash_denormalto ne 03 - fpu optimise float 16 32 64_squash_denormalHACK 04 - fpu use min max values fromstdint.hfor integral 05 - fpu replace LIT64 withUINT64_Cmacros 06 - target m68k replace LIT64 withUINT64_Cmacros 07 - fpu remove the LIT64 macro
Quoted 1 line
Richard had comments on PATCH 02+03. Should I expect v4?
There will be....
Quoted 5 lines
I'm asking because my '[PATCH v4 00/29] Tame a few "touch this, recompile the world" headers' is ready, and I want to post the pull request before it goes stale. If this series is also ready, I can do both together. Else, it'll needs a rebase onto mine (one conflict, resolving it necessitates a commit message update).
Go ahead - I'll fixup when I rebase.
--
Alex Bennée