qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix)
@ 2019-01-22 21:50 Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 01/11] fp-bench: fix update_random_ops Alex Bennée
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée


Hi,

The last softfloat PR failed on a number of big endian machines. This
has been fixed with a patch to the fp-test platform.h. In the meantime
there have been a few fixes to the check-softfloat rules to improve
re-building and reporting of failing tests.

The following patches need review
  patch 0009/tests Makefile add floating point tests.patch

I'll send out a proper pull request once all the automated testing has
completed. Anyone with access to big endian hardware it would be cool
if you could give the series a spin as well.

Alex Bennée (3):
  tests/Makefile: add floating point tests
  scripts/archive-source: include softfloat tests
  tests/Makfile: add check-softfloat rule

Emilio G. Cota (7):
  fp-bench: fix update_random_ops
  fp-bench: remove wrong exponent raise in fill_random
  berkeley-testfloat-3: pull changes
  tests/fp/Makefile: do not use gcc-only -W flags
  fp-test: fix signature of slow_clear_flags and qemu_clear_flags
  tests/fp/platform.h: include config-host.h
  softfloat: enforce softfloat if the host's FMA is broken

Thomas Huth (1):
  include/fpu/softfloat: Fix compilation with Clang on s390x

 fpu/softfloat.c                |  33 ++++++++
 include/fpu/softfloat-macros.h |   2 +-
 scripts/archive-source.sh      |   2 +-
 tests/Makefile.include         | 137 ++++++++++++++++++++++++++++++++-
 tests/fp/Makefile              |   3 +-
 tests/fp/berkeley-testfloat-3  |   2 +-
 tests/fp/fp-bench.c            |  15 ++--
 tests/fp/fp-test.c             |   4 +-
 tests/fp/platform.h            |   1 +
 9 files changed, 183 insertions(+), 16 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH  v3 01/11] fp-bench: fix update_random_ops
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 02/11] fp-bench: remove wrong exponent raise in fill_random Alex Bennée
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Emilio G. Cota, Alex Bennée, Aurelien Jarno, Peter Maydell

From: "Emilio G. Cota" <cota@braap.org>

The second test in the branches is wrong; fix while converting
to a switch statement, which is easier to get right.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/fp/fp-bench.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c
index f5bc5edebf..546bac9c9c 100644
--- a/tests/fp/fp-bench.c
+++ b/tests/fp/fp-bench.c
@@ -143,15 +143,20 @@ static void update_random_ops(int n_ops, enum precision prec)
     for (i = 0; i < n_ops; i++) {
         uint64_t r = random_ops[i];
 
-        if (prec == PREC_SINGLE || PREC_FLOAT32) {
+        switch (prec) {
+        case PREC_SINGLE:
+        case PREC_FLOAT32:
             do {
                 r = xorshift64star(r);
             } while (!float32_is_normal(r));
-        } else if (prec == PREC_DOUBLE || PREC_FLOAT64) {
+            break;
+        case PREC_DOUBLE:
+        case PREC_FLOAT64:
             do {
                 r = xorshift64star(r);
             } while (!float64_is_normal(r));
-        } else {
+            break;
+        default:
             g_assert_not_reached();
         }
         random_ops[i] = r;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 02/11] fp-bench: remove wrong exponent raise in fill_random
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 01/11] fp-bench: fix update_random_ops Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 03/11] berkeley-testfloat-3: pull changes Alex Bennée
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Emilio G. Cota, Alex Bennée, Aurelien Jarno, Peter Maydell

From: "Emilio G. Cota" <cota@braap.org>

