[MPlayer-dev-eng] [PATCH] Mask misaligned exception on K10

Zuxy Meng zuxy.meng at gmail.com
Sun Mar 9 19:33:14 CET 2008


Hi,

2008/3/9, Guillaume POIRIER <poirierg at gmail.com>:
> Hello,
>
> On Sun, Mar 9, 2008 at 11:42 AM, Reimar Döffinger
> <Reimar.Doeffinger at stud.uni-karlsruhe.de> wrote:
> > On Sun, Mar 09, 2008 at 06:05:17PM +0800, Zuxy Meng wrote:
> >  > K10 allows for misaligned access of SSE instructions. The attached
> >  > patch enables this feature. Hopefully it can avoid some mysterious
> >  > crashes (as in http://lists.mplayerhq.hu/pipermail/mplayer-users/2008-March/072115.html)
> >  > caused either by buggy code or buggy compilers.
> >
> >  I very much dislike this, now instead of mysterious crashes we get
> >  mysterious performance problems, this is just the equivalent of sweeping
> >  the dust under the carpet.
> >
> >  > +/* Mask the SSE misaligned exception so as to avoid some mysterious
> >  > + * crashes; currently only available on AMD K10.
> >  > + */
> >  > +static void mask_misalign_sse()
> >  > +{
> >  > +     unsigned mxcsr;
> >  > +     asm volatile (
> >  > +                     "stmxcsr %0\n\t"
> >  > +                     "orl $(1 << 17), %0\n\t"
> >  > +                     "ldmxcsr %0\n\t"
> >  > +                     :"=m"(mxcsr)
> >  > +                  );
> >  > +}
> >
> >  I do not like the indentation, but more importantly I've never seen <<
> >  used in asm before, are you sure that works with ICC, Apples binutils
> >  etc.?
>
> I tested it on MacIntel, OSX 10.4.11, and it seems to work alright.

It's mentioned in 'as' info file as an infix operator used in
expressions, just like '+' and '-' so I guess its usage should be
safe. However filling the resulting constant instead doesn't lose too
much readability and seems to be more acceptable.
-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6



More information about the MPlayer-dev-eng mailing list