qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] How to add my implementation of the fmadds instruction to QEMU
@ 2016-09-27  1:05 G 3
  2016-09-27  3:41 ` [Qemu-devel] [Qemu-ppc] " David Gibson
  2016-09-27 11:43 ` [Qemu-devel] " Peter Maydell
  0 siblings, 2 replies; 18+ messages in thread
From: G 3 @ 2016-09-27  1:05 UTC (permalink / raw)
  To: list@suse.de:PowerPC list:PowerPC, qemu-devel qemu-devel

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;
}


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;
}

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-09-30  0:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-27 11:43 ` [Qemu-devel] " 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

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).