From: David Gibson <david@gibson.dropbear.id.au>
To: G 3 <programmingkidx@gmail.com>
Cc: "list@suse.de:PowerPC list:PowerPC" <qemu-ppc@nongnu.org>,
qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-ppc] How to add my implementation of the fmadds instruction to QEMU
Date: Tue, 27 Sep 2016 13:41:42 +1000 [thread overview]
Message-ID: <20160927034142.GE15376@umbus.fritz.box> (raw)
In-Reply-To: <34249C6D-327A-4ED4-BB2D-8E2F532A5720@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1783 bytes --]
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?
>
> My implementation would probably look like this:
>
> void fmadds(float *frD, float frA, float frC, float frB)
> {
> *frD = 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.
>
>
> I then want to see if this implementation will make things faster. This code
> will test my implementation:
>
> #include <stdio.h>
> #include <time.h>
>
> /*
> fmadds basically does this frD = frA * frC + frB
> */
>
> int main (int argc, const char * argv[]) {
> const int iteration_count = 100000000;
> double iter, frD, frA, frB, frC;
> clock_t start_time, end_time;
>
> frA = 10;
> frB = 5;
> frC = 2;
>
> start_time = clock();
> for(iter = 0; iter < iteration_count; iter++)
> {
> asm volatile("fmadds %0, %1, %2, %3" : "=f" (frD) : "f" (frA), "f"
> (frC), "f" (frB));
> }
> end_time = 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);
>
> return 0;
> }
>
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-09-27 3:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-27 1:05 [Qemu-devel] How to add my implementation of the fmadds instruction to QEMU G 3
2016-09-27 3:41 ` David Gibson [this message]
2016-09-27 11:43 ` Peter Maydell
2016-09-27 14:33 ` G 3
2016-09-27 15:21 ` Peter Maydell
2016-09-27 16:16 ` Eric Blake
2016-09-27 16:51 ` G 3
2016-09-27 16:58 ` Peter Maydell
2016-09-29 4:17 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-29 15:20 ` Programmingkid
2016-09-29 18:19 ` Alex Bennée
2016-09-29 21:52 ` Programmingkid
2016-09-29 22:36 ` Alex Bennée
2016-09-29 22:39 ` Programmingkid
2016-09-29 15:41 ` Peter Maydell
2016-09-29 16:55 ` Programmingkid
2016-09-30 0:39 ` David Gibson
2016-09-30 0:44 ` Programmingkid
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160927034142.GE15376@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=programmingkidx@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).