At this point random_ops[] only contains normals, so there's
no need to do anything to them. In fact, raising the exponent
here can make the output !normal, which is precisely
what the comment says we want to avoid.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/fp/fp-bench.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c
index 546bac9c9c..4ba5e1d2d4 100644
--- a/tests/fp/fp-bench.c
+++ b/tests/fp/fp-bench.c
@@ -176,8 +176,6 @@ static void fill_random(union fp *ops, int n_ops, enum precision prec,
             if (no_neg && float32_is_neg(ops[i].f32)) {
                 ops[i].f32 = float32_chs(ops[i].f32);
             }
-            /* raise the exponent to limit the frequency of denormal results */
-            ops[i].f32 |= 0x40000000;
             break;
         case PREC_DOUBLE:
         case PREC_FLOAT64:
@@ -185,8 +183,6 @@ static void fill_random(union fp *ops, int n_ops, enum precision prec,
             if (no_neg && float64_is_neg(ops[i].f64)) {
                 ops[i].f64 = float64_chs(ops[i].f64);
             }
-            /* raise the exponent to limit the frequency of denormal results */
-            ops[i].f64 |= LIT64(0x4000000000000000);
             break;
         default:
             g_assert_not_reached();
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH  v3 03/11] berkeley-testfloat-3: pull changes
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 01/11] fp-bench: fix update_random_ops Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 02/11] fp-bench: remove wrong exponent raise in fill_random Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 04/11] tests/fp/Makefile: do not use gcc-only -W flags Alex Bennée
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Emilio G. Cota, Alex Bennée, Aurelien Jarno, Peter Maydell

From: "Emilio G. Cota" <cota@braap.org>

- fail: constify fail_programName

Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/fp/berkeley-testfloat-3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fp/berkeley-testfloat-3 b/tests/fp/berkeley-testfloat-3
index ca9fa2ba05..5a59dcec19 160000
--- a/tests/fp/berkeley-testfloat-3
+++ b/tests/fp/berkeley-testfloat-3
@@ -1 +1 @@
-Subproject commit ca9fa2ba05625ba929958f163b01747e07dd39cc
+Subproject commit 5a59dcec19327396a011a17fd924aed4fec416b3
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 04/11] tests/fp/Makefile: do not use gcc-only -W flags
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (2 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 03/11] berkeley-testfloat-3: pull changes Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 05/11] fp-test: fix signature of slow_clear_flags and qemu_clear_flags Alex Bennée
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Emilio G. Cota, Alex Bennée, Aurelien Jarno, Peter Maydell

From: "Emilio G. Cota" <cota@braap.org>

The build now completes in both gcc and clang.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/fp/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/fp/Makefile b/tests/fp/Makefile
index 5019dcdca0..5a35e7c210 100644
--- a/tests/fp/Makefile
+++ b/tests/fp/Makefile
@@ -65,8 +65,7 @@ QEMU_CFLAGS += $(TF_OPTS)
 TF_CFLAGS :=
 TF_CFLAGS += -Wno-strict-prototypes
 TF_CFLAGS += -Wno-unknown-pragmas
-TF_CFLAGS += -Wno-discarded-qualifiers
-TF_CFLAGS += -Wno-maybe-uninitialized
+TF_CFLAGS += -Wno-uninitialized
 TF_CFLAGS += -Wno-missing-prototypes
 TF_CFLAGS += -Wno-return-type
 TF_CFLAGS += -Wno-unused-function
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 05/11] fp-test: fix signature of slow_clear_flags and qemu_clear_flags
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (3 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 04/11] tests/fp/Makefile: do not use gcc-only -W flags Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 06/11] tests/fp/platform.h: include config-host.h Alex Bennée
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Emilio G. Cota, Alex Bennée, Aurelien Jarno, Peter Maydell

From: "Emilio G. Cota" <cota@braap.org>

To match the type in testfloat.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/fp/fp-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c
index fca576309c..2a35ef601d 100644
--- a/tests/fp/fp-test.c
+++ b/tests/fp/fp-test.c
@@ -789,7 +789,7 @@ static int set_init_flags(const char *flags)
     return 0;
 }
 
-static uint8_t slow_clear_flags(void)
+static uint_fast8_t slow_clear_flags(void)
 {
     uint8_t prev = slowfloat_exceptionFlags;
 
@@ -797,7 +797,7 @@ static uint8_t slow_clear_flags(void)
     return prev;
 }
 
-static uint8_t qemu_clear_flags(void)
+static uint_fast8_t qemu_clear_flags(void)
 {
     uint8_t prev = qemu_flags_to_sf(qsf.float_exception_flags);
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 06/11] tests/fp/platform.h: include config-host.h
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (4 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 05/11] fp-test: fix signature of slow_clear_flags and qemu_clear_flags Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 07/11] softfloat: enforce softfloat if the host's FMA is broken Alex Bennée
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Emilio G. Cota, Alex Bennée, Aurelien Jarno, Peter Maydell

From: "Emilio G. Cota" <cota@braap.org>

