[Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem

Alex Bennée posted 46 patches 7 years, 6 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem
Posted by Alex Bennée 7 years, 6 months ago
Remove dependencies on QEMU's source tree and build directly.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/tcg/i386/test-i386-fprem.c b/tests/tcg/i386/test-i386-fprem.c
index 1a71623204..66f5a9657d 100644
--- a/tests/tcg/i386/test-i386-fprem.c
+++ b/tests/tcg/i386/test-i386-fprem.c
@@ -23,7 +23,10 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "qemu/osdep.h"
+#include <stdio.h>
+#include <stdint.h>
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /*
  * Inspired by <ieee754.h>'s union ieee854_long_double, but with single
@@ -39,7 +42,7 @@ union float80u {
         unsigned int exponent:15;
         unsigned int negative:1;
         unsigned int empty:16;
-    } QEMU_PACKED ieee;
+    } __attribute__((packed)) ieee;
 
     /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
     struct {
@@ -49,7 +52,7 @@ union float80u {
         unsigned int exponent:15;
         unsigned int negative:1;
         unsigned int empty:16;
-    } QEMU_PACKED ieee_nan;
+    } __attribute__((packed)) ieee_nan;
 };
 
 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
@@ -229,6 +232,7 @@ static void test_fprem_cases(void)
     do_fprem_stack_underflow();
 
     printf("= invalid operation =\n");
+    do_fprem(q_nan.d, 1.0);
     do_fprem(s_nan.d, 1.0);
     do_fprem(1.0, 0.0);
     do_fprem(pos_inf.d, 1.0);
@@ -238,6 +242,8 @@ static void test_fprem_cases(void)
     do_fprem(pos_denorm.d, 1.0);
     do_fprem(1.0, pos_denorm.d);
 
+    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);
+
     /* printf("= underflow =\n"); */
     /* TODO: Is there a case where FPREM raises underflow? */
 }
