[PATCH 0/4] target/i386: miscellaneous x87 fixes

Joseph Myers posted 4 patches 4 years ago
Test docker-mingw@fedora passed
Test checkpatch failed
Test asan passed
Test docker-quick@centos7 passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/alpine.DEB.2.21.2005132345100.11687@digraph.polyomino.org.uk
Maintainers: Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <rth@twiddle.net>, Paolo Bonzini <pbonzini@redhat.com>
target/i386/fpu_helper.c          |  73 +++++++++--
tests/tcg/i386/test-i386-fbstp.c  | 140 +++++++++++++++++++++
tests/tcg/i386/test-i386-fldcst.c | 199 ++++++++++++++++++++++++++++++
tests/tcg/i386/test-i386-fxam.c   | 143 +++++++++++++++++++++
4 files changed, 547 insertions(+), 8 deletions(-)
create mode 100644 tests/tcg/i386/test-i386-fbstp.c
create mode 100644 tests/tcg/i386/test-i386-fldcst.c
create mode 100644 tests/tcg/i386/test-i386-fxam.c
[PATCH 0/4] target/i386: miscellaneous x87 fixes
Posted by Joseph Myers 4 years ago
Following my previous patch series
<https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg00781.html>
and
<https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg01465.html>
for problems found in the x87 floating-point emulation, this patch
series fixes further miscellaneous bugs in that emulation.

There are further problems with x87 emulation that I am aware of and
intend to address in future patch series.  Those other problems, not
addressed by the first three patch series, generally relate to
exceptions, flag setting and those instructions for which the
emulation currently converts to host double (so losing range and
precision) and then works on host double for the rest of the emulation
process before converting back to floatx80 at the end.  Thus, the same
comments as for the previous patch series apply about this patch
series not fixing missing propagation of exceptions even when it adds
code to set exceptions in the softfloat state.

Joseph Myers (4):
  target/i386: fix floating-point load-constant rounding
  target/i386: fix fxam handling of invalid encodings
  target/i386: fix fbstp handling of negative zero
  target/i386: fix fbstp handling of out-of-range values

 target/i386/fpu_helper.c          |  73 +++++++++--
 tests/tcg/i386/test-i386-fbstp.c  | 140 +++++++++++++++++++++
 tests/tcg/i386/test-i386-fldcst.c | 199 ++++++++++++++++++++++++++++++
 tests/tcg/i386/test-i386-fxam.c   | 143 +++++++++++++++++++++
 4 files changed, 547 insertions(+), 8 deletions(-)
 create mode 100644 tests/tcg/i386/test-i386-fbstp.c
 create mode 100644 tests/tcg/i386/test-i386-fldcst.c
 create mode 100644 tests/tcg/i386/test-i386-fxam.c

-- 
2.17.1


-- 
Joseph S. Myers
joseph@codesourcery.com

Re: [PATCH 0/4] target/i386: miscellaneous x87 fixes
Posted by no-reply@patchew.org 4 years ago
Patchew URL: https://patchew.org/QEMU/alpine.DEB.2.21.2005132345100.11687@digraph.polyomino.org.uk/



Hi,

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

Message-id: alpine.DEB.2.21.2005132345100.11687@digraph.polyomino.org.uk
Subject: [PATCH 0/4] target/i386: miscellaneous x87 fixes
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
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
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/20200513011648.166876-1-eblake@redhat.com -> patchew/20200513011648.166876-1-eblake@redhat.com
 - [tag update]      patchew/20200514035230.25756-1-jsnow@redhat.com -> patchew/20200514035230.25756-1-jsnow@redhat.com
 * [new tag]         patchew/20200514055403.18902-1-jsnow@redhat.com -> patchew/20200514055403.18902-1-jsnow@redhat.com
Switched to a new branch 'test'
9abdf27 target/i386: fix fbstp handling of out-of-range values
53fdfa9 target/i386: fix fbstp handling of negative zero
350fd81 target/i386: fix fxam handling of invalid encodings
0cd240c target/i386: fix floating-point load-constant rounding

=== OUTPUT BEGIN ===
1/4 Checking commit 0cd240c60f14 (target/i386: fix floating-point load-constant rounding)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#107: 
new file mode 100644

ERROR: Use of volatile is usually wrong, please add a comment
#117: FILE: tests/tcg/i386/test-i386-fldcst.c:6:
+volatile long double ld_res;