We get HOST_WORDS_BIGENDIAN from config-host.h, but the include
is missing. Fix it.

This fixes `make check-softfloat' on big endian hosts.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/fp/platform.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/fp/platform.h b/tests/fp/platform.h
index f8c423dde3..c20ba70baa 100644
--- a/tests/fp/platform.h
+++ b/tests/fp/platform.h
@@ -29,6 +29,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+#include "config-host.h"
 
 #ifndef HOST_WORDS_BIGENDIAN
 #define LITTLEENDIAN 1
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 07/11] softfloat: enforce softfloat if the host's FMA is broken
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (5 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 06/11] tests/fp/platform.h: include config-host.h Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 08/11] include/fpu/softfloat: Fix compilation with Clang on s390x Alex Bennée
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Emilio G. Cota, Alex Bennée, Aurelien Jarno, Peter Maydell

From: "Emilio G. Cota" <cota@braap.org>

The added branch to the FMA ops is marked as unlikely and therefore
its impact on performance (measured with fp-bench) is within noise range
when measured on an Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 fpu/softfloat.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 59eac97d10..9132d7a0b0 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1542,6 +1542,8 @@ soft_f64_muladd(float64 a, float64 b, float64 c, int flags,
     return float64_round_pack_canonical(pr, status);
 }
 
+static bool force_soft_fma;
+
 float32 QEMU_FLATTEN
 float32_muladd(float32 xa, float32 xb, float32 xc, int flags, float_status *s)
 {
@@ -1562,6 +1564,11 @@ float32_muladd(float32 xa, float32 xb, float32 xc, int flags, float_status *s)
     if (unlikely(!f32_is_zon3(ua, ub, uc))) {
         goto soft;
     }
+
+    if (unlikely(force_soft_fma)) {
+        goto soft;
+    }
+
     /*
      * When (a || b) == 0, there's no need to check for under/over flow,
      * since we know the addend is (normal || 0) and the product is 0.
@@ -1623,6 +1630,11 @@ float64_muladd(float64 xa, float64 xb, float64 xc, int flags, float_status *s)
     if (unlikely(!f64_is_zon3(ua, ub, uc))) {
         goto soft;
     }
+
+    if (unlikely(force_soft_fma)) {
+        goto soft;
+    }
+
     /*
      * When (a || b) == 0, there's no need to check for under/over flow,
      * since we know the addend is (normal || 0) and the product is 0.
@@ -7974,3 +7986,24 @@ float128 float128_scalbn(float128 a, int n, float_status *status)
                                          , status);
 
 }
+
+static void __attribute__((constructor)) softfloat_init(void)
+{
+    union_float64 ua, ub, uc, ur;
+
+    if (QEMU_NO_HARDFLOAT) {
+        return;
+    }
+    /*
+     * Test that the host's FMA is not obviously broken. For example,
+     * glibc < 2.23 can perform an incorrect FMA on certain hosts; see
+     *   https://sourceware.org/bugzilla/show_bug.cgi?id=13304
+     */
+    ua.s = 0x0020000000000001ULL;
+    ub.s = 0x3ca0000000000000ULL;
+    uc.s = 0x0020000000000000ULL;
+    ur.h = fma(ua.h, ub.h, uc.h);
+    if (ur.s != 0x0020000000000001ULL) {
+        force_soft_fma = true;
+    }
+}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 08/11] include/fpu/softfloat: Fix compilation with Clang on s390x
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (6 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 07/11] softfloat: enforce softfloat if the host's FMA is broken Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 09/11] tests/Makefile: add floating point tests Alex Bennée
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée, Aurelien Jarno, Peter Maydell

From: Thomas Huth <thuth@redhat.com>

Clang v7.0.1 does not like the __int128 variable type for inline
assembly on s390x:

In file included from fpu/softfloat.c:97:
include/fpu/softfloat-macros.h:647:9: error: inline asm error:
 This value type register class is not natively supported!
    asm("dlgr %0, %1" : "+r"(n) : "r"(d));
        ^

Disable this code part there now when compiling with Clang, so that
the generic code gets used instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 include/fpu/softfloat-macros.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/fpu/softfloat-macros.h b/include/fpu/softfloat-macros.h
index b1d772e6d4..bd5b6418e3 100644
--- a/include/fpu/softfloat-macros.h
+++ b/include/fpu/softfloat-macros.h
@@ -641,7 +641,7 @@ static inline uint64_t udiv_qrnnd(uint64_t *r, uint64_t n1,
     uint64_t q;
     asm("divq %4" : "=a"(q), "=d"(*r) : "0"(n0), "1"(n1), "rm"(d));
     return q;
-#elif defined(__s390x__)
+#elif defined(__s390x__) && !defined(__clang__)
     /* Need to use a TImode type to get an even register pair for DLGR.  */
     unsigned __int128 n = (unsigned __int128)n1 << 64 | n0;
     asm("dlgr %0, %1" : "+r"(n) : "r"(d));
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 09/11] tests/Makefile: add floating point tests
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (7 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 08/11] include/fpu/softfloat: Fix compilation with Clang on s390x Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 23:45   ` Emilio G. Cota
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 10/11] scripts/archive-source: include softfloat tests Alex Bennée
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Wire up test/fp-test into the main testing Makefile. Currently we skip
some of the extF80 and f128 related tests. Once we re-factor and fix
these tests the plumbing should get simpler.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
v3
  - tweak test function
  - always call fp-test build
