mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
The arm64 frontend used to implement the scalar fmadd, fmsub, fnmadd
and fnmsub iinstructions into separate addition/substraction and
multiplication instructions, which caused rounding issues.
This patch turns them into Iop_M{Add,Sub}F{32,64} instructions
(with some arguments negated). And the backend now emits fmadd or fmsub
instructions.
Alexandra Hajkova <ahajkova@redhat.com> added tests and fixed up the
implementation to make sure rounding (and sign) are correct now.
https://bugs.kde.org/show_bug.cgi?id=426014
126 lines
4.7 KiB
Plaintext
126 lines
4.7 KiB
Plaintext
FMADD 32bit: dst = z + x * y
|
|
76.246193 = 38.123096 + 55.000000 * 0.693147
|
|
dst = 42987e0d = 76.246192932128906
|
|
FNMADD 32bit: dst = -z + (-x) * y
|
|
-76.246193 = -38.123096 + (-55.000000) * 0.693147
|
|
dst = c2987e0d = -76.246192932128906
|
|
FMSUB 32bit: dst = z + (-x) * y
|
|
0.000001 = 38.123096 + (-55.000000) * 0.693147
|
|
dst = 35c00000 = 1.430511474609375e-06
|
|
FNMSUB 32bit: dst = -z + x * y
|
|
-0.000001 = -38.123096 + 55.000000 * 0.693147
|
|
dst = b5c00000 = -1.430511474609375e-06
|
|
FMADD 64bit: dst = z + x * y
|
|
76.246190 = 38.123095 + 55.000000 * 0.693147
|
|
dst = 40530fc1931f09c9 = 76.246189861593976
|
|
FNMADD 64bit: dst = -z + (-x) * y
|
|
-76.246190 = -38.123095 - 55.000000 * 0.693147
|
|
dst = c0530fc1931f09c9 = -76.246189861593976
|
|
FMSUB 64bit: dst = z + (-x) * y
|
|
-0.000000 = 38.123095 + (-55.000000) * 0.693147
|
|
dst = bce9000000000000 = -2.7755575615628914e-15
|
|
FNMSUB 64bit: dst = -z + x * y
|
|
0.000000 = -38.123095 + 55.000000 * 0.693147
|
|
dst = 3ce9000000000000 = 2.7755575615628914e-15
|
|
|
|
FMADD 32bit: dst = z + x * y
|
|
1.996086 = 1.000000 + 0.980762 * 1.015625
|
|
dst = 3fff7fc0 = 1.9960861206054688
|
|
FNMADD 32bit: dst = -z + (-x) * y
|
|
-1.996086 = -1.000000 + (-0.980762) * 1.015625
|
|
dst = bfff7fc0 = -1.9960861206054688
|
|
FMSUB 32bit: dst = z + (-x) * y
|
|
0.003914 = 1.000000 + (-0.980762) * 1.015625
|
|
dst = 3b80401a = 0.00391389150172472
|
|
FNMSUB 32bit: dst = -z + x * y
|
|
-0.003914 = -1.000000 + 0.980762 * 1.015625
|
|
dst = bb80401a = -0.00391389150172472
|
|
FMADD 64bit: dst = z + x * y
|
|
1.996086 = 1.000000 + 0.980762 * 1.015625
|
|
dst = 3fffeff800000000 = 1.9960861206054688
|
|
FNMADD 64bit: dst = -z + (-x) * y
|
|
-1.996086 = -1.000000 - 0.980762 * 1.015625
|
|
dst = bfffeff800000000 = -1.9960861206054688
|
|
FMSUB 64bit: dst = z + (-x) * y
|
|
0.003914 = 1.000000 + (-0.980762) * 1.015625
|
|
dst = 3f70080000000034 = 0.0039138793945312951
|
|
FNMSUB 64bit: dst = -z + x * y
|
|
-0.003914 = -1.000000 + 0.980762 * 1.015625
|
|
dst = bf70080000000034 = -0.0039138793945312951
|
|
|
|
FMADD 32bit: dst = z + x * y
|
|
0.000000 = 0.000000 + 0.000000 * 0.000000
|
|
dst = 00000000 = 0
|
|
FNMADD 32bit: dst = -z + (-x) * y
|
|
-0.000000 = -0.000000 + (-0.000000) * 0.000000
|
|
dst = 80000000 = -0
|
|
FMSUB 32bit: dst = z + (-x) * y
|
|
0.000000 = 0.000000 + (-0.000000) * 0.000000
|
|
dst = 00000000 = 0
|
|
FNMSUB 32bit: dst = -z + x * y
|
|
0.000000 = -0.000000 + 0.000000 * 0.000000
|
|
dst = 00000000 = 0
|
|
FMADD 64bit: dst = z + x * y
|
|
0.000000 = 0.000000 + 0.000000 * 0.000000
|
|
dst = 0000000000000000 = 0
|
|
FNMADD 64bit: dst = -z + (-x) * y
|
|
-0.000000 = -0.000000 - 0.000000 * 0.000000
|
|
dst = 8000000000000000 = -0
|
|
FMSUB 64bit: dst = z + (-x) * y
|
|
0.000000 = 0.000000 + (-0.000000) * 0.000000
|
|
dst = 0000000000000000 = 0
|
|
FNMSUB 64bit: dst = -z + x * y
|
|
0.000000 = -0.000000 + 0.000000 * 0.000000
|
|
dst = 0000000000000000 = 0
|
|
|
|
FMADD 32bit: dst = z + x * y
|
|
2.000000 = 1.000000 + 1.000000 * 1.000000
|
|
dst = 40000000 = 2
|
|
FNMADD 32bit: dst = -z + (-x) * y
|
|
-2.000000 = -1.000000 + (-1.000000) * 1.000000
|
|
dst = c0000000 = -2
|
|
FMSUB 32bit: dst = z + (-x) * y
|
|
0.000000 = 1.000000 + (-1.000000) * 1.000000
|
|
dst = 00000000 = 0
|
|
FNMSUB 32bit: dst = -z + x * y
|
|
0.000000 = -1.000000 + 1.000000 * 1.000000
|
|
dst = 00000000 = 0
|
|
FMADD 64bit: dst = z + x * y
|
|
2.000000 = 1.000000 + 1.000000 * 1.000000
|
|
dst = 4000000000000000 = 2
|
|
FNMADD 64bit: dst = -z + (-x) * y
|
|
-2.000000 = -1.000000 - 1.000000 * 1.000000
|
|
dst = c000000000000000 = -2
|
|
FMSUB 64bit: dst = z + (-x) * y
|
|
0.000000 = 1.000000 + (-1.000000) * 1.000000
|
|
dst = 0000000000000000 = 0
|
|
FNMSUB 64bit: dst = -z + x * y
|
|
0.000000 = -1.000000 + 1.000000 * 1.000000
|
|
dst = 0000000000000000 = 0
|
|
|
|
FMADD 32bit: dst = z + x * y
|
|
18446744073709551616.000000 = 4294967296.000000 + 4294967296.000000 * 4294967296.000000
|
|
dst = 5f800000 = 1.8446744073709552e+19
|
|
FNMADD 32bit: dst = -z + (-x) * y
|
|
-18446744073709551616.000000 = -4294967296.000000 + (-4294967296.000000) * 4294967296.000000
|
|
dst = df800000 = -1.8446744073709552e+19
|
|
FMSUB 32bit: dst = z + (-x) * y
|
|
-18446744073709551616.000000 = 4294967296.000000 + (-4294967296.000000) * 4294967296.000000
|
|
dst = df800000 = -1.8446744073709552e+19
|
|
FNMSUB 32bit: dst = -z + x * y
|
|
18446744073709551616.000000 = -4294967296.000000 + 4294967296.000000 * 4294967296.000000
|
|
dst = 5f800000 = 1.8446744073709552e+19
|
|
FMADD 64bit: dst = z + x * y
|
|
18446744069414584320.000000 = 4294967295.000000 + 4294967295.000000 * 4294967295.000000
|
|
dst = 43efffffffe00000 = 1.8446744069414584e+19
|
|
FNMADD 64bit: dst = -z + (-x) * y
|
|
-18446744069414584320.000000 = -4294967295.000000 - 4294967295.000000 * 4294967295.000000
|
|
dst = c3efffffffe00000 = -1.8446744069414584e+19
|
|
FMSUB 64bit: dst = z + (-x) * y
|
|
-18446744060824649728.000000 = 4294967295.000000 + (-4294967295.000000) * 4294967295.000000
|
|
dst = c3efffffffa00000 = -1.844674406082465e+19
|
|
FNMSUB 64bit: dst = -z + x * y
|
|
18446744060824649728.000000 = -4294967295.000000 + 4294967295.000000 * 4294967295.000000
|
|
dst = 43efffffffa00000 = 1.844674406082465e+19
|
|
|