[MPlayer-dev-eng] [PATCH] Mask misaligned exception on K10
Ivan Kalvachev
ikalvachev at gmail.com
Sun Mar 9 13:21:00 CET 2008
On Sun, Mar 9, 2008 at 1:22 PM, Zuxy Meng <zuxy.meng at gmail.com> wrote:
> Hi,
>
> 2008/3/9, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
>
> > 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.
>
> I can understand that. That's why I sent out the patch for discussion :-)
>
> According to AMD's manual, the cost of an unaligned access is an extra
> cycle and half the throughput.
>
>
> >
> > > +/* 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.?
>
> The indentation is consistent with the context. Don't have ICC or Apple though.
Just use constant instead of expression, it would work in all cases.
I'm in favor of this patch and I think it should be enabled on
releases and disabled on debug builds. Until somebody writes native
K10 asm.
More information about the MPlayer-dev-eng
mailing list