[Qemu-devel] [PULL 0/7] softfloat updates, mostly for s390x

Alex Bennée posted 7 patches 6 years, 8 months ago
Only 3 patches received!
fpu/softfloat.c         | 94 ++++++++++++++++++++++++++++++++++++++++++++++---
include/fpu/softfloat.h | 15 ++++++--
tests/.gitignore        |  1 +
tests/Makefile.include  | 15 ++++----
tests/fp/fp-test.c      | 46 ++++++++++++++++++------
tests/fp/wrap.inc.c     |  1 +
6 files changed, 148 insertions(+), 24 deletions(-)
[Qemu-devel] [PULL 0/7] softfloat updates, mostly for s390x
Posted by Alex Bennée 6 years, 8 months ago
The following changes since commit ef80b99ce7ffbd66b3efd493f4ca99f8abf59e79:

  Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-next-220219-1' into staging (2019-02-25 14:04:20 +0000)

are available in the Git repository at:

  https://github.com/stsquad/qemu.git tags/pull-fpu-next-260219-1

for you to fetch changes up to bf30e8662cd2ee8b750945591cb34a31784fb994:

  tests/Makefile.include: test all rounding modes of softfloat (2019-02-26 14:08:03 +0000)

----------------------------------------------------------------
Softloat updates, mostly in preparation for s390x usage

----------------------------------------------------------------
Alex Bennée (3):
      tests/fp: add wrapping for f128_to_ui32
      tests/fp: enable f128_to_ui[32/64] tests in float-to-uint
      tests/Makefile.include: test all rounding modes of softfloat

David Hildenbrand (2):
      softfloat: add float128_is_{normal,denormal}
      softfloat: Implement float128_to_uint32

Eric Blake (1):
      tests: Ignore fp test outputs

Richard Henderson (1):
      softfloat: Support float_round_to_odd more places

 fpu/softfloat.c         | 94 ++++++++++++++++++++++++++++++++++++++++++++++---
 include/fpu/softfloat.h | 15 ++++++--
 tests/.gitignore        |  1 +
 tests/Makefile.include  | 15 ++++----
 tests/fp/fp-test.c      | 46 ++++++++++++++++++------
 tests/fp/wrap.inc.c     |  1 +
 6 files changed, 148 insertions(+), 24 deletions(-)

-- 
2.20.1


Re: [Qemu-devel] [PULL 0/7] softfloat updates, mostly for s390x
Posted by Peter Maydell 6 years, 8 months ago
On Tue, 26 Feb 2019 at 14:12, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> The following changes since commit ef80b99ce7ffbd66b3efd493f4ca99f8abf59e79:
>
>   Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-next-220219-1' into staging (2019-02-25 14:04:20 +0000)
>
> are available in the Git repository at:
>
>   https://github.com/stsquad/qemu.git tags/pull-fpu-next-260219-1
>
> for you to fetch changes up to bf30e8662cd2ee8b750945591cb34a31784fb994:
>
>   tests/Makefile.include: test all rounding modes of softfloat (2019-02-26 14:08:03 +0000)
>
> ----------------------------------------------------------------
> Softloat updates, mostly in preparation for s390x usage
>
> ----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM

[Qemu-devel] [PULL 1/7] tests: Ignore fp test outputs
Posted by Alex Bennée 6 years, 8 months ago
From: Eric Blake <eblake@redhat.com>

Commit 2cade3d wired up new tests, but did not exclude the
new *.out files produced by running the tests.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

diff --git a/tests/.gitignore b/tests/.gitignore
index 72c18aaab0..f2bf85c8c4 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -5,6 +5,7 @@ benchmark-crypto-hmac
 check-*
 !check-*.c
 !check-*.sh
