floating-point operation bugs in qemu-sh4

Bug #1701821 reported by Bruno Haible
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

When running the gnulib testsuite, I'm seeing test failures in the tests for libm functions
  asinf
  cbrtf
  copysignf
  coshf
  expm1f
  fabsf
  floor
  fmaf
  ldexpf
  logbf
  round
  roundf
  sinhf
  tanhf

How to reproduce:
- Using gnulib, run ./gnulib-tool --create-testdir --dir=../testdir-math --single-configure asinf cbrtf copysignf coshf expm1f fabsf floor fma fmaf fmal ldexpf logbf round roundf sinhf tanhf
- Set environment variables for using qemu-sh4.
- cd testdir-math; mkdir build-sh4; cd build-sh4; ./configure --host=sh4-linux; make; make check

Here are the failures (from the file testdir-math/build-sh4/gltests/test-suite.log):

FAIL: test-asinf
================

pc=0xf6751cdc sr=0x00000101 pr=0xf6758e86 fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0xf6751cd6 fpul=0x3f19999a
r0=0xf6751d88 r1=0x00000000 r2=0x00080000 r3=0x00000000
r4=0xf6ffe21c r5=0xf6ffe230 r6=0xf6ffe2fc r7=0x00000000
r8=0x3f19999a r9=0x3f19999a r10=0x00000000 r11=0x00000000
r12=0xf67ab008 r13=0x00000000 r14=0x00000000 r15=0xf6ffe230
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
Unhandled trap: 0x180
FAIL test-asinf (exit status: 1)

FAIL: test-cbrtf
================

pc=0x00400980 sr=0x00000001 pr=0x00400684 fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0x00400960 fpul=0x00000000
r0=0x00400ae8 r1=0x00412070 r2=0x3f19999a r3=0xf6ffe2c0
r4=0x00000001 r5=0xf6ffe2f4 r6=0xf6ffe2fc r7=0x00000000
r8=0x00412064 r9=0x00400960 r10=0x00000000 r11=0x00000000
r12=0xf671dc58 r13=0x00000000 r14=0x00000000 r15=0xf6ffe21c
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
Unhandled trap: 0x180
FAIL test-cbrtf (exit status: 1)

FAIL: test-copysignf
====================

pc=0x004004ce sr=0x00000001 pr=0xf668d28c fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf6674678 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0x004004d2 fpul=0x00000000
r0=0x80000000 r1=0x3f4ccccd r2=0xf6674284 r3=0xf6ffe2b0
r4=0x00000001 r5=0xf6ffe2e4 r6=0xf6ffe2ec r7=0x00000000
r8=0x00411088 r9=0x00411084 r10=0x00000000 r11=0x00000000
r12=0xf67a8c58 r13=0x00000000 r14=0x00000000 r15=0xf6ffe240
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
in conditional delay slot (delayed_pc=0x004004d2)
Unhandled trap: 0x1a0
FAIL test-copysignf (exit status: 1)

FAIL: test-coshf
================

pc=0xf675223a sr=0x00000101 pr=0xf675223c fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0xf675231c fpul=0x3f19999a
r0=0x3f19999a r1=0x3f19999a r2=0x000000e0 r3=0xf6ffe2c0
r4=0x00000001 r5=0xf6ffe2f4 r6=0xf6ffe2fc r7=0x00000000
r8=0x00400734 r9=0x00000000 r10=0x00000000 r11=0x00000000
r12=0xf67ab008 r13=0x00000000 r14=0x00000000 r15=0xf6ffe240
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
in delay slot (delayed_pc=0xf675231c)
Unhandled trap: 0x1a0
FAIL test-coshf (exit status: 1)

FAIL: test-expm1f
=================

pc=0xf6757e08 sr=0x00000000 pr=0x004005ce fpscr=0x00081000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0xf6757dfe fpul=0x00000000
r0=0xf6757fb0 r1=0x00001000 r2=0x00080000 r3=0x3eb17218
r4=0x00000001 r5=0xf6ffe2f4 r6=0xf6ffe2fc r7=0x00000000
r8=0x00400514 r9=0x00000064 r10=0x00400514 r11=0x00000000
r12=0xf67ab008 r13=0x00000000 r14=0x00000000 r15=0xf6ffe234
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
Unhandled trap: 0x180
FAIL test-expm1f (exit status: 1)

FAIL: test-fabsf
================

pc=0x00400504 sr=0x00000001 pr=0xf660228c fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0x004004ec fpul=0x00000000
r0=0x00400640 r1=0x00412074 r2=0x00000000 r3=0x00412078
r4=0x00000001 r5=0xf6ffe2f4 r6=0xf6ffe2fc r7=0x00080000
r8=0x004007ac r9=0x00000000 r10=0x00000000 r11=0x00000000
r12=0xf671dc58 r13=0x00000000 r14=0x00000000 r15=0xf6ffe260
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
Unhandled trap: 0x180
FAIL test-fabsf (exit status: 1)

