diff options
author | David Schleef <ds@schleef.org> | 2005-11-13 22:12:57 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2005-11-13 22:12:57 +0000 |
commit | c4ff3a7ad8f1853626408480b3c8ef392456fa28 (patch) | |
tree | 2270e1ec6cd1b6093ed2ecca0f5d554c274ecf8e | |
parent | 682c41b1d1ac4cff276d72f9ddd7ce1c057fae4e (diff) | |
download | liboil-c4ff3a7ad8f1853626408480b3c8ef392456fa28.tar.gz |
* liboil/i386/fdct8x8theora_i386.c: (fdct8x8theora_mmx):
* liboil/i386/recon8x8_i386.c: (recon8x8_intra_mmx):
Fix some asm code that accesses global variables from asm
code in a very incorrect manner. (#5032)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | liboil/i386/fdct8x8theora_i386.c | 36 | ||||
-rw-r--r-- | liboil/i386/recon8x8_i386.c | 15 |
3 files changed, 33 insertions, 25 deletions
@@ -1,3 +1,10 @@ +2005-11-13 David Schleef <ds@schleef.org> + + * liboil/i386/fdct8x8theora_i386.c: (fdct8x8theora_mmx): + * liboil/i386/recon8x8_i386.c: (recon8x8_intra_mmx): + Fix some asm code that accesses global variables from asm + code in a very incorrect manner. (#5032) + 2005-11-12 David Schleef <ds@schleef.org> * liboil/math/math.c: split math.c into ref/ and math/ versions. diff --git a/liboil/i386/fdct8x8theora_i386.c b/liboil/i386/fdct8x8theora_i386.c index 7d8bce3..5969fc3 100644 --- a/liboil/i386/fdct8x8theora_i386.c +++ b/liboil/i386/fdct8x8theora_i386.c @@ -45,21 +45,24 @@ #include <liboil/dct/dct.h> #include <math.h> -/* FIXME this causes problems on old gcc */ -static const __attribute__ ((aligned(8),used)) int64_t xC1S7 = 0x0fb15fb15fb15fb15LL; -static const __attribute__ ((aligned(8),used)) int64_t xC2S6 = 0x0ec83ec83ec83ec83LL; -static const __attribute__ ((aligned(8),used)) int64_t xC3S5 = 0x0d4dbd4dbd4dbd4dbLL; -static const __attribute__ ((aligned(8),used)) int64_t xC4S4 = 0x0b505b505b505b505LL; -static const __attribute__ ((aligned(8),used)) int64_t xC5S3 = 0x08e3a8e3a8e3a8e3aLL; -static const __attribute__ ((aligned(8),used)) int64_t xC6S2 = 0x061f861f861f861f8LL; -static const __attribute__ ((aligned(8),used)) int64_t xC7S1 = 0x031f131f131f131f1LL; - -#if defined(__MINGW32__) || defined(__CYGWIN__) || \ - defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__)) -# define M(a) "_" #a -#else -# define M(a) #a -#endif +static const uint16_t constants[][4] = { + { 0xfb15, 0xfb15, 0xfb15, 0xfb15 }, + { 0xec83, 0xec83, 0xec83, 0xec83 }, + { 0xd4db, 0xd4db, 0xd4db, 0xd4db }, + { 0xb505, 0xb505, 0xb505, 0xb505 }, + { 0x8e3a, 0x8e3a, 0x8e3a, 0x8e3a }, + { 0x61f8, 0x61f8, 0x61f8, 0x61f8 }, + { 0x31f1, 0x31f1, 0x31f1, 0x31f1 } +}; +#define xC1S7 0 +#define xC2S6 1 +#define xC3S5 2 +#define xC4S4 3 +#define xC5S3 4 +#define xC6S2 5 +#define xC7S1 6 +#define stringify(x) #x +#define M(x) "(" stringify(x) "*8)(%2)" OIL_DECLARE_CLASS(fdct8x8theora); @@ -349,7 +352,8 @@ fdct8x8theora_mmx(int16_t *src, int16_t *dest) : "+r" (src), "+r" (dest) - : "r" (temp) + : "r" (temp), + "r" (constants) : "memory" ); } diff --git a/liboil/i386/recon8x8_i386.c b/liboil/i386/recon8x8_i386.c index 91df0d6..87dde94 100644 --- a/liboil/i386/recon8x8_i386.c +++ b/liboil/i386/recon8x8_i386.c @@ -36,13 +36,9 @@ OIL_DECLARE_CLASS (recon8x8_intra); OIL_DECLARE_CLASS (recon8x8_inter); OIL_DECLARE_CLASS (recon8x8_inter2); -static const __attribute__ ((aligned(8),used)) uint64_t V128 = 0x8080808080808080LL; - -#ifdef HAVE_LD_UNDERSCORE -# define M(a) "_" #a -#else -# define M(a) #a -#endif +const uint8_t c0x80[8] = { + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 +}; static void recon8x8_intra_mmx (uint8_t *dest, int ds, int16_t *change) @@ -50,7 +46,7 @@ recon8x8_intra_mmx (uint8_t *dest, int ds, int16_t *change) __asm__ __volatile__ ( " .balign 16 \n\t" - " movq "M(V128)", %%mm0 \n\t" /* Set mm0 to 0x8080808080808080 */ + " movq (%3), %%mm0 \n\t" /* Set mm0 to 0x8080808080808080 */ " lea 128(%1), %%edi \n\t" /* Endpoint in input buffer */ "1: \n\t" @@ -69,7 +65,8 @@ recon8x8_intra_mmx (uint8_t *dest, int ds, int16_t *change) " emms \n\t" : "+r" (dest) : "r" (change), - "r" (ds) + "r" (ds), + "r" (c0x80) : "memory", "edi" ); } |