[PATCH v3 0/3] target/alpha: FPCR exception status fixes for IEEE-mode code

Matt Turner posted 3 patches 1 month ago
Failed in applying to current master (apply log)
target/alpha/fpu_helper.c       |  80 ++--
tests/tcg/alpha/float_convd.ref | 792 ++++++++++++++++++++--------------------
tests/tcg/alpha/float_convs.ref | 512 +++++++++++++-------------
tests/tcg/alpha/test-cvttq.c    |   6 +-
4 files changed, 714 insertions(+), 676 deletions(-)
[PATCH v3 0/3] target/alpha: FPCR exception status fixes for IEEE-mode code
Posted by Matt Turner 1 month ago
Fixes for the exception status that qemu-alpha reports to code built
with gcc -mieee. I found the last two running glibc's math tests under
linux-user, and the first by comparing against an AlphaServer ES47
(EV7). All three are checked against the ES47 running Linux v7.3 and a
v7.4 merge window kernel.

Patch 1 reports an overflowing CVTTQ/SV as invalid, as the kernel's
software completion does. qemu-alpha reported no FE_* exception
for it.

Patch 2 fixes 471d4930470a, which was meant to record masked exceptions
in the FPCR but had no effect for insns with software completion.
Without it FE_INEXACT is never set for -mieee code.

Patch 3 makes underflow match the hardware for a result that rounds up
to the smallest normal number. Alpha raises no underflow there and
softfloat does.

Tested with linux-user only; system mode is untested.

glibc's math tests (make check subdirs=math) from current glibc
master, built with GCC 17 and run under linux-user:

            PASS  FAIL  XFAIL
  master    1399   110      1
  series    1509     0      1

Nearly all of the failures on master are 'Exception "Inexact" not
set'. The XFAIL is test-float32x-float64-div. On master it fails for
missing inexact; with the series it fails only the four
div_{upward,downward}_double cases that glibc expects to fail on
Alpha.

Patches 1 and 2 update the Alpha float_convd and float_convs
reference files, which were generated from QEMU and encode both bugs.
With the series they match the output of the same binaries on the
ES47. The tcg-alpha-linux-user suite passes with the series.

Signed-off-by: Matt Turner <mattst88@gmail.com>
---
Changes in v3:
- New patch 1: report invalid for an overflowing CVTTQ/SV in
  linux-user, found by comparing against hardware.
- Patches 1 and 2: update tests/tcg/alpha/float_conv{d,s}.ref, which
  encoded the bugs. They now match an ES47.
- Patch 3: update the commit message for Linux commit b74843b38da8,
  which makes math-emu determine tininess after rounding.
- Rerun glibc's math tests against current glibc master.
- Rebase on master.
- Link to v2: https://lore.kernel.org/qemu-devel/20261016-alpha-fpcr-status-s-v2-0-4719bec02b3b@gmail.com

Changes in v2:
- Patch 2: fold the underflow check into soft_to_fpcr_exc, which now
  takes whether the delivered result is normal, instead of adding
  soft_to_fpcr_exc_tiny.
- Patch 2: check float_flag_input_denormal_used for CONFIG_USER_ONLY
  only.
- Link to v1: https://lore.kernel.org/qemu-devel/20261012-alpha-fpcr-status-s-v1-0-bc7efa6d5609@gmail.com

To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>

---
Matt Turner (3):
      target/alpha: Report invalid for an overflowing CVTTQ/SV in linux-user
      target/alpha: Record masked exceptions in FPCR for /S insns
      target/alpha: Determine tininess from the delivered result

 target/alpha/fpu_helper.c       |  80 ++--
 tests/tcg/alpha/float_convd.ref | 792 ++++++++++++++++++++--------------------
 tests/tcg/alpha/float_convs.ref | 512 +++++++++++++-------------
 tests/tcg/alpha/test-cvttq.c    |   6 +-
 4 files changed, 714 insertions(+), 676 deletions(-)
---
base-commit: b6c4b7e86dec12d07f5cac65265b986d38ee9002
change-id: 20261012-alpha-fpcr-status-s-5b5c42702cfc

Best regards,
--  
Matt Turner <mattst88@gmail.com>