x86: FPU_MAX, FPU_MIN incorrect
Public bug reported:
Dear All,
Bug was found in qemu.git.
Now (0.15, 1.0) all fpu is softfpu.
See target-i386/ops_sse.h:
#define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b)
#define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b)
It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error...
There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach.
Daniil.
** Affects: qemu
Importance: Undecided
Status: New
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
** Attachment added: "patch"
https://bugs.launchpad.net/qemu/+bug/889053/+attachment/2593058/+files/patch
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
482.sphinx3: http://www.spec.org/cpu2006/CFP2006/
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
** Patch added: "test.useprof.exe"
https://bugs.launchpad.net/bugs/889053/+attachment/2593057/+files/test.useprof.exe
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
misprint:
spec sphinx3 test data
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
The attached patch is incorrect (using the softfloat _min/_max functions will give wrong answers for some special cases). The correct macros are #define FPU_MIN(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? (a) : (b)
#define FPU_MAX(size, a, b) float ## size ## _lt(b, a, &env->sse_status) ? (a) : (b)
(see recent discussion on the qemu-devel list).
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
Hello!
Can I commit this patch (in development branch), and close this bug... Or you must do it?
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
Your patch is broken, as I said before.
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
Yes, but you patch is correct...
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
May be commit you patch
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
I say about
#define FPU_MIN(size, a, b) float ## size ## _lt(a, b, &env->sse_status) ? (a) : (b) #define FPU_MAX(size, a, b) float ## size ## _lt(b, a, &env->sse_status) ? (b) : (a)
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: New Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions
The patch mentioned in comment #5 has been included here:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=a4d1f142542935b90d2e
** Changed in: qemu
Status: New => Fix Released
Signature · 28 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/889053 Title: x86: FPU_MAX, FPU_MIN incorrect Status in QEMU: Fix Released Bug description: Dear All, Bug was found in qemu.git. Now (0.15, 1.0) all fpu is softfpu. See target-i386/ops_sse.h: #define FPU_MIN(size, a, b) (a) < (b) ? (a) : (b) #define FPU_MAX(size, a, b) (a) > (b) ? (a) : (b) It is incorrect now, becouse float64 (or 32) is (typedef) uint64_t (or 32). And if we have signed operands we get error... There is a test with this error (spec shinx3 test data, results diffs on machine and qemu (linux)) and fixed patch. See attach. Daniil. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/889053/+subscriptions