+fp/*.out
 qht-bench
 rcutorture
 test-*
-- 
2.20.1


[Qemu-devel] [PULL 2/7] softfloat: add float128_is_{normal, denormal}
Posted by Alex Bennée 6 years, 8 months ago
From: David Hildenbrand <david@redhat.com>

Needed on s390x, to test for the data class of a number. So it will
gain soon a user.

A number is considered normal if the exponent is neither 0 nor all 1's.
That can be checked by adding 1 to the exponent, and comparing against
>= 2 after dropping an eventual overflow into the sign bit.

While at it, convert the other floatXX_is_normal functions to use a
similar, less error prone calculation, as suggested by Richard H.

Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index 38a5e99cf3..3ff5215b81 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -466,7 +466,7 @@ static inline int float32_is_zero_or_denormal(float32 a)
 
 static inline bool float32_is_normal(float32 a)
 {
-    return ((float32_val(a) + 0x00800000) & 0x7fffffff) >= 0x01000000;
+    return (((float32_val(a) >> 23) + 1) & 0xff) >= 2;
 }
 
 static inline bool float32_is_denormal(float32 a)
@@ -622,7 +622,7 @@ static inline int float64_is_zero_or_denormal(float64 a)
 
 static inline bool float64_is_normal(float64 a)
 {
-    return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53;
+    return (((float64_val(a) >> 52) + 1) & 0x7ff) >= 2;
 }
 
 static inline bool float64_is_denormal(float64 a)
@@ -940,6 +940,16 @@ static inline int float128_is_zero_or_denormal(float128 a)
     return (a.high & 0x7fff000000000000LL) == 0;
 }
 
+static inline bool float128_is_normal(float128 a)
+{
+    return (((a.high >> 48) + 1) & 0x7fff) >= 2;
+}
+
+static inline bool float128_is_denormal(float128 a)
+{
+    return float128_is_zero_or_denormal(a) && !float128_is_zero(a);
+}
+
 static inline int float128_is_any_nan(float128 a)
 {
     return ((a.high >> 48) & 0x7fff) == 0x7fff &&
-- 
2.20.1


[Qemu-devel] [PULL 5/7] tests/fp: enable f128_to_ui[32/64] tests in float-to-uint
Posted by Alex Bennée 6 years, 8 months ago
We've just added f128_to_ui32 and we missed out the f128_to_ui64 tests
last time.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 3741f8f6dd..060f765b0e 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -909,8 +909,7 @@ test-softfloat = $(call quiet-command, \
 
 # Conversion Routines:
 # FIXME: i32_to_extF80 (broken), i64_to_extF80 (broken)
-#        ui32_to_f128 (not implemented), f128_to_ui32 (not implemented)
-#        extF80_roundToInt (broken)
+#        ui32_to_f128 (not implemented), extF80_roundToInt (broken)
 #
 check-softfloat-conv: $(FP_TEST_BIN)
 	$(call test-softfloat, \
@@ -939,9 +938,11 @@ check-softfloat-conv: $(FP_TEST_BIN)
 		f16_to_ui32 f16_to_ui32_r_minMag \
 		f32_to_ui32 f32_to_ui32_r_minMag \
 		f64_to_ui32 f64_to_ui32_r_minMag \
+		f128_to_ui32 f128_to_ui32_r_minMag \
 		f16_to_ui64 f16_to_ui64_r_minMag \
 		f32_to_ui64 f32_to_ui64_r_minMag \
-		f64_to_ui64 f64_to_ui64_r_minMag, \
+		f64_to_ui64 f64_to_ui64_r_minMag \
+		f128_to_ui64 f128_to_ui64_r_minMag, \
 		float-to-uint)
 	$(call test-softfloat, \
 		f16_roundToInt f32_roundToInt \
-- 
2.20.1


[Qemu-devel] [PULL 7/7] tests/Makefile.include: test all rounding modes of softfloat
Posted by Alex Bennée 6 years, 8 months ago
We missed a bug in a recent patch as we were not testing all the
rounding modes for all operations. However enabling all rounding modes
for mulAdd does slow down the already slowest test and doesn't really
buy us much additional coverage so lets allow the default test flags
to be overridden.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 060f765b0e..f260014f02 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -898,12 +898,12 @@ $(FP_TEST_BIN):
 # The full test suite can take a bit of time, default to a quick run
 # "-l 2 -r all" can take more than a day for some operations and is best
 # run manually
-FP_TL=-l 1
+FP_TL=-l 1 -r all
 
-# $1 = tests, $2 = description
+# $1 = tests, $2 = description, $3 = test flags
 test-softfloat = $(call quiet-command, \
 			cd $(BUILD_DIR)/tests/fp && \
-			./fp-test -s $(FP_TL) $1 > $2.out 2>&1 || \
+			./fp-test -s $(if $3,$3,$(FP_TL)) $1 > $2.out 2>&1 || \
 			(cat $2.out && exit 1;), \
 			"FLOAT TEST", $2)
 
@@ -984,7 +984,7 @@ check-softfloat-compare: $(SF_COMPARE_RULES)
 check-softfloat-mulAdd: $(FP_TEST_BIN)
 	$(call test-softfloat, \
 		f16_mulAdd f32_mulAdd f64_mulAdd f128_mulAdd, \
-		mulAdd)
+		mulAdd,-l 1)
 
 # FIXME: extF80_rem (broken)
 check-softfloat-rem: $(FP_TEST_BIN)
-- 
2.20.1