From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bov3n-0002j9-Q5 for qemu-devel@nongnu.org; Tue, 27 Sep 2016 12:16:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bov3i-0004fm-6I for qemu-devel@nongnu.org; Tue, 27 Sep 2016 12:16:46 -0400 References: <34249C6D-327A-4ED4-BB2D-8E2F532A5720@gmail.com> From: Eric Blake Message-ID: <7e2274fa-f649-887c-c78e-7f5b09749450@redhat.com> Date: Tue, 27 Sep 2016 11:16:40 -0500 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="RooXjfHiR9FJ83fhUE0l29jtpKjCLtAk3" Subject: Re: [Qemu-devel] How to add my implementation of the fmadds instruction to QEMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: G 3 , Peter Maydell Cc: "list@suse.de:PowerPC list:PowerPC" , qemu-devel qemu-devel This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --RooXjfHiR9FJ83fhUE0l29jtpKjCLtAk3 From: Eric Blake To: G 3 , Peter Maydell Cc: "list@suse.de:PowerPC list:PowerPC" , qemu-devel qemu-devel Message-ID: <7e2274fa-f649-887c-c78e-7f5b09749450@redhat.com> Subject: Re: [Qemu-devel] How to add my implementation of the fmadds instruction to QEMU References: <34249C6D-327A-4ED4-BB2D-8E2F532A5720@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/27/2016 09:33 AM, G 3 wrote: >>> void fmadds(float *frD, float frA, float frC, float frB) >>> { >>> *frD =3D frA * frC + frB; >>> } >=20 > It sounds like I should change my argument types to double. Insufficient. The whole reason that fmadds exists is that there are provably cases where two operations that both round are GUARANTEED to get the wrong answer when compared to a single operation, regardless of the precisions involved. Widening from float to double does NOT eliminate the double-rounding problem. >=20 > I still want to try implementing this function. I'm thinking rewriting = the > helper_fmadd() function in target-ppc/fpu_helper.c. Does that > sound correct? I seriously doubt you would be able to write a correct implementation, if you aren't even aware of the double-rounding reasons why fmadds was added to the IEEE floating point specification in the first place. Your idea that you would be able to speed things up is probably a premature optimization, given that you have no realistic clue how hard it is to CORRECTLY implement fused-multiply-add. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --RooXjfHiR9FJ83fhUE0l29jtpKjCLtAk3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX6ptoAAoJEKeha0olJ0Nq2d8H/04hGflDgi7rE7AFuNuOlMJ8 4Gf5X1kEajzfKiUR68iv6gq2MMQ1pstng/+SH0dO+IkgJ8KqCk6VEmsUYNa33Y7v xDbnus9Zq5hsFDORYIm+DGmxuMzPwoOsAy6kcBS4xGQrxkadHVVqkwUT9Cqad7WF dB8pCS7tXCPY41C+idXgFEzfDzOcWaaidVhagy8wJ2TRcRaDYRFBaGYIWpK6UAPG ZcGNUyW0nfIg18DZDKf7U3ZOKm+0CkCaQKj+zVBX45qLQCZfAoglYw1uM+EqmZWq FTcFww0n4jN7ZJywcWeY+fYZMulq9nnp4IYvPpYsWTooRDLx4KQrrEGRZR6blVQ= =hHx8 -----END PGP SIGNATURE----- --RooXjfHiR9FJ83fhUE0l29jtpKjCLtAk3--