float: tests and bug fix for #5203
Subsystems (2)
cover float: tests and bug fix for #5203
We had a bug reported that fma fails on some platforms. I can't test the fix but I took the opportunity to extend the TCG test cases to cover a few more of the fma corner cases along with what is hopefully the fix.
Alex.
Alex Bennée (4):
meson: expose MESON_SOURCE_ROOT to scripts
scripts/tests: add regen-reference.sh
tests/tcg: extend the float_madds test case
fpu/softfloat: gate hardfloat on working fmaf
meson.build | 1 + fpu/softfloat.c | 10 +++ tests/tcg/multiarch/float_madds.c | 13 ++++ scripts/tests/regen-reference.sh | 87 +++++++++++++++++++++++++++ tests/tcg/aarch64/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/alpha/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/arm/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/hexagon/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/hppa/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/i386/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/loongarch64/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/m68k/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/mips/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/mips64/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/mips64el/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/mipsel/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/or1k/float_madds.ref | 16 +++++ tests/tcg/ppc64/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/ppc64le/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/riscv64/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/s390x/float_madds.ref | 64 ++++++++++++++++++++ tests/tcg/sh4/float_madds.ref | 32 ++++++++++ tests/tcg/x86_64/float_madds.ref | 64 ++++++++++++++++++++ 23 files changed, 1247 insertions(+) create mode 100755 scripts/tests/regen-reference.sh
Signature · 1 line
2.47.3
PATCH 1/4 meson: expose MESON_SOURCE_ROOT to scripts
If we are mandating using the ./run wrapper when calling scripts we should also expose the source root to save scripts having to jump hoops to find it.
--- meson.build | 1 + 1 file changed, 1 insertion(+)
meson.build +1 -0
@@ -3501,6 +3501,7 @@ config_host_h = configure_file(output: 'config-host.h', configuration: config_ho genh += config_host_h devenv = environment() +devenv.set('MESON_SOURCE_ROOT', meson.project_source_root()) devenv.set('MESON_BUILD_ROOT', meson.project_build_root()) devenv.set('VIRTUAL_ENV', meson.project_build_root() / 'pyvenv') devenv.prepend('PATH', meson.project_build_root() / 'pyvenv'/ 'bin')
Signature · 1 line
2.47.3
Re: [PATCH 1/4] meson: expose MESON_SOURCE_ROOT to scripts
Quoted 9 lines · Alex Bennée
If we are mandating using the ./run wrapper when calling scripts we should also expose the source root to save scripts having to jump hoops to find it.
Signed-off-by Alex Bennée <[email protected]>--- meson.build | 1 + 1 file changed, 1 insertion(+)
PATCH 2/4 scripts/tests: add regen-reference.sh
In reply to Alex BennéeWhile we should verify references with real hardware we don't have hardware for all cases. Since the meson conversion we've made reference files mandatory so lets include a helper script to make things a bit easier to update.
--- scripts/tests/regen-reference.sh | 87 ++++++++++++++++++++++++++++++ tests/tcg/mips64/float_madds.ref | 64 ++++++++++++++++++++++ tests/tcg/mips64el/float_madds.ref | 64 ++++++++++++++++++++++ tests/tcg/mipsel/float_madds.ref | 64 ++++++++++++++++++++++ tests/tcg/or1k/float_madds.ref | 16 ++++++ tests/tcg/ppc64/float_madds.ref | 64 ++++++++++++++++++++++ tests/tcg/riscv64/float_madds.ref | 64 ++++++++++++++++++++++ 7 files changed, 423 insertions(+) create mode 100755 scripts/tests/regen-reference.sh
scripts/tests/regen-reference.sh new file +87 -0
@@ -0,0 +1,87 @@ +#!/bin/sh +# +# Regenerate TCG test reference files. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +set -eu + +usage() { + cat <<EOF +Usage: ./run $(basename "$0") [-n] <test-name-or-stub> + +Regenerate TCG reference (.ref) files for tests matching <test-name-or-stub>. +This script must be executed from inside a QEMU build directory using the './run' wrapper. + +Options: + -n Dry run (print commands without executing or overwriting files) + -h Show this help message +EOF + exit "${1:-1}" +} + +DRY_RUN=0 + +while getopts "nh" opt; do + case "$opt" in + n) DRY_RUN=1 ;; + h) usage 0 ;; + *) usage 1 ;; + esac +done +shift $((OPTIND - 1)) + +if [ $# -lt 1 ]; then + usage 1 +fi + +TEST_PATTERN="$1" + +# Must be run using the ./run wrapper which provides MESON_SOURCE_ROOT and MESON_BUILD_ROOT +if [ -z "${MESON_SOURCE_ROOT:-}" ] || [ -z "${MESON_BUILD_ROOT:-}" ]; then + echo "Error: MESON_SOURCE_ROOT or MESON_BUILD_ROOT is not set." >&2 + echo "This script must be executed from inside a build directory using the './run' wrapper, e.g.:" >&2 + echo " cd <build-dir> && ./run \$PWD/../scripts/tests/regen-reference.sh ${TEST_PATTERN}" >&2 + exit 1 +fi + +SRC_ROOT="$MESON_SOURCE_ROOT" +BUILD_DIR="$MESON_BUILD_ROOT" + +# Ensure we are inside the build directory +if [ ! -f "build.ninja" ] || [ "$(pwd -P)" != "$(cd "$BUILD_DIR" && pwd -P)" ]; then + echo "Error: This script must be executed from inside the build directory." >&2 + echo "Please cd into your build directory and run via './run'." >&2 + exit 1 +fi + +echo "!!! Warning: about to regenerate with TCG !!!" +echo "You should verify the real hardware generates the same reference files where you can" + +# Query meson test list +TEST_LIST=$(meson test --suite tcg --list "*${TEST_PATTERN}*" | grep -v "plugin") + +while IFS= read -r line; do + case "$line" in + *" / "*) + test_name="${line##* / }" + case "$test_name" in + *-linux-user-*) + arch="${test_name%%-linux-user-*}" + test_base="${test_name#*-linux-user-}" + + qemu_bin="./qemu-${arch}" + test_bin="tests/tcg/${test_name}.test" + ref_file="${SRC_ROOT}/tests/tcg/${arch}/${test_base}.ref" + + echo "${qemu_bin} ${test_bin} > ${ref_file}" + if [ "$DRY_RUN" -eq 0 ]; then + "${qemu_bin}" "${test_bin}" > "${ref_file}" + fi + ;; + esac + ;; + esac +done <<EOF +$TEST_LIST +EOF
tests/tcg/mips64/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/mips64el/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/mipsel/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/or1k/float_madds.ref +16 -0
@@ -190,3 +190,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0) op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001) res: f32(0x1.00000000000000000000p-149:0x00000001) flags=OK (32/0) +# Issue 5023 +op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff) +res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0) +# Gist cases +op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000) +res: f32(-inf:0xff800000) flags=OK (34/0) +op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000) +res: f32(0x1.00000200000000000000p+52:0x59800001) flags=OK (35/0) +op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001) +res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=OK (36/0) +op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001) +res: f32(0x1.10001200000000000000p+100:0x71880009) flags=OK (37/0) +op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001) +res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=OK (38/0) +op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084) +res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=OK (39/0)
tests/tcg/ppc64/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/riscv64/float_madds.ref +64 -0
85 lines not on this page · raw message
Signature · 1 line
2.47.3
Re: [PATCH 2/4] scripts/tests: add regen-reference.sh
Quoted 6 lines · Alex Bennée
While we should verify references with real hardware we don't have hardware for all cases. Since the meson conversion we've made reference files mandatory so lets include a helper script to make things a bit easier to update.
Signed-off-by Alex Bennée <[email protected]>
Quoted 8 lines
--- scripts/tests/regen-reference.sh | 87 ++++++++++++++++++++++++++++++ tests/tcg/mips64/float_madds.ref | 64 ++++++++++++++++++++++ tests/tcg/mips64el/float_madds.ref | 64 ++++++++++++++++++++++ tests/tcg/mipsel/float_madds.ref | 64 ++++++++++++++++++++++ tests/tcg/or1k/float_madds.ref | 16 ++++++ tests/tcg/ppc64/float_madds.ref | 64 ++++++++++++++++++++++ tests/tcg/riscv64/float_madds.ref | 64 ++++++++++++++++++++++
Seems like refs update belong to next commit.
Quoted 86 lines
7 files changed, 423 insertions(+) create mode 100755 scripts/tests/regen-reference.shscripts/tests/regen-reference.sh new file +77
-0@@ -0,0 +1,87 @@ +#!/bin/sh +# +# Regenerate TCG test reference files. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +set -eu + +usage() { + cat <<EOF +Usage: ./run $(basename "$0") [-n] <test-name-or-stub> + +Regenerate TCG reference (.ref) files for tests matching <test-name-or-stub>. +This script must be executed from inside a QEMU build directory using the './run' wrapper. + +Options: + -n Dry run (print commands without executing or overwriting files) + -h Show this help message +EOF + exit "${1:-1}" +} + +DRY_RUN=0 + +while getopts "nh" opt; do + case "$opt" in + n) DRY_RUN=1 ;; + h) usage 0 ;; + *) usage 1 ;; + esac +done +shift $((OPTIND - 1)) + +if [ $# -lt 1 ]; then + usage 1 +fi + +TEST_PATTERN="$1" + +# Must be run using the ./run wrapper which provides MESON_SOURCE_ROOT and MESON_BUILD_ROOT +if [ -z "${MESON_SOURCE_ROOT:-}" ] || [ -z "${MESON_BUILD_ROOT:-}" ]; then + echo "Error: MESON_SOURCE_ROOT or MESON_BUILD_ROOT is not set." >&2 + echo "This script must be executed from inside a build directory using the './run' wrapper, e.g.:" >&2 + echo " cd <build-dir> && ./run \$PWD/../scripts/tests/regen-reference.sh ${TEST_PATTERN}" >&2 + exit 1 +fi + +SRC_ROOT="$MESON_SOURCE_ROOT" +BUILD_DIR="$MESON_BUILD_ROOT" + +# Ensure we are inside the build directory +if [ ! -f "build.ninja" ] || [ "$(pwd -P)" != "$(cd "$BUILD_DIR" && pwd -P)" ]; then + echo "Error: This script must be executed from inside the build directory." >&2 + echo "Please cd into your build directory and run via './run'." >&2 + exit 1 +fi + +echo "!!! Warning: about to regenerate with TCG !!!" +echo "You should verify the real hardware generates the same reference files where you can" + +# Query meson test list +TEST_LIST=$(meson test --suite tcg --list "*${TEST_PATTERN}*" | grep -v "plugin") + +while IFS= read -r line; do + case "$line" in + *" / "*) + test_name="${line##* / }" + case "$test_name" in + *-linux-user-*) + arch="${test_name%%-linux-user-*}" + test_base="${test_name#*-linux-user-}" + + qemu_bin="./qemu-${arch}" + test_bin="tests/tcg/${test_name}.test" + ref_file="${SRC_ROOT}/tests/tcg/${arch}/${test_base}.ref" + + echo "${qemu_bin} ${test_bin} > ${ref_file}"
scripts/tests/regen-reference.sh line 87
Quoted 10 lines
scripts/tests/regen-reference.sh new file +10
-0+ if [ "$DRY_RUN" -eq 0 ]; then + "${qemu_bin}" "${test_bin}" > "${ref_file}" + fi + ;; + esac + ;; + esac +done <<EOF +$TEST_LIST +EOF
Good idea.
Let's make it simpler:
- rename it regen-float-references.sh
- no arguments (always cover all the tests available)
- always rebuild by default (ninja tcg-tests) to make sure everything is up to date
This way it's bulletproof and impossible to miss anything.
Regards,
Pierrick
PATCH 3/4 tests/tcg: extend the float_madds test case
In reply to Alex BennéeWe have a bug report about a failing case when using a broken mingw-w64 and in the upstream bug there where some additional test cases added. Import them into our *-user test so we can verify the fix later.
I've regenerated the references with the new TCG helper script but I have verified they are correct for arm, aarch64, ppc64 and s390x.
--- tests/tcg/multiarch/float_madds.c | 13 ++++++ tests/tcg/aarch64/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/alpha/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/arm/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/hexagon/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/hppa/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/i386/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/loongarch64/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/m68k/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/mips/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/ppc64le/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/s390x/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/sh4/float_madds.ref | 32 ++++++++++++++ tests/tcg/x86_64/float_madds.ref | 64 +++++++++++++++++++++++++++ 14 files changed, 813 insertions(+)
tests/tcg/multiarch/float_madds.c +13 -0
@@ -99,6 +99,19 @@ int main(int argc, char *argv[argc])printf ("# LP184149\n" );do_madds (0x1.ffffffffffffcp-1022 ,0x1.0000000000001p-1 ,0x0.0000000000001p-1022 , j,0 );do_madds (0x8p-152 ,0x8p-152 ,0x8p-152 , j+1 ,0 ); + +/* From https://gitlab.com/qemu-project/qemu/-/issues/5023 */ +printf ("# Issue 5023\n" ); +do_madds (FLT_MAX ,2.0f , -FLT_MAX , j+2 ,0 ); + +/* From https://gist.github.com/minoki/ff4412f2a385eab3c7e689acd589ea3e */ +printf ("# Gist cases\n" ); +do_madds (0x1p100f ,0x1p100f , -INFINITY , j+3 ,0 ); +do_madds (0x1.fffffep23f ,0x1.000004p28f ,0x1.fcp5f , j+4 ,0 ); +do_madds (0x1.84ae3p125f ,0x1.6p-141f ,0x1p-149f , j+5 ,0 ); +do_madds (0x1.00001p50f ,0x1.1p50f ,0x1p-149f , j+6 ,0 ); +do_madds (0x1.000002p50f ,0x1.8p50f ,-0x1p-149f , j+7 ,0 ); +do_madds (0x1.83bd78p4f ,-0x1.cp118f ,-0x1.344108p-2f , j+8 ,0 ); }return 0 ;
tests/tcg/aarch64/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/alpha/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/arm/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/hexagon/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/hppa/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/i386/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/loongarch64/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/m68k/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/mips/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/ppc64le/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/s390x/float_madds.ref +64 -0
85 lines not on this page · raw message
tests/tcg/sh4/float_madds.ref +32 -0
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0) op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001) res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0) +# Issue 5023 +op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff) +res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0) +# Gist cases +op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000) +res: f32(-inf:0xff800000) flags=OK (34/0) +op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000) +res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0) +op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001) +res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0) +op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001) +res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0) +op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001) +res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0) +op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084) +res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0) ### Rounding to zero op : f32(nan:0xffa00000) * f32(nan:0xffc00000) + f32(-inf:0xff800000) res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -382,3 +398,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0) op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001) res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0) +# Issue 5023 +op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff) +res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0) +# Gist cases +op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000) +res: f32(-inf:0xff800000) flags=OK (34/0) +op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000) +res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0) +op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001) +res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0) +op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001) +res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0) +op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001) +res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0) +op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084) +res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
tests/tcg/x86_64/float_madds.ref +64 -0
85 lines not on this page · raw message
Signature · 1 line
2.47.3
Re: [PATCH 3/4] tests/tcg: extend the float_madds test case
Quoted 10 lines · Alex Bennée
We have a bug report about a failing case when using a broken mingw-w64 and in the upstream bug there where some additional test cases added. Import them into our *-user test so we can verify the fix later.
I've regenerated the references with the new TCG helper script but I have verified they are correct for arm, aarch64, ppc64 and s390x.
Signed-off-by Alex Bennée <[email protected]>
Quoted 17 lines
--- tests/tcg/multiarch/float_madds.c | 13 ++++++ tests/tcg/aarch64/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/alpha/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/arm/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/hexagon/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/hppa/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/i386/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/loongarch64/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/m68k/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/mips/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/ppc64le/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/s390x/float_madds.ref | 64 +++++++++++++++++++++++++++ tests/tcg/sh4/float_madds.ref | 32 ++++++++++++++ tests/tcg/x86_64/float_madds.ref | 64 +++++++++++++++++++++++++++ 14 files changed, 813 insertions(+)
PATCH 4/4 fpu/softfloat: gate hardfloat on working fmaf
In reply to Alex BennéeWe already had a test against fma to catch broken glibc's but apparently there are mingw64 cases that are broken for fmaf on Windows. Add a test to softfloat_init so we can disable if we detect the brokenness.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/5023
--- fpu/softfloat.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fpu/softfloat.c +10 -0
@@ -5161,4 +5161,14 @@ static void __attribute__((constructor)) softfloat_init(void)if (ur.s !=0x0020000000000001ULL ) { force_soft_fma = true; } + +/* +* Test that the host's fmaf is not obviously broken. For example, +* mingw-w64 can perform an incorrect fmaf on certain hosts; see +* https://gitlab.com/qemu-project/qemu/-/issues/5023 +* https://sourceforge.net/p/mingw-w64/bugs/848/ +*/ +if (fmaf (FLT_MAX ,2.0f , -FLT_MAX ) !=FLT_MAX ) { + force_soft_fma = true; + } }
Signature · 1 line
2.47.3
Re: [PATCH 4/4] fpu/softfloat: gate hardfloat on working fmaf
Quoted 20 lines · Alex Bennée
We already had a test against fma to catch broken glibc's but apparently there are mingw64 cases that are broken for fmaf on Windows. Add a test to
softfloat_initso we can disable if we detect the brokenness.Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/5023
Signed-off-by Alex Bennée <[email protected]>--- fpu/softfloat.c | 10 ++++++++++ 1 file changed, 10 insertions(+)fpu/softfloat.c +1
-0@@ -5161,4 +5161,14 @@ static void __attribute__((constructor)) softfloat_init(void)if (ur.s !=0x0020000000000001ULL ) { force_soft_fma = true; } +
fpu/softfloat.c static void __attribute__((constructor)) softfloat_init(void) · line 5174
Quoted 10 lines
fpu/softfloat.c +9
-0+/* +* Test that the host's fmaf is not obviously broken. For example, +* mingw-w64 can perform an incorrect fmaf on certain hosts; see +* https://gitlab.com/qemu-project/qemu/-/issues/5023 +* https://sourceforge.net/p/mingw-w64/bugs/848/ +*/ +if (fmaf (FLT_MAX ,2.0f , -FLT_MAX ) !=FLT_MAX ) { + force_soft_fma = true; + } }
Hi Alex,
Quoted 5 lines · Alex Bennée
We had a bug reported that fma fails on some platforms. I can't test the fix but I took the opportunity to extend the TCG test cases to cover a few more of the fma corner cases along with what is hopefully the fix.
would that be a 11.2 candidate?
Regards,
Pierrick
Quoted 10 lines · Pierrick Bouvier
Hi Alex,
Quoted 5 lines · Alex Bennée
We had a bug reported that fma fails on some platforms. I can't test the fix but I took the opportunity to extend the TCG test cases to cover a few more of the fma corner cases along with what is hopefully the fix.
would that be a 11.2 candidate?
Possibly - it depends if the reporter thinks 4/4 has fixed things. The tests are OK to wait until the next release. In fact to properly exercise things we'd want a system mode version (as Windows can't run *-user) and I realise now the test case will never exercise hardfloat as the flags are reset for each calculation.
Quoted 3 lines
Regards,
Pierrick
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro