Added SSE + OptLib and updated FPU

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Added SSE + OptLib and updated FPU

Post by 01000101 »

http://wiki.osdev.org/SSE
http://wiki.osdev.org/FPU
http://wiki.osdev.org/User:01000101/optlib/

I'll be adding more soon, just wanted to give a heads up in case anyone wanted to expand upon these.
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: Added SSE + OptLib and updated FPU

Post by 01000101 »

I just ran tests in Bochs, QEMU, and VirtualBox on my memclr(). I ran 10 sets of 1000 clears of a 4K 16-byte aligned memory location, and got an average of 881,000 ticks (using RDTSC) per set using the SSE2 version. In the same run, I also tested the same area with the same sets using the non-SSE version and got an average of 1,055,000 ticks all in BOCHS. For QEMU / VirtualBox I got 45,190,986 / 65,456,891 for the non-SSE runs and 6,021,188 / 20,601,164 for the SSE2 runs.

This will probably get shunned away as there are a ton of factors around performance monitoring, but 3 different emulators reporting increased speeds of ~30% in 3 seperate emulators still is a good increase.

Those functions can be found in the wiki about OptLib.

I'll post more findings in mroe environments later.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Added SSE + OptLib and updated FPU

Post by AJ »

Good stuff. I'm a little way of adding anything like that to my OS, but the library is mentally bookmarked :)

Cheers,
Adam
cyr1x
Member
Member
Posts: 207
Joined: Tue Aug 21, 2007 1:41 am
Location: Germany

Re: Added SSE + OptLib and updated FPU

Post by cyr1x »

Great stuff :)
One point:
Instead of the

Code: Select all

if(sse) ... else ...
you cold use a function pointer to those functions, like so:

Code: Select all

void * (*memcpy) (...);

void init()
{
    memcpy = memcpy_sse;
}
So you set the pointer once at runtime. This saves you from the checks.
Ok, it sounds maybe a bit to "much" of optimization but ... :D
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: Added SSE + OptLib and updated FPU

Post by 01000101 »

that's a great idea. It may be too much of a micro-optimization, but then again, this is a micro-optimized library. :D
Post Reply