[Qemu-devel] [PATCH 0/4] softfloat: fix some helper definitions

Laurent Vivier posted 4 patches 6 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20171103202624.5956-1-laurent@vivier.eu
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
fpu/softfloat.c              |  8 +++----
target/arm/helper-a64.h      |  6 ++---
target/openrisc/fpu_helper.c | 52 ++++++++++++++++++++++----------------------
target/openrisc/helper.h     | 20 ++++++++---------
target/tricore/fpu_helper.c  | 34 ++++++++++++++---------------
5 files changed, 60 insertions(+), 60 deletions(-)
[Qemu-devel] [PATCH 0/4] softfloat: fix some helper definitions
Posted by Laurent Vivier 6 years, 5 months ago
This series fixes some errors found by
enabling USE_SOFTFLOAT_STRUCT_TYPES.

Most of them are helpers using int types
instead of float types.
This also requires the use of floatXX_val()
and make_floatXX().

Laurent Vivier (4):
  arm: fix float64 helper definitions
  openrisc: fix float32 and float64 helper definitions
  tricore: use make_float32() and float32_val()
  softfloat: use floatXX_val() in XX_minmax()

 fpu/softfloat.c              |  8 +++----
 target/arm/helper-a64.h      |  6 ++---
 target/openrisc/fpu_helper.c | 52 ++++++++++++++++++++++----------------------
 target/openrisc/helper.h     | 20 ++++++++---------
 target/tricore/fpu_helper.c  | 34 ++++++++++++++---------------
 5 files changed, 60 insertions(+), 60 deletions(-)

-- 
2.13.6


Re: [Qemu-devel] [Qemu-arm] [PATCH 0/4] softfloat: fix some helper definitions
Posted by Philippe Mathieu-Daudé 6 years, 5 months ago
Hi Laurent,

On 11/03/2017 05:26 PM, Laurent Vivier wrote:
> This series fixes some errors found by
> enabling USE_SOFTFLOAT_STRUCT_TYPES.
> 
> Most of them are helpers using int types
> instead of float types.
> This also requires the use of floatXX_val()
> and make_floatXX().
> 
> Laurent Vivier (4):
>   arm: fix float64 helper definitions
>   openrisc: fix float32 and float64 helper definitions
>   tricore: use make_float32() and float32_val()
>   softfloat: use floatXX_val() in XX_minmax()
> 
>  fpu/softfloat.c              |  8 +++----
>  target/arm/helper-a64.h      |  6 ++---
>  target/openrisc/fpu_helper.c | 52 ++++++++++++++++++++++----------------------
>  target/openrisc/helper.h     | 20 ++++++++---------
>  target/tricore/fpu_helper.c  | 34 ++++++++++++++---------------
>  5 files changed, 60 insertions(+), 60 deletions(-)
> 

I'm getting those errors:

$ make subdir-arm-softmmu -j2

/source/qemu/migration/vmstate-types.c:430:5: error: conversion to
non-scalar type requested
     qemu_put_be64(f, float64_val(*v));
     ^~~~~~~~~~~~~
make: *** [migration/vmstate-types.o] Error 1