---
 tests/Makefile.include | 120 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 120 insertions(+)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 4eea38ae99..f123616bc7 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -880,6 +880,126 @@ check-report-unit.tap: $(check-unit-y)
 check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap
 	$(call quiet-command,./scripts/tap-merge.py $^ > $@,"GEN","$@")
 
+# FPU Emulation tests (aka softfloat)
+#
+# As we still have some places that need fixing the rules are a little
+# more complex than they need to be and have to override some of the
+# generic Makefile expansions. Once we are cleanly passing all
+# the tests we can simplify the make syntax.
+
+FP_TEST_BIN=$(BUILD_DIR)/tests/fp/fp-test
+
+# the build dir is created by configure
+.PHONY: $(FP_TEST_BIN)
+$(FP_TEST_BIN): $(BUILD_DIR)/tests/fp fpu/softfloat.c
+	$(call quiet-command, \
+	  cd $(BUILD_DIR)/tests/fp && make, \
+          "BUILD", $<)
+
+# The full test suite can take a bit of time, default to a quick run
+ifeq ($(SPEED), quick)
+FP_TL=-l 1
+else
+FP_TL=-l 2 -r all
+endif
+
+# $1 = tests, $2 = description
+test-softfloat = $(call quiet-command, \
+			cd $(BUILD_DIR)/tests/fp && \
+			./fp-test -s $(FP_TL) $1 > $2.out 2>&1 || \
+			(cat $2.out && exit 1;), \
+			"FLOAT TEST", $2)
+
+# Conversion Routines:
+# FIXME: i32_to_extF80 (broken), i64_to_extF80 (broken)
+#        ui32_to_f128 (not implemented), f128_to_ui32 (not implemented)
+#        extF80_roundToInt (broken)
+#
+check-softfloat-conv: $(FP_TEST_BIN)
+	$(call test-softfloat, \
+		i32_to_f16 i64_to_f16 \
+		i32_to_f32 i64_to_f32 \
+		i32_to_f64 i64_to_f64 \
+		i32_to_f128 i64_to_f128, int-to-float)
+	$(call test-softfloat, \
+		ui32_to_f16 ui64_to_f16 \
+		ui32_to_f32 ui64_to_f32 \
+		ui32_to_f64 ui64_to_f64 \
+		ui64_to_f128, uint-to-float)
+	$(call test-softfloat, \
+		f16_to_i32 f16_to_i32_r_minMag \
+		f32_to_i32 f32_to_i32_r_minMag \
+		f64_to_i32 f64_to_i32_r_minMag \
+		extF80_to_i32 extF80_to_i32_r_minMag \
+		f128_to_i32 f128_to_i32_r_minMag \
+		f16_to_i64 f16_to_i64_r_minMag \
+		f32_to_i64 f32_to_i64_r_minMag \
+		f64_to_i64 f64_to_i64_r_minMag \
+		extF80_to_i64 extF80_to_i64_r_minMag \
+		f128_to_i64 f128_to_i64_r_minMag, \
+		float-to-int)
+	$(call test-softfloat, \
+		f16_to_ui32 f16_to_ui32_r_minMag \
+		f32_to_ui32 f32_to_ui32_r_minMag \
+		f64_to_ui32 f64_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, \
+		float-to-uint)
+	$(call test-softfloat, \
+		f16_roundToInt f32_roundToInt \
+		f64_roundToInt f128_roundToInt, \
+		round-to-integer)
+
+# Generic rule for all float operations
+#
+# Some patterns are overidden due to broken or missing tests.
+# Hopefully these can be removed over time.
+
+check-softfloat-%: $(FP_TEST_BIN)
+	$(call test-softfloat, f16_$* f32_$* f64_$* extF80_$* f128_$*, $*)
+
+# Float Compare routines
+SF_COMPARE_OPS=eq eq_signaling le le_quiet lt_quiet
+SF_COMPARE_RULES=$(patsubst %,check-softfloat-%, $(SF_COMPARE_OPS))
+
+# FIXME: extF80_le_quiet (broken)
+check-softfloat-le_quiet: $(FP_TEST_BIN)
+	$(call test-softfloat, 				\
+		f16_le_quiet f32_le_quiet f64_le_quiet  \
+		f128_le_quiet, 				\
+		le_quiet)
+
+# FIXME: extF80_lt_quiet (broken)
+check-softfloat-lt_quiet: $(FP_TEST_BIN)
+	$(call test-softfloat, 				\
+		f16_lt_quiet f32_lt_quiet f64_lt_quiet  \
+		f128_lt_quiet, 				\
+		lt_quiet)
+
+.PHONY: check-softfloat-compare
+check-softfloat-compare: $(SF_COMPARE_RULES)
+
+# Math Operations
+
+# FIXME: extF80_mulAdd (missing)
+check-softfloat-mulAdd: $(FP_TEST_BIN)
+	$(call test-softfloat, \
+		f16_mulAdd f32_mulAdd f64_mulAdd f128_mulAdd, \
+		mulAdd)
+
+# FIXME: extF80_rem (broken)
+check-softfloat-rem: $(FP_TEST_BIN)
+	$(call test-softfloat, \
+		f16_rem f32_rem f64_rem f128_rem, \
+		rem)
+
+SF_MATH_OPS=add sub mul mulAdd div rem sqrt
+SF_MATH_RULES=$(patsubst %,check-softfloat-%, $(SF_MATH_OPS))
+
+.PHONY: check-softfloat-ops
+check-softfloat-ops: $(SF_MATH_RULES)
+
 # Per guest TCG tests
 
 LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_DIRS))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 10/11] scripts/archive-source: include softfloat tests
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (8 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 09/11] tests/Makefile: add floating point tests Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 11/11] tests/Makfile: add check-softfloat rule Alex Bennée
  2019-01-31 17:56 ` [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) no-reply
  11 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

We need these if we want to run unit/softfloat tests in our docker
containers.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 scripts/archive-source.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index 62bd22578b..6eed2a29bd 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -26,7 +26,7 @@ vroot_dir="${tar_file}.vroot"
 # independent of what the developer currently has initialized
 # in their checkout, because the build environment is completely
 # different to the host OS.
-submodules="dtc ui/keycodemapdb"
+submodules="dtc ui/keycodemapdb tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
 
 trap "status=$?; rm -rf \"$list_file\" \"$vroot_dir\"; exit \$status" 0 1 2 3 15
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Qemu-devel] [PATCH v3 11/11] tests/Makfile: add check-softfloat rule
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (9 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 10/11] scripts/archive-source: include softfloat tests Alex Bennée
@ 2019-01-22 21:50 ` Alex Bennée
  2019-01-22 23:46   ` Emilio G. Cota
  2019-01-31 17:56 ` [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) no-reply
  11 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2019-01-22 21:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