-- 
2.17.0


Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem
Posted by Richard Henderson 7 years, 6 months ago
On 04/24/2018 05:23 AM, Alex Bennée wrote:
> Remove dependencies on QEMU's source tree and build directly.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem
Posted by Thomas Huth 7 years, 6 months ago
On 24.04.2018 17:23, Alex Bennée wrote:
> Remove dependencies on QEMU's source tree and build directly.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/tcg/i386/test-i386-fprem.c b/tests/tcg/i386/test-i386-fprem.c
> index 1a71623204..66f5a9657d 100644
> --- a/tests/tcg/i386/test-i386-fprem.c
> +++ b/tests/tcg/i386/test-i386-fprem.c
> @@ -23,7 +23,10 @@
>   *  along with this program; if not, see <http://www.gnu.org/licenses/>.
>   */
>  
> -#include "qemu/osdep.h"
> +#include <stdio.h>
> +#include <stdint.h>
> +
> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>  
>  /*
>   * Inspired by <ieee754.h>'s union ieee854_long_double, but with single
> @@ -39,7 +42,7 @@ union float80u {
>          unsigned int exponent:15;
>          unsigned int negative:1;
>          unsigned int empty:16;
> -    } QEMU_PACKED ieee;
> +    } __attribute__((packed)) ieee;
>  
>      /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
>      struct {
> @@ -49,7 +52,7 @@ union float80u {
>          unsigned int exponent:15;
>          unsigned int negative:1;
>          unsigned int empty:16;
> -    } QEMU_PACKED ieee_nan;
> +    } __attribute__((packed)) ieee_nan;
>  };
>  
>  #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
> @@ -229,6 +232,7 @@ static void test_fprem_cases(void)
>      do_fprem_stack_underflow();
>  
>      printf("= invalid operation =\n");
> +    do_fprem(q_nan.d, 1.0);
>      do_fprem(s_nan.d, 1.0);
>      do_fprem(1.0, 0.0);
>      do_fprem(pos_inf.d, 1.0);
> @@ -238,6 +242,8 @@ static void test_fprem_cases(void)
>      do_fprem(pos_denorm.d, 1.0);
>      do_fprem(1.0, pos_denorm.d);
>  
> +    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);

How's that change related to the patch description? ... i.e. maybe you
should mention these changes in the patch description, too?

Apart from that:

Reviewed-by: Thomas Huth <thuth@redhat.com>

Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem
Posted by Alex Bennée 7 years, 6 months ago
Thomas Huth <thuth@redhat.com> writes:

> On 24.04.2018 17:23, Alex Bennée wrote:
>> Remove dependencies on QEMU's source tree and build directly.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/tcg/i386/test-i386-fprem.c b/tests/tcg/i386/test-i386-fprem.c
>> index 1a71623204..66f5a9657d 100644
>> --- a/tests/tcg/i386/test-i386-fprem.c
>> +++ b/tests/tcg/i386/test-i386-fprem.c
>> @@ -23,7 +23,10 @@
>>   *  along with this program; if not, see <http://www.gnu.org/licenses/>.
>>   */
>>
>> -#include "qemu/osdep.h"
>> +#include <stdio.h>
>> +#include <stdint.h>
>> +
>> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>>
>>  /*
>>   * Inspired by <ieee754.h>'s union ieee854_long_double, but with single
>> @@ -39,7 +42,7 @@ union float80u {
>>          unsigned int exponent:15;
>>          unsigned int negative:1;
>>          unsigned int empty:16;
>> -    } QEMU_PACKED ieee;
>> +    } __attribute__((packed)) ieee;
>>
>>      /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
>>      struct {
>> @@ -49,7 +52,7 @@ union float80u {
>>          unsigned int exponent:15;
>>          unsigned int negative:1;
>>          unsigned int empty:16;
>> -    } QEMU_PACKED ieee_nan;
>> +    } __attribute__((packed)) ieee_nan;
>>  };
>>
>>  #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
>> @@ -229,6 +232,7 @@ static void test_fprem_cases(void)
>>      do_fprem_stack_underflow();
>>
>>      printf("= invalid operation =\n");
>> +    do_fprem(q_nan.d, 1.0);
>>      do_fprem(s_nan.d, 1.0);
>>      do_fprem(1.0, 0.0);
>>      do_fprem(pos_inf.d, 1.0);
>> @@ -238,6 +242,8 @@ static void test_fprem_cases(void)
>>      do_fprem(pos_denorm.d, 1.0);
>>      do_fprem(1.0, pos_denorm.d);
>>
>> +    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);
>
> How's that change related to the patch description? ... i.e. maybe you
> should mention these changes in the patch description, too?

Yeah I'll fix that up - they got added to stop the compiler bithing
about un-used things.

>
> Apart from that:
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>


--
Alex Bennée

Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem
Posted by Philippe Mathieu-Daudé 7 years, 6 months ago
On 04/24/2018 12:23 PM, Alex Bennée wrote:
> Remove dependencies on QEMU's source tree and build directly.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/tcg/i386/test-i386-fprem.c b/tests/tcg/i386/test-i386-fprem.c
> index 1a71623204..66f5a9657d 100644
> --- a/tests/tcg/i386/test-i386-fprem.c
> +++ b/tests/tcg/i386/test-i386-fprem.c
> @@ -23,7 +23,10 @@
>   *  along with this program; if not, see <http://www.gnu.org/licenses/>.
>   */
>  
> -#include "qemu/osdep.h"
> +#include <stdio.h>
> +#include <stdint.h>
> +
> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>  
>  /*
>   * Inspired by <ieee754.h>'s union ieee854_long_double, but with single
> @@ -39,7 +42,7 @@ union float80u {
>          unsigned int exponent:15;
>          unsigned int negative:1;
>          unsigned int empty:16;
> -    } QEMU_PACKED ieee;
> +    } __attribute__((packed)) ieee;
>  
>      /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
>      struct {
> @@ -49,7 +52,7 @@ union float80u {
>          unsigned int exponent:15;
>          unsigned int negative:1;
>          unsigned int empty:16;
> -    } QEMU_PACKED ieee_nan;
> +    } __attribute__((packed)) ieee_nan;
>  };
>  
>  #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
> @@ -229,6 +232,7 @@ static void test_fprem_cases(void)
>      do_fprem_stack_underflow();
>  
>      printf("= invalid operation =\n");
> +    do_fprem(q_nan.d, 1.0);
>      do_fprem(s_nan.d, 1.0);
>      do_fprem(1.0, 0.0);
>      do_fprem(pos_inf.d, 1.0);
> @@ -238,6 +242,8 @@ static void test_fprem_cases(void)
>      do_fprem(pos_denorm.d, 1.0);
>      do_fprem(1.0, pos_denorm.d);
>  
> +    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);
> +
>      /* printf("= underflow =\n"); */
>      /* TODO: Is there a case where FPREM raises underflow? */
>  }
> 

