summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2005-01-11 08:03:08 +0000
committerDavid Schleef <ds@schleef.org>2005-01-11 08:03:08 +0000
commit6233c61a9d737153b32e408e91428c62fa1868e6 (patch)
treeecfc5d84c0a11138df8487a0e64dfa06bad60852
parentcbf70b1a9bea04c646de114acb7738c086967d80 (diff)
downloadliboil-6233c61a9d737153b32e408e91428c62fa1868e6.tar.gz
* README: additional notes
* configure.ac: look for mmap() * examples/md5/md5sum.c: (main): fix for same * liboil/copy/trans8x8_i386.c: (trans8x8_u16_mmx): Need to be careful about using %ebx * liboil/dct/idct8x8_i386.c: (fdct8x8s_s16_mmx): same * liboil/simdpack/abs_i386.c: (abs_u16_s16_mmx): clobber memory
-rw-r--r--ChangeLog10
-rw-r--r--README34
-rw-r--r--configure.ac1
-rw-r--r--examples/md5/md5sum.c6
-rw-r--r--liboil/copy/trans8x8_i386.c42
-rw-r--r--liboil/dct/idct8x8_i386.c4
-rw-r--r--liboil/simdpack/abs_i386.c12
7 files changed, 71 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index ac8803d..23152b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-01-11 David Schleef <ds@schleef.org>
+
+ * README: additional notes
+ * configure.ac: look for mmap()
+ * examples/md5/md5sum.c: (main): fix for same
+ * liboil/copy/trans8x8_i386.c: (trans8x8_u16_mmx): Need to be
+ careful about using %ebx
+ * liboil/dct/idct8x8_i386.c: (fdct8x8s_s16_mmx): same
+ * liboil/simdpack/abs_i386.c: (abs_u16_s16_mmx): clobber memory
+
2005-01-09 David Schleef <ds@schleef.org>
* autogen.sh:
diff --git a/README b/README
index 12cfe35..eb7445f 100644
--- a/README
+++ b/README
@@ -1,12 +1,34 @@
+
+Requirements
+============
+
+Liboil has no required dependecies (other than a decent C compiler
+and standard C library). A few extra tests and examples are enabled
+if you have glib-2.0 installed, but these extras are neither required
+nor installed.
+
+Using GCC is strongly recommended, since the most interesting bits
+of liboil are written in GCC-style inline assembly. GCC versions
+prior to 3.2 are not supported.
+
+
+Problems Compiling?
+===================
+
+Function implementations in liboil are designed to be modular, so
+if your compiler is having difficulty compiling a particular function,
+simply disable it and the corresponding OIL_DEFINE_IMPL() line.
+
+
ABI warning
===========
In general, liboil is not ABI stable. However, portions of liboil
-are guaranteed to be stable through the 0.3.x series, and using
+are guaranteed to be stable through the 0.3.x series, and by using
a compatibility library, through the 0.4.x series as well. This
-policy is designed to provide almost all applications with ABI
-stability for the symbols most used in liboil.
+policy is designed to provide almost all applications the necessary
+ABI stability for the symbols likely to be used in liboil.
Any symbols declared by including <liboil/liboil.h> follow this
ABI policy. This includes all liboil function classes as well
@@ -39,9 +61,9 @@ correctly. Then, at a convenient time, libB and libC can
independently be recompiled using liboil-0.4.x, and the packages
will no longer depend on liboil-0.3.so.
-The traditional way of dealing with these changes is to
-migrate all packages to the new library as quickly as possible.
-This is unduly cumbersome.
+The traditional way of dealing with these changes is to migrate
+all packages to the new library as quickly as possible. This is
+unduly cumbersome.
diff --git a/configure.ac b/configure.ac
index 112d29b..ebdfc8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,7 @@ AM_CONDITIONAL(HAVE_CPU_IA64, test "x$HAVE_CPU_IA64" = "xyes")
AC_C_BIGENDIAN
+AC_FUNC_MMAP()
AC_CHECK_LIB(m, rintf,
AC_DEFINE(HAVE_RINTF, 1, [Define if rintf() is available]))
AC_CHECK_LIB(m, lrint,
diff --git a/examples/md5/md5sum.c b/examples/md5/md5sum.c
index db37330..36a5132 100644
--- a/examples/md5/md5sum.c
+++ b/examples/md5/md5sum.c
@@ -25,8 +25,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define HAVE_MMAN_H
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -38,7 +36,7 @@
#include <stdlib.h>
#include <sys/stat.h>
-#ifdef HAVE_MMAN_H
+#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
#include <errno.h>
@@ -151,7 +149,7 @@ int main(int argc, char *argv[])
ret = fstat (fd, &st);
n_bytes = st.st_size;
-#ifdef HAVE_MMAN_H
+#ifdef HAVE_MMAP
while (1) {
ptr = mmap (NULL, n_bytes, PROT_READ, MAP_SHARED | MAP_POPULATE, fd, 0);
getpid();
diff --git a/liboil/copy/trans8x8_i386.c b/liboil/copy/trans8x8_i386.c
index d6f299a..4ee5004 100644
--- a/liboil/copy/trans8x8_i386.c
+++ b/liboil/copy/trans8x8_i386.c
@@ -38,99 +38,99 @@ static void
trans8x8_u16_mmx (uint16_t *dest, int dstr, uint16_t *src, int sstr)
{
asm volatile (
- " leal (%3,%3,2),%%ebx \n" // UBER 0:
+ " leal (%3,%3,2),%%eax \n" // UBER 0:
" movq (%1), %%mm0 \n" // UBER 1:
" movq (%1,%3,2), %%mm2 \n" // UBER 2:
" movq %%mm0, %%mm4 \n" // UBER 3: 1
" movq %%mm2, %%mm5 \n" // UBER 4: 2
" punpcklwd (%1,%3), %%mm0 \n" // UBER 5: 1
- " punpcklwd (%1,%%ebx), %%mm2 \n" // UBER 6: 0 2
+ " punpcklwd (%1,%%eax), %%mm2 \n" // UBER 6: 0 2
" punpckhwd (%1,%3), %%mm4 \n" // UBER 7: 3
- " punpckhwd (%1,%%ebx), %%mm5 \n" // UBER 8: 4
+ " punpckhwd (%1,%%eax), %%mm5 \n" // UBER 8: 4
" movq %%mm0, %%mm1 \n" // UBER 9: 5
" movq %%mm4, %%mm3 \n" // UBER 10: 7
" punpckldq %%mm2, %%mm0 \n" // UBER 11: 5 6
" punpckldq %%mm5, %%mm4 \n" // UBER 12: 7 8
" punpckhdq %%mm2, %%mm1 \n" // UBER 13: 6 9
" punpckhdq %%mm5, %%mm3 \n" // UBER 14: 9 10
- " leal (%2,%2,2),%%ebx \n" // UBER 15: 8
+ " leal (%2,%2,2),%%eax \n" // UBER 15: 8
" movq %%mm0, 0(%0) \n" // UBER 16: 11
" movq %%mm1, (%0,%2) \n" // UBER 17: 13
" movq %%mm4, (%0,%2,2) \n" // UBER 18: 12
- " movq %%mm3, (%0,%%ebx) \n" // UBER 19: 14 15
+ " movq %%mm3, (%0,%%eax) \n" // UBER 19: 14 15
- " leal (%3,%3,2),%%ebx \n"
+ " leal (%3,%3,2),%%eax \n"
" movq 8(%1), %%mm0 \n"
" movq 8(%1,%3,2), %%mm2 \n"
" movq %%mm0, %%mm4 \n"
" movq %%mm2, %%mm5 \n"
" punpcklwd 8(%1,%3), %%mm0 \n"
- " punpcklwd 8(%1,%%ebx), %%mm2 \n"
+ " punpcklwd 8(%1,%%eax), %%mm2 \n"
" punpckhwd 8(%1,%3), %%mm4 \n"
- " punpckhwd 8(%1,%%ebx), %%mm5 \n"
+ " punpckhwd 8(%1,%%eax), %%mm5 \n"
" movq %%mm0, %%mm1 \n"
" movq %%mm4, %%mm3 \n"
" punpckldq %%mm2, %%mm0 \n"
" punpckldq %%mm5, %%mm4 \n"
" punpckhdq %%mm2, %%mm1 \n"
" punpckhdq %%mm5, %%mm3 \n"
- " leal (%2,%2,2),%%ebx \n"
+ " leal (%2,%2,2),%%eax \n"
" leal (%0,%2,4),%0 \n"
" movq %%mm0, 0(%0) \n"
" movq %%mm1, (%0,%2) \n"
" movq %%mm4, (%0,%2,2) \n"
- " movq %%mm3, (%0,%%ebx) \n"
+ " movq %%mm3, (%0,%%eax) \n"
" leal (%1,%3,4),%1 \n"
- " leal (%3,%3,2),%%ebx \n"
+ " leal (%3,%3,2),%%eax \n"
" movq 0(%1), %%mm0 \n"
" movq 0(%1,%3,2), %%mm2 \n"
" movq %%mm0, %%mm4 \n"
" movq %%mm2, %%mm5 \n"
" punpcklwd 0(%1,%3), %%mm0 \n"
- " punpcklwd 0(%1,%%ebx), %%mm2 \n"
+ " punpcklwd 0(%1,%%eax), %%mm2 \n"
" punpckhwd 0(%1,%3), %%mm4 \n"
- " punpckhwd 0(%1,%%ebx), %%mm5 \n"
+ " punpckhwd 0(%1,%%eax), %%mm5 \n"
" movq %%mm0, %%mm1 \n"
" movq %%mm4, %%mm3 \n"
" punpckldq %%mm2, %%mm0 \n"
" punpckldq %%mm5, %%mm4 \n"
" punpckhdq %%mm2, %%mm1 \n"
" punpckhdq %%mm5, %%mm3 \n"
- " leal (%2,%2,2),%%ebx \n"
+ " leal (%2,%2,2),%%eax \n"
" neg %2 \n"
" leal (%0,%2,4),%0 \n"
" neg %2 \n"
" movq %%mm0, 8(%0) \n"
" movq %%mm1, 8(%0,%2) \n"
" movq %%mm4, 8(%0,%2,2) \n"
- " movq %%mm3, 8(%0,%%ebx) \n"
+ " movq %%mm3, 8(%0,%%eax) \n"
- " leal (%3,%3,2),%%ebx \n"
+ " leal (%3,%3,2),%%eax \n"
" movq 8(%1), %%mm0 \n"
" movq 8(%1,%3,2), %%mm2 \n"
" movq %%mm0, %%mm4 \n"
" movq %%mm2, %%mm5 \n"
" punpcklwd 8(%1,%3), %%mm0 \n"
- " punpcklwd 8(%1,%%ebx), %%mm2 \n"
+ " punpcklwd 8(%1,%%eax), %%mm2 \n"
" punpckhwd 8(%1,%3), %%mm4 \n"
- " punpckhwd 8(%1,%%ebx), %%mm5 \n"
+ " punpckhwd 8(%1,%%eax), %%mm5 \n"
" movq %%mm0, %%mm1 \n"
" movq %%mm4, %%mm3 \n"
" punpckldq %%mm2, %%mm0 \n"
" punpckldq %%mm5, %%mm4 \n"
" punpckhdq %%mm2, %%mm1 \n"
" punpckhdq %%mm5, %%mm3 \n"
- " leal (%2,%2,2),%%ebx \n"
+ " leal (%2,%2,2),%%eax \n"
" leal (%0,%2,4),%0 \n"
" movq %%mm0, 8(%0) \n"
" movq %%mm1, 8(%0,%2) \n"
" movq %%mm4, 8(%0,%2,2) \n"
- " movq %%mm3, 8(%0,%%ebx) \n"
+ " movq %%mm3, 8(%0,%%eax) \n"
" emms \n"
: "+r" (dest), "+r" (src), "+r" (dstr), "+r" (sstr)
:
- : "ebx");
+ : "eax");
}
OIL_DEFINE_IMPL (trans8x8_u16_mmx, trans8x8_u16);
diff --git a/liboil/dct/idct8x8_i386.c b/liboil/dct/idct8x8_i386.c
index ca16d9d..0f68c72 100644
--- a/liboil/dct/idct8x8_i386.c
+++ b/liboil/dct/idct8x8_i386.c
@@ -96,6 +96,8 @@ fdct8x8s_s16_mmx (uint16_t *dest, int dstr, uint16_t *src, int sstr)
int32_t tmp[32];
asm volatile (
+ /* Note: this asm is unclean with %ebx, but it's not an issue
+ * in this particular case. */
#if 1
/* first half */
" movl %1, %%eax \n" // src
@@ -401,7 +403,7 @@ fdct8x8s_s16_mmx (uint16_t *dest, int dstr, uint16_t *src, int sstr)
" emms \n"
:
: "m" (dest), "m" (src), "m" (dstr), "m" (sstr), "r" (tmp), "r" (dct_mmx_constants)
- : "eax", "ebx", "ecx", "edx");
+ : "eax", "ecx", "edx");
}
OIL_DEFINE_IMPL_FULL (fdct8x8s_s16_mmx, fdct8x8s_s16, OIL_IMPL_FLAG_MMX | OIL_IMPL_FLAG_SSE);
diff --git a/liboil/simdpack/abs_i386.c b/liboil/simdpack/abs_i386.c
index 626065e..824c1ce 100644
--- a/liboil/simdpack/abs_i386.c
+++ b/liboil/simdpack/abs_i386.c
@@ -134,7 +134,7 @@ OIL_DEFINE_IMPL_ASM (abs_u16_s16_i386asm3, abs_u16_s16);
static void
abs_u16_s16_mmx (uint16_t * dest, int dstr, int16_t * src, int sstr, int n)
{
- const int16_t p[][4] = {
+ static const int16_t p[][4] = {
{ -32768, -32768, -32768, -32768 },
{ 32767, 32767, 32767, 32767 }
};
@@ -150,7 +150,7 @@ abs_u16_s16_mmx (uint16_t * dest, int dstr, int16_t * src, int sstr, int n)
__asm__ __volatile__ ("\n"
" movq (%0), %%mm2 \n"
" movq 8(%0), %%mm3 \n"
- :: "c" (p));
+ :: "r" (p));
while (n--) {
tmp[0] = *src;
OIL_INCREMENT (src, sstr);
@@ -161,16 +161,16 @@ abs_u16_s16_mmx (uint16_t * dest, int dstr, int16_t * src, int sstr, int n)
tmp[3] = *src;
OIL_INCREMENT (src, sstr);
__asm__ __volatile__ ("\n"
- " movq (%%eax), %%mm1 \n"
+ " movq (%0), %%mm1 \n"
" movq %%mm1, %%mm0 \n"
" paddsw %%mm2, %%mm0 \n"
" paddsw %%mm3, %%mm1 \n"
" psubsw %%mm2, %%mm0 \n"
" psubsw %%mm3, %%mm1 \n"
" psubw %%mm1, %%mm0 \n"
- " movq %%mm0, (%%eax) \n"
- :: "a" (&tmp)
- );
+ " movq %%mm0, (%0) \n"
+ : : "r" (tmp)
+ : "memory" );
*dest = tmp[0];
OIL_INCREMENT (dest, dstr);
*dest = tmp[1];