ERROR: spaces required around that '+' (ctx:VxV)
#129: FILE: tests/tcg/i386/test-i386-fldcst.c:18:
+    if (ld_res != 0x3.5269e12f346e2bf8p+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#138: FILE: tests/tcg/i386/test-i386-fldcst.c:27:
+    if (ld_res != 0x3.5269e12f346e2bf8p+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#147: FILE: tests/tcg/i386/test-i386-fldcst.c:36:
+    if (ld_res != 0x3.5269e12f346e2bf8p+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#156: FILE: tests/tcg/i386/test-i386-fldcst.c:45:
+    if (ld_res != 0x3.5269e12f346e2bfcp+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#166: FILE: tests/tcg/i386/test-i386-fldcst.c:55:
+    if (ld_res != 0x1.71547652b82fe178p+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#175: FILE: tests/tcg/i386/test-i386-fldcst.c:64:
+    if (ld_res != 0x1.71547652b82fe176p+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#184: FILE: tests/tcg/i386/test-i386-fldcst.c:73:
+    if (ld_res != 0x1.71547652b82fe176p+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#193: FILE: tests/tcg/i386/test-i386-fldcst.c:82:
+    if (ld_res != 0x1.71547652b82fe178p+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#203: FILE: tests/tcg/i386/test-i386-fldcst.c:92:
+    if (ld_res != 0x3.243f6a8885a308d4p+0L) {
                                        ^

ERROR: spaces required around that '+' (ctx:VxV)
#212: FILE: tests/tcg/i386/test-i386-fldcst.c:101:
+    if (ld_res != 0x3.243f6a8885a308dp+0L) {
                                       ^

ERROR: spaces required around that '+' (ctx:VxV)
#221: FILE: tests/tcg/i386/test-i386-fldcst.c:110:
+    if (ld_res != 0x3.243f6a8885a308dp+0L) {
                                       ^

ERROR: spaces required around that '+' (ctx:VxV)
#230: FILE: tests/tcg/i386/test-i386-fldcst.c:119:
+    if (ld_res != 0x3.243f6a8885a308d4p+0L) {
                                        ^

ERROR: spaces required around that '-' (ctx:VxV)
#240: FILE: tests/tcg/i386/test-i386-fldcst.c:129:
+    if (ld_res != 0x4.d104d427de7fbcc8p-4L) {
                                        ^

ERROR: spaces required around that '-' (ctx:VxV)
#249: FILE: tests/tcg/i386/test-i386-fldcst.c:138:
+    if (ld_res != 0x4.d104d427de7fbccp-4L) {
                                       ^

ERROR: spaces required around that '-' (ctx:VxV)
#258: FILE: tests/tcg/i386/test-i386-fldcst.c:147:
+    if (ld_res != 0x4.d104d427de7fbccp-4L) {
                                       ^

ERROR: spaces required around that '-' (ctx:VxV)
#267: FILE: tests/tcg/i386/test-i386-fldcst.c:156:
+    if (ld_res != 0x4.d104d427de7fbcc8p-4L) {
                                        ^

ERROR: spaces required around that '-' (ctx:VxV)
#277: FILE: tests/tcg/i386/test-i386-fldcst.c:166:
+    if (ld_res != 0xb.17217f7d1cf79acp-4L) {
                                       ^

ERROR: spaces required around that '-' (ctx:VxV)
#286: FILE: tests/tcg/i386/test-i386-fldcst.c:175:
+    if (ld_res != 0xb.17217f7d1cf79abp-4L) {
                                       ^

ERROR: spaces required around that '-' (ctx:VxV)
#295: FILE: tests/tcg/i386/test-i386-fldcst.c:184:
+    if (ld_res != 0xb.17217f7d1cf79abp-4L) {
                                       ^

ERROR: spaces required around that '-' (ctx:VxV)
#304: FILE: tests/tcg/i386/test-i386-fldcst.c:193:
+    if (ld_res != 0xb.17217f7d1cf79acp-4L) {
                                       ^

total: 21 errors, 1 warnings, 283 lines checked

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

2/4 Checking commit 350fd815b461 (target/i386: fix fxam handling of invalid encodings)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#39: 
new file mode 100644

ERROR: Use of volatile is usually wrong, please add a comment
#54: FILE: tests/tcg/i386/test-i386-fxam.c:11:
+volatile union u ld_pseudo_m16382 = { .s = { UINT64_C(1) << 63, 0 } };

ERROR: Use of volatile is usually wrong, please add a comment
#55: FILE: tests/tcg/i386/test-i386-fxam.c:12:
+volatile union u ld_pseudo_nm16382 = { .s = { UINT64_C(1) << 63, 0x8000 } };

ERROR: Use of volatile is usually wrong, please add a comment
#56: FILE: tests/tcg/i386/test-i386-fxam.c:13:
+volatile union u ld_invalid_1 = { .s = { 1, 1234 } };

ERROR: Use of volatile is usually wrong, please add a comment
#57: FILE: tests/tcg/i386/test-i386-fxam.c:14:
+volatile union u ld_invalid_2 = { .s = { 0, 1234 } };

ERROR: Use of volatile is usually wrong, please add a comment
#58: FILE: tests/tcg/i386/test-i386-fxam.c:15:
+volatile union u ld_invalid_3 = { .s = { 0, 0x7fff } };

ERROR: Use of volatile is usually wrong, please add a comment
#59: FILE: tests/tcg/i386/test-i386-fxam.c:16:
+volatile union u ld_invalid_4 = { .s = { (UINT64_C(1) << 63) - 1, 0x7fff } };

ERROR: Use of volatile is usually wrong, please add a comment
#60: FILE: tests/tcg/i386/test-i386-fxam.c:17:
+volatile union u ld_invalid_n1 = { .s = { 1, 0x8123 } };

ERROR: Use of volatile is usually wrong, please add a comment
#61: FILE: tests/tcg/i386/test-i386-fxam.c:18:
+volatile union u ld_invalid_n2 = { .s = { 0, 0x8123 } };

ERROR: Use of volatile is usually wrong, please add a comment
#62: FILE: tests/tcg/i386/test-i386-fxam.c:19:
+volatile union u ld_invalid_n3 = { .s = { 0, 0xffff } };

ERROR: Use of volatile is usually wrong, please add a comment
#63: FILE: tests/tcg/i386/test-i386-fxam.c:20:
+volatile union u ld_invalid_n4 = { .s = { (UINT64_C(1) << 63) - 1, 0xffff } };

ERROR: spaces required around that '-' (ctx:VxV)
#125: FILE: tests/tcg/i386/test-i386-fxam.c:82:
+    __asm__ volatile ("fxam\nfnstsw" : "=a" (sw) : "t" (0x1p-16445L));
                                                             ^

ERROR: spaces required around that '-' (ctx:VxV)
#130: FILE: tests/tcg/i386/test-i386-fxam.c:87:
+    __asm__ volatile ("fxam\nfnstsw" : "=a" (sw) : "t" (-0x1p-16445L));
                                                              ^

total: 12 errors, 1 warnings, 159 lines checked

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

3/4 Checking commit 53fdfa9ee04d (target/i386: fix fbstp handling of negative zero)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#35: 
new file mode 100644

total: 0 errors, 1 warnings, 40 lines checked

Patch 3/4 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/4 Checking commit 9abdf27f3157 (target/i386: fix fbstp handling of out-of-range values)
ERROR: Use of volatile is usually wrong, please add a comment
#55: FILE: tests/tcg/i386/test-i386-fbstp.c:12:
+volatile union u ld_invalid_1 = { .s = { 1, 1234 } };

ERROR: Use of volatile is usually wrong, please add a comment
#56: FILE: tests/tcg/i386/test-i386-fbstp.c:13:
+volatile union u ld_invalid_2 = { .s = { 0, 1234 } };

ERROR: Use of volatile is usually wrong, please add a comment
#57: FILE: tests/tcg/i386/test-i386-fbstp.c:14:
+volatile union u ld_invalid_3 = { .s = { 0, 0x7fff } };

ERROR: Use of volatile is usually wrong, please add a comment
#58: FILE: tests/tcg/i386/test-i386-fbstp.c:15:
+volatile union u ld_invalid_4 = { .s = { (UINT64_C(1) << 63) - 1, 0x7fff } };

total: 4 errors, 0 warnings, 144 lines checked

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

=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/alpine.DEB.2.21.2005132345100.11687@digraph.polyomino.org.uk/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH 0/4] target/i386: miscellaneous x87 fixes
Posted by Joseph Myers 4 years ago
On Thu, 14 May 2020, no-reply@patchew.org wrote:

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

These are all false positives for the same reasons as for the previous 
patch series.

-- 
Joseph S. Myers
joseph@codesourcery.com

Re: [PATCH 0/4] target/i386: miscellaneous x87 fixes
Posted by Joseph Myers 3 years, 11 months ago
Ping for this patch series 
<https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg03543.html>, and 
the subsequent series 
<https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg04462.html> and 
individual patch 
<https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg06521.html>.

-- 
Joseph S. Myers
joseph@codesourcery.com

Re: [PATCH 0/4] target/i386: miscellaneous x87 fixes
Posted by Paolo Bonzini 3 years, 11 months ago
On 02/06/20 20:38, Joseph Myers wrote:
> Ping for this patch series 
> <https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg03543.html>, and 
> the subsequent series 
> <https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg04462.html> and 
> individual patch 
> <https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg06521.html>.

Hi Joseph,

these are the patches that I have queued:

Joseph Myers (12):
      target/i386: implement special cases for fxtract
      target/i386: fix fscale handling of signaling NaN
      target/i386: fix fscale handling of invalid exponent encodings
      target/i386: fix fscale handling of infinite exponents
      target/i386: fix fscale handling of rounding precision
      target/i386: fix floating-point load-constant rounding
      target/i386: fix fxam handling of invalid encodings
      target/i386: fix fbstp handling of negative zero
      target/i386: fix fbstp handling of out-of-range values
      target/i386: fix fisttpl, fisttpll handling of out-of-range values
      target/i386: fix IEEE x87 floating-point exception raising
      target/i386: correct fix for pcmpxstrx substring search

I was busy because Linus opened the merge window this week and because
of some public holidays, but I hope to send the pull request tomorrow as
it's grown quite big.

Paolo