[Mono-dev] amd64 SSE2 Sqrt patch

Jonathan Chambers joncham at gmail.com
Fri Apr 11 12:48:01 EDT 2008


Hello,
      Inspired by the patch for an SSE2 implementation of Abs (
http://permalink.gmane.org/gmane.comp.gnome.mono.patches/111238), I tried
Sqrt. This is only my 2nd JIT patch and my first involving an SSE intrinsic
so any reviews would be appreciated. I see about a 14% speedup using the
following benchmark (with N=1000000000):

using System;

class Program
{
        static void Main(string[] args)
        {
                int count = int.Parse(args[0]);
                double d = 1.0;
                for (int i = 0; i < count;i++)
                {
                        d = Math.Sqrt(i);
                }
                Console.WriteLine(d);
        }
}

I ran it 10 times and get average time of:

Orig
30.5517s

SSE
26.1512s

Code is contributed under MIT/X11

Thanks,
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080411/ba24cb8b/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqrt_sse.diff
Type: text/x-diff
Size: 2331 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080411/ba24cb8b/attachment.bin 


More information about the Mono-devel-list mailing list