[MPlayer-dev-eng] [PATCH] Mask misaligned exception on K10
Zuxy Meng
zuxy.meng at gmail.com
Sun Mar 9 12:22:00 CET 2008
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.
--
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
More information about the MPlayer-dev-eng
mailing list