This adds a rule to run all of our softfloat tests. It is included as
a pre-requisite to check-tcg and check-unit as well.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 tests/Makefile.include | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index f123616bc7..acf166e0e2 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -12,6 +12,7 @@ check-help:
 	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"
 	@echo " $(MAKE) check-block          Run block tests"
 	@echo " $(MAKE) check-tcg            Run TCG tests"
+	@echo " $(MAKE) check-softfloat      Run FPU emulation tests"
 	@echo " $(MAKE) check-acceptance     Run all acceptance (functional) tests"
 	@echo
 	@echo " $(MAKE) check-report.html    Generates an HTML test report"
@@ -1000,6 +1001,18 @@ SF_MATH_RULES=$(patsubst %,check-softfloat-%, $(SF_MATH_OPS))
 .PHONY: check-softfloat-ops
 check-softfloat-ops: $(SF_MATH_RULES)
 
+# Finally a generic rule to test all of softfoat. If TCG isnt't
+# enabled we define a null operation which skips the tests.
+
+.PHONY: check-softfloat
+ifeq ($(CONFIG_TCG),y)
+check-softfloat: check-softfloat-conv check-softfloat-compare check-softfloat-ops
+else
+check-softfloat:
+	$(call quiet-command, /bin/true, "FLOAT TEST", \
+		"SKIPPED for non-TCG builds")
+endif
+
 # Per guest TCG tests
 
 LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_DIRS))
