From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bojTk-0006Kk-KG for qemu-devel@nongnu.org; Mon, 26 Sep 2016 23:54:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bojTj-0002tl-HX for qemu-devel@nongnu.org; Mon, 26 Sep 2016 23:54:48 -0400 Date: Tue, 27 Sep 2016 13:41:42 +1000 From: David Gibson Message-ID: <20160927034142.GE15376@umbus.fritz.box> References: <34249C6D-327A-4ED4-BB2D-8E2F532A5720@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KlAEzMkarCnErv5Q" Content-Disposition: inline In-Reply-To: <34249C6D-327A-4ED4-BB2D-8E2F532A5720@gmail.com> Subject: Re: [Qemu-devel] [Qemu-ppc] 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 Cc: "list@suse.de:PowerPC list:PowerPC" , qemu-devel qemu-devel --KlAEzMkarCnErv5Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 26, 2016 at 09:05:22PM -0400, G 3 wrote: > I made my own experimental implementation of the fmadds instruction that I > would like to add to QEMU. How would I do this? >=20 > My implementation would probably look like this: >=20 > void fmadds(float *frD, float frA, float frC, float frB) > { > *frD =3D frA * frC + frB; > } So.. using a helper essentially? You'd need to submit a patch adding the new implementation, with a commit message which made the case for replacing the existing implementation with yours. So, you'd need data to suggest both that your version generates correct results, and that it is faster or otherwise better than the existing one. >=20 >=20 > I then want to see if this implementation will make things faster. This c= ode > will test my implementation: >=20 > #include > #include >=20 > /* > fmadds basically does this frD =3D frA * frC + frB > */ >=20 > int main (int argc, const char * argv[]) { > const int iteration_count =3D 100000000; > double iter, frD, frA, frB, frC; > clock_t start_time, end_time; >=20 > frA =3D 10; > frB =3D 5; > frC =3D 2; >=20 > start_time =3D clock(); > for(iter =3D 0; iter < iteration_count; iter++) > { > asm volatile("fmadds %0, %1, %2, %3" : "=3Df" (frD) : "f" (frA), = "f" > (frC), "f" (frB)); > } > end_time =3D clock(); > printf("frD:%f frA:%f frB:%f frC:%f\n", frD, frA, frB, frC); > printf("Time elapsed: %0.2f seconds\n", (float)(end_time - start_time= ) / > CLOCKS_PER_SEC); >=20 > return 0; > } >=20 >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --KlAEzMkarCnErv5Q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX6ep0AAoJEGw4ysog2bOSFOcQANdJKcHj8YcLoSc/iillrLg5 e9hdDzEMv8TnDC/KuAtA0QDx0AX/91FerGD718bGxYpig5oI9hgqiFQ1fJXxBv02 7EW0auCapA4I99uS1wPcbXKz6lGNonsWpL+xWBEruz4sUY3CBwRB9wX5VGwo9/u4 xYhd3NRD2+roPNG+8ovBQI/EkUNJaQffPsW8qpn1BJhzLonC3QLNWrbMG+IvvU/T jpKvHM3T4mcC4JLS+KAjV56iIitiFY5ZovU4IrS+caf8AhchlXapVSGgxqSQwNBB YbQPB6WZi+iMGZAUggXkAV5MLJVd/m7TRBNTDsTDiOmg2SJyZh0TFrpUJeTriBT2 qEplmhqeO7ojKqC0UhSx1Ex8WB0QC+i0ceBHIIKLApNr74d/0/xwUSRcqMRdmgHN /h3Q3U7iYCvl2mJyRt6mATnM/I24ndsHpSDzVF6tNvZbkZaBApP75LTdLTww6RqL cej0DK2avvYHGI5zuQeG7xXIIpE77FO6ZEC3GmIa6XuunAW2s+Bdybc75DUTxmNW NgA4/B7SOwLL6NfxAFcjR0ykmlO6GQt/q8pXMpflxuUy3SCCiaXh7Oy3h3i4w6iO XvW9OKydg+sz22P2cVYTTScEIvOXsYca08lSeArBBsWfvQYMB/up1qckd32DDAAu d7FhH7/lR/X3WeDegftf =AB4X -----END PGP SIGNATURE----- --KlAEzMkarCnErv5Q--