[sldev] SSE2 on MSVC

Dirk Moerenhout blakar at gmail.com
Mon Jun 18 01:15:40 PDT 2007


SSE2 is on by default when compiling with VS2005, the docs are right
so the code is not needed. One example where it'll generate SSE code
is when you cast float to int. Though as this has been replaced by
lltrunc you won't benefit from SSE (SSE is faster than lltrunc).
Besides that it'll insert some SSE instructions in your code but not a
lot.

I had a go at manually rewriting some functions in the viewer and in
most cases writing optimised x87 code gave a 2 to 3 times speed
increase for that specific function. I'm also going to check where we
can use SSE (we don't need SSE2 as SSE2 mainly extends SSE to have
64bit floats which we don't use anyway.)

An example of optimised x87 code can be found in VWR-1277 in JIRA.

Dirk aka Blakar Ogre

On 6/18/07, Erik Anderson <odysseus654 at gmail.com> wrote:
> According to the docs, "By default, SSE2 implementation (using
> _set_SSE2_enable) is enabled on processors that support it".  Does this
> change cause an improvement in performance at all?
>
> At this point I believe that SSE2 is a number of CPU instructions designed
> to "help speed 3D graphical calculations" or somesuch (or was that MMX?).
> If a program is compiled to use SSE2, then it (can) run faster on the
> SSE2-enabled processor than the original version would and cause spectacular
> crashes on the non-SSE2-enabled processor.  Thus our discussion here about
> whether or not to support every CPU model.
>
> Does anyone have a good idea as to where these SSE2 commands would improve
> SL the most?  Considering that the CRT appears to have multiple
> implementations of the math libraries, one that uses SSE2 and the other that
> doesn't, would it be helpful to have multiple implementations of some of our
> functions?
>
>
> On 6/17/07, Nicholaz Beresford <nicholaz at blueflash.cc> wrote:
> >
> > Dunno if the code bit below makes any sense (I haven't got
> > much idea what SSE2 is, despite having read it on Wikipedia),
> > but what do you think?
> >
> >         //
> >         // enable MSFT SSE2 extensions
> >         //
> >         CProcessor cproc;
> >         const ProcessorInfo *pinfo= cproc.GetCPUInfo();
> >         int sse2= FALSE;
> >         if (pinfo->_Ext.SSE2_StreamingSIMD2_Extensions) {
> >                 //
> http://msdn2.microsoft.com/en-us/library/bthd138d(VS.80).aspx
> >                 sse2= _set_SSE2_enable(TRUE);
> >         }
> >         llinfos << "running with" << (!sse2 ? "out" : "" ) << "
> _set_sse2_enabled " << llendl;
> >
> >
> >
> > Nick
> >
> >
> > --
> > Second Life from the inside out:
> > http://nicholaz-beresford.blogspot.com/
> > _______________________________________________
> > Click here to unsubscribe or manage your list subscription:
> >
> /index.html
> >
>
>
> _______________________________________________
> Click here to unsubscribe or manage your list subscription:
> /index.html
>
>


More information about the SLDev mailing list