@@ -1032,7 +1045,7 @@ clean-tcg-tests-%:
 build-tcg: $(BUILD_TCG_TARGET_RULES)
 
 .PHONY: check-tcg
-check-tcg: $(RUN_TCG_TARGET_RULES)
+check-tcg: check-softfloat $(RUN_TCG_TARGET_RULES)
 
 .PHONY: clean-tcg
 clean-tcg: $(CLEAN_TCG_TARGET_RULES)
@@ -1113,7 +1126,7 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR)
 check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) check-tests/qapi-schema/doc-good.texi
 check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
 check-block: $(patsubst %,check-%, $(check-block-y))
-check: check-qapi-schema check-unit check-qtest check-decodetree
+check: check-qapi-schema check-unit check-softfloat check-qtest check-decodetree
 check-clean:
 	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
 	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 09/11] tests/Makefile: add floating point tests
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 09/11] tests/Makefile: add floating point tests Alex Bennée
@ 2019-01-22 23:45   ` Emilio G. Cota
  0 siblings, 0 replies; 15+ messages in thread
From: Emilio G. Cota @ 2019-01-22 23:45 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel

On Tue, Jan 22, 2019 at 21:50:14 +0000, Alex Bennée wrote:
> Wire up test/fp-test into the main testing Makefile. Currently we skip
> some of the extF80 and f128 related tests. Once we re-factor and fix
> these tests the plumbing should get simpler.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
(snip)
> +# FPU Emulation tests (aka softfloat)
> +#
> +# As we still have some places that need fixing the rules are a little
> +# more complex than they need to be and have to override some of the
> +# generic Makefile expansions. Once we are cleanly passing all
> +# the tests we can simplify the make syntax.
> +
> +FP_TEST_BIN=$(BUILD_DIR)/tests/fp/fp-test
> +
> +# the build dir is created by configure
> +.PHONY: $(FP_TEST_BIN)
> +$(FP_TEST_BIN): $(BUILD_DIR)/tests/fp fpu/softfloat.c

I'd remove the prerequisites here: (1) tests/fp should have been
created by configure, and we're not adding a recipe for it here;
(2) fpu/softfloat.c is unnecessary, because the makefile in tests/fp
will take care of the prerequisites.

> +	$(call quiet-command, \
> +	  cd $(BUILD_DIR)/tests/fp && make, \
> +          "BUILD", $<)

I'd rather use $(MAKE) here, e.g. so that "-j" propagates.

With those two changes, the delta wrt the above would be:

 # the build dir is created by configure
 .PHONY: $(FP_TEST_BIN)
-$(FP_TEST_BIN): $(BUILD_DIR)/tests/fp fpu/softfloat.c
+$(FP_TEST_BIN):
        $(call quiet-command, \
-         cd $(BUILD_DIR)/tests/fp && make, \
-          "BUILD", $<)
+         $(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" $(notdir $@), \
+         "BUILD", "$(notdir $@)")

The rest looks good!

Thanks,

		Emilio

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 11/11] tests/Makfile: add check-softfloat rule
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 11/11] tests/Makfile: add check-softfloat rule Alex Bennée
@ 2019-01-22 23:46   ` Emilio G. Cota
  0 siblings, 0 replies; 15+ messages in thread
From: Emilio G. Cota @ 2019-01-22 23:46 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel

On Tue, Jan 22, 2019 at 21:50:16 +0000, Alex Bennée wrote:
> This adds a rule to run all of our softfloat tests. It is included as
> a pre-requisite to check-tcg and check-unit as well.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---

You might want to fix the commit title with  s/Makfile/Makefile/

That said,
Reviewed-by: Emilio G. Cota <cota@braap.org>

Thanks,

		Emilio

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix)
  2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
                   ` (10 preceding siblings ...)
  2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 11/11] tests/Makfile: add check-softfloat rule Alex Bennée
@ 2019-01-31 17:56 ` no-reply
  11 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2019-01-31 17:56 UTC (permalink / raw)
  To: alex.bennee; +Cc: fam, qemu-devel

Patchew URL: https://patchew.org/QEMU/20190122215016.18697-1-alex.bennee@linaro.org/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190122215016.18697-1-alex.bennee@linaro.org
Subject: [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix)
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
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
Switched to a new branch 'test'
1c3d170 tests/Makfile: add check-softfloat rule
ee2215b scripts/archive-source: include softfloat tests
d3b2f6b tests/Makefile: add floating point tests
4e35542 include/fpu/softfloat: Fix compilation with Clang on s390x
a31f3e2 softfloat: enforce softfloat if the host's FMA is broken
6ec5d0f tests/fp/platform.h: include config-host.h
2128df3 fp-test: fix signature of slow_clear_flags and qemu_clear_flags
62c6bb9 tests/fp/Makefile: do not use gcc-only -W flags
04ffa7c berkeley-testfloat-3: pull changes
c8d89ed fp-bench: remove wrong exponent raise in fill_random
3d24285 fp-bench: fix update_random_ops

=== OUTPUT BEGIN ===
1/11 Checking commit 3d242858ec62 (fp-bench: fix update_random_ops)
2/11 Checking commit c8d89edb4800 (fp-bench: remove wrong exponent raise in fill_random)
3/11 Checking commit 04ffa7c5628e (berkeley-testfloat-3: pull changes)
4/11 Checking commit 62c6bb96922f (tests/fp/Makefile: do not use gcc-only -W flags)
5/11 Checking commit 2128df3a9377 (fp-test: fix signature of slow_clear_flags and qemu_clear_flags)
6/11 Checking commit 6ec5d0fb8a93 (tests/fp/platform.h: include config-host.h)
7/11 Checking commit a31f3e28d914 (softfloat: enforce softfloat if the host's FMA is broken)
8/11 Checking commit 4e35542f0d62 (include/fpu/softfloat: Fix compilation with Clang on s390x)
9/11 Checking commit d3b2f6b91a6d (tests/Makefile: add floating point tests)
10/11 Checking commit ee2215b0ae09 (scripts/archive-source: include softfloat tests)
ERROR: line over 90 characters
#23: FILE: scripts/archive-source.sh:29:
+submodules="dtc ui/keycodemapdb tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"

total: 1 errors, 0 warnings, 8 lines checked

Patch 10/11 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

11/11 Checking commit 1c3d170d7ae3 (tests/Makfile: add check-softfloat rule)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190122215016.18697-1-alex.bennee@linaro.org/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-01-31 17:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-22 21:50 [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 01/11] fp-bench: fix update_random_ops Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 02/11] fp-bench: remove wrong exponent raise in fill_random Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 03/11] berkeley-testfloat-3: pull changes Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 04/11] tests/fp/Makefile: do not use gcc-only -W flags Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 05/11] fp-test: fix signature of slow_clear_flags and qemu_clear_flags Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 06/11] tests/fp/platform.h: include config-host.h Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 07/11] softfloat: enforce softfloat if the host's FMA is broken Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 08/11] include/fpu/softfloat: Fix compilation with Clang on s390x Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 09/11] tests/Makefile: add floating point tests Alex Bennée
2019-01-22 23:45   ` Emilio G. Cota
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 10/11] scripts/archive-source: include softfloat tests Alex Bennée
2019-01-22 21:50 ` [Qemu-devel] [PATCH v3 11/11] tests/Makfile: add check-softfloat rule Alex Bennée
2019-01-22 23:46   ` Emilio G. Cota
2019-01-31 17:56 ` [Qemu-devel] [PATCH v3 00/11] current fpu/next queue (tests & build fix) no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).