FAIL: test-floor2
=================

../../gltests/test-floor2.c:130: assertion 'correct_result_p (x, reference)' failed
qemu: uncaught target signal 6 (Aborted) - core dumped
FAIL test-floor2 (exit status: 134)

FAIL: test-fmaf2
================

pc=0xf675f5ac sr=0x00000101 pr=0xf675f5a6 fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0xf675f5a6 fpul=0x01800000
r0=0xf675f4a4 r1=0x000065b0 r2=0x00080000 r3=0x3f800000
r4=0x01800000 r5=0x00000000 r6=0xffffffe9 r7=0x7f800000
r8=0xffffff6b r9=0xf6ffe1e4 r10=0xf6ffe1e8 r11=0xffffff6b
r12=0xf67ab008 r13=0xf6ffe1d8 r14=0x004004dc r15=0xf6ffe18c
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
Unhandled trap: 0x180
FAIL test-fmaf2 (exit status: 1)

FAIL: test-ldexpf
=================

pc=0xf669efa0 sr=0x00000001 pr=0xf669ef9a fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf6674678 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0xf669ef9a fpul=0x3f99999a
r0=0xfffffdc6 r1=0x000c9d70 r2=0x00080000 r3=0x3f19999a
r4=0x0019999a r5=0x3f19999a r6=0xffffffe9 r7=0x7f800000
r8=0x00000001 r9=0x0040041c r10=0xf6ffe23c r11=0x00000000
r12=0xf67a8c58 r13=0x00000000 r14=0x00000000 r15=0xf6ffe218
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
Unhandled trap: 0x180
FAIL test-ldexpf (exit status: 1)

FAIL: test-logbf
================

pc=0xf675842c sr=0x00000001 pr=0x00400664 fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0xf6758422 fpul=0x00000000
r0=0xf6758480 r1=0x00000000 r2=0x00080000 r3=0x00080000
r4=0x00000000 r5=0xf6ffe2f4 r6=0xf6ffe2fc r7=0x00000000
r8=0xf6ffe24c r9=0x0040054c r10=0x00000000 r11=0x00000000
r12=0xf671dc58 r13=0x00000000 r14=0x00000000 r15=0xf6ffe244
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
Unhandled trap: 0x180
FAIL test-logbf (exit status: 1)

FAIL: test-round2
=================

FAIL test-round2 (exit status: 1)

FAIL: test-roundf2
==================

FAIL test-roundf2 (exit status: 1)

FAIL: test-sinhf
================

pc=0xf675581c sr=0x00000101 pr=0xf675a784 fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0xf6755858 fpul=0x3f19999a
r0=0xf6755930 r1=0x317fffff r2=0x3f19999a r3=0xf6ffe2c0
r4=0x00000001 r5=0xf6ffe2f4 r6=0xf6ffe2fc r7=0x00000000
r8=0x3f19999a r9=0x00000000 r10=0x00000000 r11=0x00000000
r12=0xf67ab008 r13=0x00000000 r14=0x00000000 r15=0xf6ffe238
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
in conditional delay slot (delayed_pc=0xf6755858)
Unhandled trap: 0x1a0
FAIL test-sinhf (exit status: 1)

FAIL: test-tanhf
================

pc=0xf6758ca4 sr=0x00000100 pr=0x0040057c fpscr=0x00080000
spc=0x00000000 ssr=0x00000000 gbr=0xf65e98e8 vbr=0x00000000
sgr=0x00000000 dbr=0x00000000 delayed_pc=0xf6758c9a fpul=0x3f19999a
r0=0xf6758d00 r1=0x00000000 r2=0x00080000 r3=0xf6ffe2c0
r4=0x00000001 r5=0xf6ffe2f4 r6=0xf6ffe2fc r7=0x00000000
r8=0x3f19999a r9=0x00000000 r10=0x00000000 r11=0x00000000
r12=0xf67ab008 r13=0x00000000 r14=0x00000000 r15=0xf6ffe254
r16=0x00000000 r17=0x00000000 r18=0x00000000 r19=0x00000000
r20=0x00000000 r21=0x00000000 r22=0x00000000 r23=0x00000000
Unhandled trap: 0x180
FAIL test-tanhf (exit status: 1)

I don't have access to sh4 hardware, so I cannot provide this as a comparison point.
But most of the test failures don't look like "merely" a wrong computation by glibc.

Revision history for this message
Bruno Haible (bruno-clisp) wrote :
Revision history for this message
Thomas Huth (th-huth) wrote :

Seems like two patches for this have been included in QEMU v2.10:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=57f5c1b093e1c3ec
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=fea7d77d3ea287d3
Can we close this ticket now, or is there something left to do here?

Revision history for this message
Bruno Haible (bruno-clisp) wrote :

With qemu-2.10, all of these tests now pass. Great!

Changed in qemu:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.