This test is disabled in tests/tcg/i386/Makefile.target and it would be
nice to be able to run it without having to modify the Makefile, like
running "make SLOW=1" or "SPEED=slow" like for iotests maybe?

This test is too verbose and I wonder if we should redirect stdout to
/dev/null even for V=1.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Enabled via tcg/i386/Makefile.target:
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Re: [Qemu-devel] [PATCH v3 21/46] tests/tcg/i386: fix test-i386-fprem
Posted by Alex Bennée 7 years, 6 months ago
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> On 04/24/2018 12:23 PM, Alex Bennée wrote:
>> Remove dependencies on QEMU's source tree and build directly.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  tests/tcg/i386/test-i386-fprem.c | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/tcg/i386/test-i386-fprem.c b/tests/tcg/i386/test-i386-fprem.c
>> index 1a71623204..66f5a9657d 100644
>> --- a/tests/tcg/i386/test-i386-fprem.c
>> +++ b/tests/tcg/i386/test-i386-fprem.c
>> @@ -23,7 +23,10 @@
>>   *  along with this program; if not, see <http://www.gnu.org/licenses/>.
>>   */
>>
>> -#include "qemu/osdep.h"
>> +#include <stdio.h>
>> +#include <stdint.h>
>> +
>> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>>
>>  /*
>>   * Inspired by <ieee754.h>'s union ieee854_long_double, but with single
>> @@ -39,7 +42,7 @@ union float80u {
>>          unsigned int exponent:15;
>>          unsigned int negative:1;
>>          unsigned int empty:16;
>> -    } QEMU_PACKED ieee;
>> +    } __attribute__((packed)) ieee;
>>
>>      /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
>>      struct {
>> @@ -49,7 +52,7 @@ union float80u {
>>          unsigned int exponent:15;
>>          unsigned int negative:1;
>>          unsigned int empty:16;
>> -    } QEMU_PACKED ieee_nan;
>> +    } __attribute__((packed)) ieee_nan;
>>  };
>>
>>  #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
>> @@ -229,6 +232,7 @@ static void test_fprem_cases(void)
>>      do_fprem_stack_underflow();
>>
>>      printf("= invalid operation =\n");
>> +    do_fprem(q_nan.d, 1.0);
>>      do_fprem(s_nan.d, 1.0);
>>      do_fprem(1.0, 0.0);
>>      do_fprem(pos_inf.d, 1.0);
>> @@ -238,6 +242,8 @@ static void test_fprem_cases(void)
>>      do_fprem(pos_denorm.d, 1.0);
>>      do_fprem(1.0, pos_denorm.d);
>>
>> +    do_fprem(smallest_positive_norm.d, smallest_positive_norm.d);
>> +
>>      /* printf("= underflow =\n"); */
>>      /* TODO: Is there a case where FPREM raises underflow? */
>>  }
>>
>
> This test is disabled in tests/tcg/i386/Makefile.target and it would be
> nice to be able to run it without having to modify the Makefile, like
> running "make SLOW=1" or "SPEED=slow" like for iotests maybe?

Sounds like a good idea.

>
> This test is too verbose and I wonder if we should redirect stdout to
> /dev/null even for V=1.

I think the original intention was to compare against a reference.
Needless to say I think at the moment it's broken.

>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Enabled via tcg/i386/Makefile.target:
> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


--
Alex Bennée