In file included from /source/qemu/fpu/softfloat.c:87:0:
/source/qemu/fpu/softfloat-specialize.h: In function ‘float16_default_nan’:
/source/qemu/include/fpu/softfloat.h:117:26: error: expected expression
before ‘{’ token
 #define const_float16(x) { x }
                          ^
/source/qemu/fpu/softfloat-specialize.h:95:12: note: in expansion of
macro ‘const_float16’
     return const_float16(0x7E00);
            ^~~~~~~~~~~~~
make: *** [fpu/softfloat.o] Error 1

Re: [Qemu-devel] [Qemu-arm] [PATCH 0/4] softfloat: fix some helper definitions
Posted by Philippe Mathieu-Daudé 6 years, 5 months ago
> On 11/03/2017 05:26 PM, Laurent Vivier wrote:
>> This series fixes some errors found by
>> enabling USE_SOFTFLOAT_STRUCT_TYPES.
[...]
>
> I'm getting those errors:
> 
> $ make subdir-arm-softmmu -j2
> 
> /source/qemu/migration/vmstate-types.c:430:5: error: conversion to
> non-scalar type requested
>      qemu_put_be64(f, float64_val(*v));
>      ^~~~~~~~~~~~~
> make: *** [migration/vmstate-types.o] Error 1
> 
> In file included from /source/qemu/fpu/softfloat.c:87:0:
> /source/qemu/fpu/softfloat-specialize.h: In function ‘float16_default_nan’:
> /source/qemu/include/fpu/softfloat.h:117:26: error: expected expression
> before ‘{’ token
>  #define const_float16(x) { x }
>                           ^
> /source/qemu/fpu/softfloat-specialize.h:95:12: note: in expansion of
> macro ‘const_float16’
>      return const_float16(0x7E00);
>             ^~~~~~~~~~~~~
> make: *** [fpu/softfloat.o] Error 1
> 

Also:

$ make subdir-armeb-linux-user -j2

  CC      linux-user/signal.o
In file included from /source/qemu/linux-user/signal.c:24:0:
/source/qemu/linux-user/signal.c: In function ‘restore_sigframe_v2_vfp’:
/source/qemu/linux-user/qemu.h:472:8: error: lvalue required as left
operand of assignment
   ((x) = (typeof(*hptr))(                                             \
        ^
/source/qemu/linux-user/qemu.h:481:31: note: in expansion of macro
‘__get_user_e’
 # define __get_user(x, hptr)  __get_user_e(x, hptr, be)
                               ^~~~~~~~~~~~
/source/qemu/linux-user/signal.c:2209:9: note: in expansion of macro
‘__get_user’
         __get_user(float64_val(env->vfp.regs[i]),
&vfpframe->ufp.fpregs[i]);
         ^~~~~~~~~~
/source/qemu/linux-user/qemu.h:477:13: error: left-hand operand of comma
expression has no effect [-Werror=unused-value]
      (hptr)), (void)0)
             ^
/source/qemu/linux-user/qemu.h:481:31: note: in expansion of macro
‘__get_user_e’
 # define __get_user(x, hptr)  __get_user_e(x, hptr, be)
                               ^~~~~~~~~~~~
/source/qemu/linux-user/signal.c:2209:9: note: in expansion of macro
‘__get_user’
         __get_user(float64_val(env->vfp.regs[i]),
&vfpframe->ufp.fpregs[i]);
         ^~~~~~~~~~
cc1: all warnings being treated as errors
/source/qemu/rules.mak:66: recipe for target 'linux-user/signal.o' failed

  CC      linux-user/arm/nwfpe/fpa11_cpdt.o
...
/source/qemu/linux-user/arm/nwfpe/fpa11_cpdt.c:37:4: note: in expansion
of macro ‘get_user_u32’
    get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
    ^~~~~~~~~~~~
/source/qemu/linux-user/qemu.h:515:13: error: lvalue required as left
operand of assignment
         (x) = 0;       \
             ^
/source/qemu/linux-user/qemu.h:536:32: note: in expansion of macro
‘get_user’
 #define get_user_u32(x, gaddr) get_user((x), (gaddr), uint32_t)
                                ^~~~~~~~
/source/qemu/linux-user/arm/nwfpe/fpa11_cpdt.c:37:4: note: in expansion
of macro ‘get_user_u32’
    get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
    ^~~~~~~~~~~~

Re: [Qemu-devel] [Qemu-arm] [PATCH 0/4] softfloat: fix some helper definitions
Posted by Laurent Vivier 6 years, 5 months ago
Le 03/11/2017 à 22:51, Philippe Mathieu-Daudé a écrit :
>> On 11/03/2017 05:26 PM, Laurent Vivier wrote:
>>> This series fixes some errors found by
>>> enabling USE_SOFTFLOAT_STRUCT_TYPES.
> [...]
>>
>> I'm getting those errors:
>>
>> $ make subdir-arm-softmmu -j2
>>
>> /source/qemu/migration/vmstate-types.c:430:5: error: conversion to
>> non-scalar type requested
>>      qemu_put_be64(f, float64_val(*v));
>>      ^~~~~~~~~~~~~
>> make: *** [migration/vmstate-types.o] Error 1
>>
>> In file included from /source/qemu/fpu/softfloat.c:87:0:
>> /source/qemu/fpu/softfloat-specialize.h: In function ‘float16_default_nan’:
>> /source/qemu/include/fpu/softfloat.h:117:26: error: expected expression
>> before ‘{’ token
>>  #define const_float16(x) { x }
>>                           ^
>> /source/qemu/fpu/softfloat-specialize.h:95:12: note: in expansion of
>> macro ‘const_float16’
>>      return const_float16(0x7E00);
>>             ^~~~~~~~~~~~~
>> make: *** [fpu/softfloat.o] Error 1
>>
> 
> Also:
> 
> $ make subdir-armeb-linux-user -j2
> 
>   CC      linux-user/signal.o
> In file included from /source/qemu/linux-user/signal.c:24:0:
> /source/qemu/linux-user/signal.c: In function ‘restore_sigframe_v2_vfp’:
> /source/qemu/linux-user/qemu.h:472:8: error: lvalue required as left
> operand of assignment
>    ((x) = (typeof(*hptr))(                                             \
>         ^
> /source/qemu/linux-user/qemu.h:481:31: note: in expansion of macro
> ‘__get_user_e’
>  # define __get_user(x, hptr)  __get_user_e(x, hptr, be)
>                                ^~~~~~~~~~~~
> /source/qemu/linux-user/signal.c:2209:9: note: in expansion of macro
> ‘__get_user’
>          __get_user(float64_val(env->vfp.regs[i]),
> &vfpframe->ufp.fpregs[i]);
>          ^~~~~~~~~~
> /source/qemu/linux-user/qemu.h:477:13: error: left-hand operand of comma
> expression has no effect [-Werror=unused-value]
>       (hptr)), (void)0)
>              ^
> /source/qemu/linux-user/qemu.h:481:31: note: in expansion of macro
> ‘__get_user_e’
>  # define __get_user(x, hptr)  __get_user_e(x, hptr, be)
>                                ^~~~~~~~~~~~
> /source/qemu/linux-user/signal.c:2209:9: note: in expansion of macro
> ‘__get_user’
>          __get_user(float64_val(env->vfp.regs[i]),
> &vfpframe->ufp.fpregs[i]);
>          ^~~~~~~~~~
> cc1: all warnings being treated as errors
> /source/qemu/rules.mak:66: recipe for target 'linux-user/signal.o' failed
> 
>   CC      linux-user/arm/nwfpe/fpa11_cpdt.o
> ...
> /source/qemu/linux-user/arm/nwfpe/fpa11_cpdt.c:37:4: note: in expansion
> of macro ‘get_user_u32’
>     get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
>     ^~~~~~~~~~~~
> /source/qemu/linux-user/qemu.h:515:13: error: lvalue required as left
> operand of assignment
>          (x) = 0;       \
>              ^
> /source/qemu/linux-user/qemu.h:536:32: note: in expansion of macro
> ‘get_user’
>  #define get_user_u32(x, gaddr) get_user((x), (gaddr), uint32_t)
>                                 ^~~~~~~~
> /source/qemu/linux-user/arm/nwfpe/fpa11_cpdt.c:37:4: note: in expansion
> of macro ‘get_user_u32’
>     get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
>     ^~~~~~~~~~~~
> 

These series doesn't fix all the problems, only the easiest to fix...

for this one, you need:

diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
index 48184c380d..0c273d616a 100644
--- a/migration/vmstate-types.c
+++ b/migration/vmstate-types.c
@@ -425,7 +425,7 @@ static int get_float64(QEMUFile *f, void *pv, size_t
size,
 static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField
*field,
                        QJSON *vmdesc)
 {
-    uint64_t *v = pv;
+    float64 *v = pv;

     qemu_put_be64(f, float64_val(*v));
     return 0;

Thanks,
Laurent

Re: [Qemu-devel] [Qemu-arm] [PATCH 0/4] softfloat: fix some helper definitions
Posted by Philippe Mathieu-Daudé 6 years, 5 months ago
On 11/04/2017 05:55 AM, Laurent Vivier wrote:
> Le 03/11/2017 à 22:51, Philippe Mathieu-Daudé a écrit :
>>> On 11/03/2017 05:26 PM, Laurent Vivier wrote:
>>>> This series fixes some errors found by
>>>> enabling USE_SOFTFLOAT_STRUCT_TYPES.
>> [...]
>>>
>>> I'm getting those errors:
>>>
>>> $ make subdir-arm-softmmu -j2
>>>
>>> /source/qemu/migration/vmstate-types.c:430:5: error: conversion to
>>> non-scalar type requested
>>>      qemu_put_be64(f, float64_val(*v));
>>>      ^~~~~~~~~~~~~
>>> make: *** [migration/vmstate-types.o] Error 1
[...]
> 
> These series doesn't fix all the problems, only the easiest to fix...
> 
> for this one, you need:
> 
> diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
> index 48184c380d..0c273d616a 100644
> --- a/migration/vmstate-types.c
> +++ b/migration/vmstate-types.c
> @@ -425,7 +425,7 @@ static int get_float64(QEMUFile *f, void *pv, size_t
> size,
>  static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField
> *field,
>                         QJSON *vmdesc)
>  {
> -    uint64_t *v = pv;
> +    float64 *v = pv;
> 
>      qemu_put_be64(f, float64_val(*v));
>      return 0;

If you respin with this one you can add my Reviewed-by + Tested-by.

Another error:

$ make subdir-aarch64-softmmu
[...]
  CC      target/arm/helper-a64.o
/source/qemu/target/arm/helper-a64.c: In function ‘helper_simd_tbl’:
/source/qemu/target/arm/helper-a64.c:162:38: error: incompatible type
for argument 1 of ‘extract64’
             uint64_t val = extract64(env->vfp.regs[elt], bitidx, 8);
                                      ^~~
In file included from /source/qemu/include/qemu/bitmap.h:16:0,
                 from /source/qemu/include/hw/qdev-core.h:6,
                 from /source/qemu/include/qom/cpu.h:23,
                 from /source/qemu/target/arm/cpu-qom.h:23,
                 from /source/qemu/target/arm/cpu.h:39,
                 from /source/qemu/target/arm/helper-a64.c:21:
/source/qemu/include/qemu/bitops.h:316:24: note: expected ‘uint64_t {aka
long unsigned int}’ but argument is of type ‘float64 {aka struct
<anonymous>}’
 static inline uint64_t extract64(uint64_t value, int start, int length)
                        ^~~~~~~~~
make: *** [target/arm/helper-a64.o] Error 1

Re: [Qemu-devel] [Qemu-arm] [PATCH 0/4] softfloat: fix some helper definitions
Posted by Philippe Mathieu-Daudé 6 years, 5 months ago
On 11/04/2017 01:18 PM, Philippe Mathieu-Daudé wrote:
> On 11/04/2017 05:55 AM, Laurent Vivier wrote:
>> Le 03/11/2017 à 22:51, Philippe Mathieu-Daudé a écrit :
>>>> On 11/03/2017 05:26 PM, Laurent Vivier wrote:
>>>>> This series fixes some errors found by
>>>>> enabling USE_SOFTFLOAT_STRUCT_TYPES.
>>> [...]
>>>>
>>>> I'm getting those errors:
>>>>
>>>> $ make subdir-arm-softmmu -j2
>>>>
>>>> /source/qemu/migration/vmstate-types.c:430:5: error: conversion to
>>>> non-scalar type requested
>>>>      qemu_put_be64(f, float64_val(*v));
>>>>      ^~~~~~~~~~~~~
>>>> make: *** [migration/vmstate-types.o] Error 1
> [...]
>>
>> These series doesn't fix all the problems, only the easiest to fix...
>>
>> for this one, you need:
>>
>> diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
>> index 48184c380d..0c273d616a 100644
>> --- a/migration/vmstate-types.c
>> +++ b/migration/vmstate-types.c
>> @@ -425,7 +425,7 @@ static int get_float64(QEMUFile *f, void *pv, size_t
>> size,
>>  static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField
>> *field,
>>                         QJSON *vmdesc)
>>  {
>> -    uint64_t *v = pv;
>> +    float64 *v = pv;
>>
>>      qemu_put_be64(f, float64_val(*v));
>>      return 0;
> 
> If you respin with this one you can add my Reviewed-by + Tested-by.
> 
> Another error:
> 
> $ make subdir-aarch64-softmmu
> [...]
>   CC      target/arm/helper-a64.o
> /source/qemu/target/arm/helper-a64.c: In function ‘helper_simd_tbl’:
> /source/qemu/target/arm/helper-a64.c:162:38: error: incompatible type
> for argument 1 of ‘extract64’
>              uint64_t val = extract64(env->vfp.regs[elt], bitidx, 8);
>                                       ^~~
> In file included from /source/qemu/include/qemu/bitmap.h:16:0,
>                  from /source/qemu/include/hw/qdev-core.h:6,
>                  from /source/qemu/include/qom/cpu.h:23,
>                  from /source/qemu/target/arm/cpu-qom.h:23,
>                  from /source/qemu/target/arm/cpu.h:39,
>                  from /source/qemu/target/arm/helper-a64.c:21:
> /source/qemu/include/qemu/bitops.h:316:24: note: expected ‘uint64_t {aka
> long unsigned int}’ but argument is of type ‘float64 {aka struct
> <anonymous>}’
>  static inline uint64_t extract64(uint64_t value, int start, int length)
>                         ^~~~~~~~~
> make: *** [target/arm/helper-a64.o] Error 1

OK with:

- uint64_t val = extract64(env->vfp.regs[elt], bitidx, 8);
+ uint64_t val = extract64(float64_val(env->vfp.regs[elt]), bitidx, 8);